This file is indexed.

/usr/share/polymake/demo/data.ipynb is in polymake-common 3.2r2-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
{
 "cells": [
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#  Save and load data in polymake\n",
    "\n",
    "In polymake there are different ways to save and load data depending on the type and the format of the data. We distinguish between polymake objects (Polytope, Matroid,...), complex data types (Set, Matrix, Array<Vector<Rational> >,...), and data from files in arbitrary formats.\n",
    "\n",
    "## Handling polymake objects\n",
    "\n",
    "Let us take this nice example object:\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "$p = cube(3);"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "To store polymake objects use the command\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "save($p,\"myPolyObject.poly\");"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "polymake objects that are stored in polymake's own XML file format can be loaded via\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "$p=load(\"myPolyObject.poly\");"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "If you did not start `polymake` in the directory containing your object, it is necessary to add the relative path, e.g.\n",
    "    $p=load(\"MyFolder/myPolyObject.poly\");\n",
    "\n",
    "**Note:** If you load a polymake object and compute new properties, these properties will automatically be added to the original XML-file at the end of the session. You can suppress this with the command \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "$p->dont_save;"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "called prior to leaving the session (but after the last compuation with $p).\n",
    "\n",
    "## Handling complex data types\n",
    "\n",
    "It is also possible to store complex data structures in XML format via `save_data`, e.g.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "$s=new Set<Int>(1,2,3,4);\n",
    "save_data($s,\"mySet.poly\");"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "To load such files just type\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "$s=load_data(\"mySet.poly\");"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "## Handling arbitrary files\n",
    "\n",
    "Of course, it is also possible to load data from files in other formats. For this purpose use the standard Perl functions for reading and writing. Here is an example:\n",
    "\n",
    " Assume you want to load some points stored in the file points.txt which looks like this:\n",
    "    1 0 0 0\n",
    "    1 1 0 0\n",
    "    1 0 1 0\n",
    "    1 1 1 0\n",
    "    1 0 0 1\n",
    "    1 1 0 1\n",
    "    1 0 1 1\n",
    "    1 1 1 1\n",
    "For the sake of the example, let's create this file:\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "open(my $f, '> points.txt'); print $f \"1 0 0 0\\n1 1 0 0\\n1 0 1 0\\n1 1 1 0\\n1 0 0 1\\n1 1 0 1\\n1 0 1 1\\n1 1 1 1\\n\"; close $f;"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "To read this file try the following:\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "open(INPUT, \"< points.txt\");\n",
    "while(<INPUT>){\n",
    "  print $_;\n",
    "}\n",
    "close(INPUT);"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "<INPUT> is a perl input iterator reading the file line by line.  Variable `$_` refers to the current line within this loop; it has a plain string value.\n",
    "\n",
    " A reasonable task could be to store the points from the file as a matrix.  This can be done immediately, because the matrix constructor called with a list of values interprets each value as a matrix line:\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "open(INPUT, \"< points.txt\");\n",
    "$matrix=new Matrix<Rational>(<INPUT>);\n",
    "close(INPUT);"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "\n",
    "\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "polymake",
   "language": "polymake",
   "name": "polymake"
  },
  "language_info": {
   "codemirror_mode": "perl",
   "file_extension": ".pm",
   "mimetype": "text/x-polymake",
   "name": "polymake"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}