Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
tutorial:data [2012/08/07 14:43] – [Handling polymake objects] paffenholz | user_guide:data [2019/01/25 09:27] – ↷ Links adapted because of a move operation oroehrig | ||
---|---|---|---|
Line 4: | Line 4: | ||
===== Handling polymake objects ===== | ===== Handling polymake objects ===== | ||
+ | Let us take this nice example object: | ||
+ | > $p = cube(3); | ||
+ | To store polymake objects use the command | ||
+ | > save($p," | ||
+ | This silently overwrites existing files. | ||
+ | | ||
polymake objects that are stored in polymake' | polymake objects that are stored in polymake' | ||
- | $p=load(" | + | |
- | If you did not start '' | + | If you did not start '' |
$p=load(" | $p=load(" | ||
- | To store polymake objects use the command | + | TAB completion like in a usual UNIX shell supports you in navigating through |
- | save($p," | + | |
**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 | **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 | ||
- | $p-> | + | |
- | called prior to leaving the session (but after the last compuation | + | called prior to leaving the session (but after the last computation |
===== Handling complex data types ===== | ===== Handling complex data types ===== | ||
- | It is also possible to store complex | + | Apart from the full objects, you can also persistently |
- | $s=new Set< | + | |
- | save_data($s," | + | |
+ | The description text is optional; it can be an arbitrary text, even stretching over several lines. | ||
To load such files just type | To load such files just type | ||
- | $s=load_data(" | + | |
+ | ===== Saving visualized objects ===== | ||
+ | Furthermore, | ||
+ | |||
+ | To save the cube visualized via JReality in a new file called '' | ||
+ | < | ||
+ | To save the cube as a TiKz file named '' | ||
+ | < | ||
===== Handling arbitrary files ===== | ===== Handling arbitrary files ===== | ||
Line 33: | Line 49: | ||
1 0 1 1 | 1 0 1 1 | ||
1 1 1 1 | 1 1 1 1 | ||
+ | For the sake of the example, let's create this file: | ||
+ | > open(my $f, '> points.txt' | ||
To read this file try the following: | To read this file try the following: | ||
- | open(INPUT, "< points.txt" | + | |
- | while(< | + | |
- | print $_; | + | > |
- | } | + | |
- | close(INPUT); | + | |
''< | ''< | ||
- | open(INPUT, "< points.txt" | + | |
- | $matrix=new Matrix< | + | |
- | close(INPUT); | + | |