This file is indexed.

/usr/share/polymake/demo/tarballs.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
{
 "cells": [
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Saving and Restoring an Array of Polytopes\n",
    "\n",
    "If you want to deal with a whole family of polytopes at the same time, it will sometimes be convenient to save and restore them to a single file. polymake has a simple mechanism for this, storing your array of polytopes into a single tarball.\n",
    "\n",
    "The necessary functions for this are contained in the script \"tarballs\" that you can load into your polymake session by calling\n",
    "\n",
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "script(\"tarballs\");"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "It provides the two functions `pack_tarball` and `unpack_tarball`. \n",
    "\n",
    "## Storing\n",
    "\n",
    "Here is a simple example, where we create an array @a containing a cube and a simplex and save this to a file.\n",
    "\n",
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "@a = ();\n",
    "$a[0] = cube(3);\n",
    "$a[1] = simplex(3);\n",
    "pack_tarball(\"simple_polytopes.tgz\",@a);"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "This creates a file `simple_polytopes.tgz` in the current directory that is a tarred (and gzipped) archive containing two polymake files. polymake detects whether you want the archive gzipped or not from the supplied file extension (`*.tar.gz` or `*.tgz`). You can verify this by calling `tar tvfz simple_polytopes.tgz` from the command line:\n",
    "\n",
    "    \n",
    "    [nightingale]:~/temp>tar tvfz simple_polytopes.tgz \n",
    "    -rw------- xxx/yyy 1468 2009-07-01 17:20 1.poly\n",
    "    -rw------- xxx/yyy  854 2009-07-01 17:20 2.poly\n",
    "    [nightingale]:~/temp>\n",
    "\n",
    "\n",
    "If you want to get more descriptive names for your polymake files then you have to set a name for each polytope first.\n",
    "\n",
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "$a[0]->name = \"my_cube\";\n",
    "$a[1]->name = \"my_simplex\";\n",
    "pack_tarball(\"simple_polytopes.tgz\",@a);"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "\n",
    "sets the names of the files in the tarball to `my_cube.poly` and `my_simplex.poly`:\n",
    "\n",
    "    \n",
    "    [nightingale]:~/temp>tar tvfz simple_polytopes.tgz \n",
    "    -rw------- xxx/yyy  952 2009-07-01 17:21 my_cube.poly\n",
    "    -rw------- xxx/yyy  650 2009-07-01 17:21 my_simplex.poly\n",
    "    [nightingale]:~/temp>\n",
    "\n",
    "\n",
    "## Restoring the array\n",
    "\n",
    "You can restore your saved array by using the function `unpack_tarball`:\n",
    "\n",
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "my_cube\n",
       "\n"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "@a=unpack_tarball(\"simple_polytopes.tgz\");\n",
    "print $a[0]->name;"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "If you just want a specific polytope from your tarball, then you can supply its name in the command:\n",
    "\n",
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "my_simplex\n",
       "\n"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "@a=unpack_tarball(\"simple_polytopes.tgz\",\"my_simplex.poly\");\n",
    "print $a[0]->name;"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "You may supply more than one filename. However, wildcards are not supported. Note that changes in the files are not automatically stored in the archive, you have to call `pack_tarball` to update the files. \n",
    "\n",
    "## Packing archives outside polymake\n",
    "\n",
    "You can of course apply `tar` to your favorite family of polymake files to create a tarball without using polymake. It can be read by polymake as long as the files are at the root of the archive (i.e. don't pack a whole directory tree). The archive also may not contain non-polymake files. \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
}