/usr/share/doc/maxima-doc/html/maxima_68.html is in maxima-doc 5.32.1-1.
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 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
<html>
<!-- Created on January, 10 2014 by texi2html 1.76 -->
<!--
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
Karl Berry <karl@freefriends.org>
Olaf Bachmann <obachman@mathematik.uni-kl.de>
and many others.
Maintained by: Many creative people <dev@texi2html.cvshome.org>
Send bugs and suggestions to <users@texi2html.cvshome.org>
-->
<head>
<title>Maxima 5.32.1 Manual: 68. numericalio</title>
<meta name="description" content="Maxima 5.32.1 Manual: 68. numericalio">
<meta name="keywords" content="Maxima 5.32.1 Manual: 68. numericalio">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="texi2html 1.76">
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
pre.display {font-family: serif}
pre.format {font-family: serif}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: serif; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: serif; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.sansserif {font-family:sans-serif; font-weight:normal;}
ul.toc {list-style: none}
body
{
color: black;
background: white;
margin-left: 8%;
margin-right: 13%;
}
h1
{
margin-left: +8%;
font-size: 150%;
font-family: sans-serif
}
h2
{
font-size: 125%;
font-family: sans-serif
}
h3
{
font-size: 100%;
font-family: sans-serif
}
h2,h3,h4,h5,h6 { margin-left: +4%; }
div.textbox
{
border: solid;
border-width: thin;
/* width: 100%; */
padding-top: 1em;
padding-bottom: 1em;
padding-left: 2em;
padding-right: 2em
}
div.titlebox
{
border: none;
padding-top: 1em;
padding-bottom: 1em;
padding-left: 2em;
padding-right: 2em;
background: rgb(200,255,255);
font-family: sans-serif
}
div.synopsisbox
{
border: none;
padding-top: 1em;
padding-bottom: 1em;
padding-left: 2em;
padding-right: 2em;
background: rgb(255,220,255);
/*background: rgb(200,255,255); */
/* font-family: fixed */
}
pre.example
{
border: 1px solid gray;
padding-top: 1em;
padding-bottom: 1em;
padding-left: 1em;
padding-right: 1em;
/* background: rgb(247,242,180); */ /* kind of sandy */
/* background: rgb(200,255,255); */ /* sky blue */
background-color: #F1F5F9; /* light blue-gray */
/* font-family: "Lucida Console", monospace */
}
div.spacerbox
{
border: none;
padding-top: 2em;
padding-bottom: 2em
}
div.image
{
margin: 0;
padding: 1em;
text-align: center;
}
div.categorybox
{
border: 1px solid gray;
padding-top: 0px;
padding-bottom: 0px;
padding-left: 1em;
padding-right: 1em;
background: rgb(247,242,220);
}
-->
</style>
<link rel="icon" href="http://maxima.sourceforge.net/favicon.ico"/>
</head>
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="numericalio"></a>
<a name="SEC318"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="maxima_67.html#SEC317" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#SEC319" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maxima_67.html#SEC315" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_69.html#SEC326" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_82.html#SEC380" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h1 class="chapter"> 68. numericalio </h1>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#SEC319">68.1 Introduction to numericalio</a></td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#SEC324">68.2 Functions and Variables for plain-text input and output</a></td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#SEC325">68.3 Functions and Variables for binary input and output</a></td><td> </td><td align="left" valign="top">
</td></tr>
</table>
<p><a name="Item_003a-Introduction-to-numericalio"></a>
</p><hr size="6">
<a name="Introduction-to-numericalio"></a>
<a name="SEC319"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC318" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#SEC320" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#SEC318" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#SEC318" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_69.html#SEC326" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_82.html#SEC380" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h2 class="section"> 68.1 Introduction to numericalio </h2>
<p><code>numericalio</code> is a collection of functions to read and write files and streams.
Functions for plain-text input and output
can read and write numbers (integer, float, or bigfloat), symbols, and strings.
Functions for binary input and output
can read and write only floating-point numbers.
</p>
<p>If there already exists a list, matrix, or array object to store input data,
<code>numericalio</code> input functions can write data into that object.
Otherwise, <code>numericalio</code> can guess, to some degree, the structure of an object
to store the data, and return that object.
</p>
<div class=categorybox>
·
<p>@ref{Category: File input} ·
@ref{Category: File output} ·
@ref{Category: Share packages} ·
@ref{Category: Package numericalio}
</div>
</p>
<hr size="6">
<a name="SEC320"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC319" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#SEC321" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#SEC318" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#SEC319" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_69.html#SEC326" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_82.html#SEC380" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h3 class="subsection"> 68.1.1 Plain-text input and output </h3>
<p>In plain-text input and output,
it is assumed that each item to read or write is an atom:
an integer, float, bigfloat, string, or symbol,
and not a rational or complex number or any other kind of nonatomic expression.
The <code>numericalio</code> functions may attempt to do something sensible faced with nonatomic expressions,
but the results are not specified here and subject to change.
</p>
<p>Atoms in both input and output files have the same format as
in Maxima batch files or the interactive console.
In particular, strings are enclosed in double quotes,
backslash <code>\</code> prevents any special interpretation of the next character,
and the question mark <code>?</code> is recognized at the beginning of a symbol
to mean a Lisp symbol (as opposed to a Maxima symbol).
No continuation character (to join broken lines) is recognized.
</p>
<hr size="6">
<a name="SEC321"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC320" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#SEC322" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#SEC318" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#SEC319" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_69.html#SEC326" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_82.html#SEC380" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h3 class="subsection"> 68.1.2 Separator flag values for input </h3>
<p>The functions for plain-text input and output take an optional argument,
<var>separator_flag</var>, that tells what character separates data.
</p>
<p>For plain-text input, these values of <var>separator_flag</var> are recognized:
<code>comma</code> for comma separated values,
<code>pipe</code> for values separated by the vertical bar character <code>|</code>,
<code>semicolon</code> for values separated by semicolon <code>;</code>,
and <code>space</code> for values separated by space or tab characters.
If the file name ends in <code>.csv</code> and <var>separator_flag</var> is not specified,
<code>comma</code> is assumed.
If the file name ends in something other than <code>.csv</code> and <code>separator_flag</code> is not specified,
<code>space</code> is assumed.
</p>
<p>In plain-text input, multiple successive space and tab characters count as a single separator.
However, multiple comma, pipe, or semicolon characters are significant.
Successive comma, pipe, or semicolon characters (with or without intervening spaces or tabs)
are considered to have <code>false</code> between the separators.
For example, <code>1234,,Foo</code> is treated the same as <code>1234,false,Foo</code>.
</p>
<hr size="6">
<a name="SEC322"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC321" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#SEC323" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#SEC318" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#SEC319" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_69.html#SEC326" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_82.html#SEC380" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h3 class="subsection"> 68.1.3 Separator flag values for output </h3>
<p>For plain-text output, <code>tab</code>, for values separated by the tab character,
is recognized as a value of <var>separator_flag</var>,
as well as <code>comma</code>, <code>pipe</code>, <code>semicolon</code>, and <code>space</code>.
</p>
<p>In plain-text output, <code>false</code> atoms are written as such;
a list <code>[1234, false, Foo]</code> is written <code>1234,false,Foo</code>,
and there is no attempt to collapse the output to <code>1234,,Foo</code>.
</p>
<hr size="6">
<a name="SEC323"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC322" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#SEC324" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#SEC318" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#SEC319" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_69.html#SEC326" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_82.html#SEC380" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h3 class="subsection"> 68.1.4 Binary floating-point input and output </h3>
<p><code>numericalio</code> functions can read and write 8-byte IEEE 754 floating-point numbers.
These numbers can be stored either least significant byte first or most significant byte first,
according to the global flag set by <code>assume_external_byte_order</code>.
If not specified, <code>numericalio</code> assumes the external byte order is most-significant byte first.
</p>
<p>Other kinds of numbers are coerced to 8-byte floats;
<code>numericalio</code> cannot read or write binary non-numeric data.
</p>
<p>Some Lisp implementations do not recognize IEEE 754 special values
(positive and negative infinity, not-a-number values, denormalized values).
The effect of reading such values with <code>numericalio</code> is undefined.
</p>
<p><code>numericalio</code> includes functions to open a stream for reading or writing a stream of bytes.
</p>
<p><a name="Item_003a-Functions-and-Variables-for-plain_002dtext-input-and-output"></a>
</p><hr size="6">
<a name="Functions-and-Variables-for-plain_002dtext-input-and-output"></a>
<a name="SEC324"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC323" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#SEC325" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#SEC318" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#SEC318" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_69.html#SEC326" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_82.html#SEC380" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h2 class="section"> 68.2 Functions and Variables for plain-text input and output </h2>
<p><a name="Item_003a-read_005fmatrix"></a>
</p><dl>
<dt><u>Function:</u> <b>read_matrix</b><i> (<var>S</var>)</i>
<a name="IDX2573"></a>
</dt>
<dt><u>Function:</u> <b>read_matrix</b><i> (<var>S</var>, <var>M</var>)</i>
<a name="IDX2574"></a>
</dt>
<dt><u>Function:</u> <b>read_matrix</b><i> (<var>S</var>, <var>separator_flag</var>)</i>
<a name="IDX2575"></a>
</dt>
<dt><u>Function:</u> <b>read_matrix</b><i> (<var>S</var>, <var>M</var>, <var>separator_flag</var>)</i>
<a name="IDX2576"></a>
</dt>
<dd><p><code>read_matrix(<var>S</var>)</code> reads the source <var>S</var> and returns its entire content as a matrix.
The size of the matrix is inferred from the input data;
each line of the file becomes one row of the matrix.
If some lines have different lengths, <code>read_matrix</code> complains.
</p>
<p><code>read_matrix(<var>S</var>, <var>M</var>)</code> read the source <var>S</var> into the matrix <var>M</var>,
until <var>M</var> is full or the source is exhausted.
Input data are read into the matrix in row-major order;
the input need not have the same number of rows and columns as <var>M</var>.
</p>
<p>The source <var>S</var> may be a file name or a stream.
</p>
<p>The recognized values of <var>separator_flag</var> are
<code>comma</code>, <code>pipe</code>, <code>semicolon</code>, and <code>space</code>.
If <var>separator_flag</var> is not specified, the file is assumed space-delimited.
</p>
<div class=categorybox>
·
<p>@ref{Category: Package numericalio} ·
@ref{Category: File input}
</div>
</p>
</dd></dl>
<p><a name="Item_003a-read_005farray"></a>
</p><dl>
<dt><u>Function:</u> <b>read_array</b><i> (<var>S</var>, <var>A</var>)</i>
<a name="IDX2577"></a>
</dt>
<dt><u>Function:</u> <b>read_array</b><i> (<var>S</var>, <var>A</var>, <var>separator_flag</var>)</i>
<a name="IDX2578"></a>
</dt>
<dd><p>Reads the source <var>S</var> into the array <var>A</var>,
until <var>A</var> is full or the source is exhausted.
Input data are read into the array in row-major order;
the input need not conform to the dimensions of <var>A</var>.
</p>
<p>The source <var>S</var> may be a file name or a stream.
</p>
<p>The recognized values of <var>separator_flag</var> are
<code>comma</code>, <code>pipe</code>, <code>semicolon</code>, and <code>space</code>.
If <var>separator_flag</var> is not specified, the file is assumed space-delimited.
</p>
<div class=categorybox>
·
<p>@ref{Category: Package numericalio} ·
@ref{Category: File input}
</div>
</p>
</dd></dl>
<p><a name="Item_003a-read_005fhashed_005farray"></a>
</p><dl>
<dt><u>Function:</u> <b>read_hashed_array</b><i> (<var>S</var>, <var>A</var>)</i>
<a name="IDX2579"></a>
</dt>
<dt><u>Function:</u> <b>read_hashed_array</b><i> (<var>S</var>, <var>A</var>, <var>separator_flag</var>)</i>
<a name="IDX2580"></a>
</dt>
<dd><p>Reads the source <var>S</var> and returns its entire content as a hashed array.
The source <var>S</var> may be a file name or a stream.
</p>
<p><code>read_hashed_array</code> treats the first item on each line as a hash key,
and associates the remainder of the line (as a list) with the key.
For example,
the line <code>567 12 17 32 55</code> is equivalent to <code>A[567]: [12, 17, 32, 55]$</code>.
Lines need not have the same numbers of elements.
</p>
<p>The recognized values of <var>separator_flag</var> are
<code>comma</code>, <code>pipe</code>, <code>semicolon</code>, and <code>space</code>.
If <var>separator_flag</var> is not specified, the file is assumed space-delimited.
</p>
<div class=categorybox>
·
<p>@ref{Category: Package numericalio} ·
@ref{Category: File input}
</div>
</p>
</dd></dl>
<p><a name="Item_003a-read_005fnested_005flist"></a>
</p><dl>
<dt><u>Function:</u> <b>read_nested_list</b><i> (<var>S</var>)</i>
<a name="IDX2581"></a>
</dt>
<dt><u>Function:</u> <b>read_nested_list</b><i> (<var>S</var>, <var>separator_flag</var>)</i>
<a name="IDX2582"></a>
</dt>
<dd><p>Reads the source <var>S</var> and returns its entire content as a nested list.
The source <var>S</var> may be a file name or a stream.
</p>
<p><code>read_nested_list</code> returns a list which has a sublist for each
line of input. Lines need not have the same numbers of elements.
Empty lines are <i>not</i> ignored: an empty line yields an empty sublist.
</p>
<p>The recognized values of <var>separator_flag</var> are
<code>comma</code>, <code>pipe</code>, <code>semicolon</code>, and <code>space</code>.
If <var>separator_flag</var> is not specified, the file is assumed space-delimited.
</p>
<div class=categorybox>
·
<p>@ref{Category: Package numericalio} ·
@ref{Category: File input}
</div>
</p>
</dd></dl>
<p><a name="Item_003a-read_005flist"></a>
</p><dl>
<dt><u>Function:</u> <b>read_list</b><i> (<var>S</var>)</i>
<a name="IDX2583"></a>
</dt>
<dt><u>Function:</u> <b>read_list</b><i> (<var>S</var>, <var>L</var>)</i>
<a name="IDX2584"></a>
</dt>
<dt><u>Function:</u> <b>read_list</b><i> (<var>S</var>, <var>separator_flag</var>)</i>
<a name="IDX2585"></a>
</dt>
<dt><u>Function:</u> <b>read_list</b><i> (<var>S</var>, <var>L</var>, <var>separator_flag</var>)</i>
<a name="IDX2586"></a>
</dt>
<dd><p><code>read_list(<var>S</var>)</code> reads the source <var>S</var> and returns its entire content as a flat list.
</p>
<p><code>read_list(<var>S</var>, <var>L</var>)</code> reads the source <var>S</var> into the list <var>L</var>,
until <var>L</var> is full or the source is exhausted.
</p>
<p>The source <var>S</var> may be a file name or a stream.
</p>
<p>The recognized values of <var>separator_flag</var> are
<code>comma</code>, <code>pipe</code>, <code>semicolon</code>, and <code>space</code>.
If <var>separator_flag</var> is not specified, the file is assumed space-delimited.
</p>
<div class=categorybox>
·
<p>@ref{Category: Package numericalio} ·
@ref{Category: File input}
</div>
</p>
</dd></dl>
<p><a name="Item_003a-write_005fdata"></a>
</p><dl>
<dt><u>Function:</u> <b>write_data</b><i> (<var>X</var>, <var>D</var>)</i>
<a name="IDX2587"></a>
</dt>
<dt><u>Function:</u> <b>write_data</b><i> (<var>X</var>, <var>D</var>, <var>separator_flag</var>)</i>
<a name="IDX2588"></a>
</dt>
<dd><p>Writes the object <var>X</var> to the destination <var>D</var>.
</p>
<p><code>write_data</code> writes a matrix in row-major order,
with one line per row.
</p>
<p><code>write_data</code> writes an array created by <code>array</code> or <code>make_array</code>
in row-major order, with a new line at the end of every slab.
Higher-dimensional slabs are separated by additional new lines.
</p>
<p><code>write_data</code> writes a hashed array with each key followed by
its associated list on one line.
</p>
<p><code>write_data</code> writes a nested list with each sublist on one line.
</p>
<p><code>write_data</code> writes a flat list all on one line.
</p>
<p>The destination <var>D</var> may be a file name or a stream.
When the destination is a file name,
the global variable <code>file_output_append</code> governs
whether the output file is appended or truncated.
When the destination is a stream,
no special action is taken by <code>write_data</code> after all the data are written;
in particular, the stream remains open.
</p>
<p>The recognized values of <var>separator_flag</var> are
<code>comma</code>, <code>pipe</code>, <code>semicolon</code>, <code>space</code>, and <code>tab</code>.
If <var>separator_flag</var> is not specified, the file is assumed space-delimited.
</p>
<div class=categorybox>
·
<p>@ref{Category: Package numericalio} ·
@ref{Category: File output}
</div>
</p>
</dd></dl>
<p><a name="Item_003a-Functions-and-Variables-for-binary-input-and-output"></a>
</p><hr size="6">
<a name="Functions-and-Variables-for-binary-input-and-output"></a>
<a name="SEC325"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC324" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="maxima_69.html#SEC326" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#SEC318" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#SEC318" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_69.html#SEC326" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_82.html#SEC380" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h2 class="section"> 68.3 Functions and Variables for binary input and output </h2>
<p><a name="Item_003a-assume_005fexternal_005fbyte_005forder"></a>
</p><dl>
<dt><u>Function:</u> <b>assume_external_byte_order</b><i> (<var>byte_order_flag</var>)</i>
<a name="IDX2589"></a>
</dt>
<dd><p>Tells <code>numericalio</code> the byte order for reading and writing binary data.
Two values of <var>byte_order_flag</var> are recognized:
<code>lsb</code> which indicates least-significant byte first, also called little-endian byte order;
and <code>msb</code> which indicates most-significant byte first, also called big-endian byte order.
</p>
<p>If not specified, <code>numericalio</code> assumes the external byte order is most-significant byte first.
</p>
<div class=categorybox>
·
<p>@ref{Category: Package numericalio}
</div>
</p></dd></dl>
<p><a name="Item_003a-openr_005fbinary"></a>
</p><dl>
<dt><u>Function:</u> <b>openr_binary</b><i> (<var>file_name</var>)</i>
<a name="IDX2590"></a>
</dt>
<dd><p>Returns an input stream of 8-bit unsigned bytes to read the file named by <var>file_name</var>.
</p>
<div class=categorybox>
·
<p>@ref{Category: Package numericalio} ·
@ref{Category: File input}
</div>
</p></dd></dl>
<p><a name="Item_003a-openw_005fbinary"></a>
</p><dl>
<dt><u>Function:</u> <b>openw_binary</b><i> (<var>file_name</var>)</i>
<a name="IDX2591"></a>
</dt>
<dd><p>Returns an output stream of 8-bit unsigned bytes to write the file named by <var>file_name</var>.
</p>
<div class=categorybox>
·
<p>@ref{Category: Package numericalio} ·
@ref{Category: File output}
</div>
</p></dd></dl>
<p><a name="Item_003a-opena_005fbinary"></a>
</p><dl>
<dt><u>Function:</u> <b>opena_binary</b><i> (<var>file_name</var>)</i>
<a name="IDX2592"></a>
</dt>
<dd><p>Returns an output stream of 8-bit unsigned bytes to append the file named by <var>file_name</var>.
</p>
<div class=categorybox>
·
<p>@ref{Category: Package numericalio} ·
@ref{Category: File output}
</div>
</p></dd></dl>
<p><a name="Item_003a-read_005fbinary_005fmatrix"></a>
</p><dl>
<dt><u>Function:</u> <b>read_binary_matrix</b><i> (<var>S</var>, <var>M</var>)</i>
<a name="IDX2593"></a>
</dt>
<dd><p>Reads binary 8-byte floating point numbers from the source <var>S</var> into the matrix <var>M</var>
until <var>M</var> is full, or the source is exhausted.
Elements of <var>M</var> are read in row-major order.
</p>
<p>The source <var>S</var> may be a file name or a stream.
</p>
<p>The byte order in elements of the source is specified by <code>assume_external_byte_order</code>.
</p>
<div class=categorybox>
·
<p>@ref{Category: Package numericalio} ·
@ref{Category: File input}
</div>
</p></dd></dl>
<p><a name="Item_003a-read_005fbinary_005farray"></a>
</p><dl>
<dt><u>Function:</u> <b>read_binary_array</b><i> (<var>S</var>, <var>A</var>)</i>
<a name="IDX2594"></a>
</dt>
<dd><p>Reads binary 8-byte floating point numbers from the source <var>S</var> into the array <var>A</var>
until <var>A</var> is full, or the source is exhausted.
<var>A</var> must be an array created by <code>array</code> or <code>make_array</code>.
Elements of <var>A</var> are read in row-major order.
</p>
<p>The source <var>S</var> may be a file name or a stream.
</p>
<p>The byte order in elements of the source is specified by <code>assume_external_byte_order</code>.
</p>
<div class=categorybox>
·
<p>@ref{Category: Package numericalio} ·
@ref{Category: File input}
</div>
</p></dd></dl>
<p><a name="Item_003a-read_005fbinary_005flist"></a>
</p><dl>
<dt><u>Function:</u> <b>read_binary_list</b><i> (<var>S</var>)</i>
<a name="IDX2595"></a>
</dt>
<dt><u>Function:</u> <b>read_binary_list</b><i> (<var>S</var>, <var>L</var>)</i>
<a name="IDX2596"></a>
</dt>
<dd><p><code>read_binary_list(<var>S</var>)</code> reads the entire content of the source <var>S</var>
as a sequence of binary 8-byte floating point numbers, and returns it as a list.
The source <var>S</var> may be a file name or a stream.
</p>
<p><code>read_binary_list(<var>S</var>, <var>L</var>)</code> reads 8-byte binary floating point numbers
from the source <var>S</var> until the list <var>L</var> is full, or the source is exhausted.
</p>
<p>The byte order in elements of the source is specified by <code>assume_external_byte_order</code>.
</p>
<div class=categorybox>
·
<p>@ref{Category: Package numericalio} ·
@ref{Category: File input}
</div>
</p></dd></dl>
<p><a name="Item_003a-write_005fbinary_005fdata"></a>
</p><dl>
<dt><u>Function:</u> <b>write_binary_data</b><i> (<var>X</var>, <var>D</var>)</i>
<a name="IDX2597"></a>
</dt>
<dd><p>Writes the object <var>X</var>, comprising binary 8-byte IEEE 754 floating-point numbers,
to the destination <var>D</var>.
Other kinds of numbers are coerced to 8-byte floats.
<code>write_binary_data</code> cannot write non-numeric data.
</p>
<p>The object <var>X</var> may be a list, a nested list, a matrix,
or an array created by <code>array</code> or <code>make_array</code>;
<var>X</var> cannot be an undeclared array or any other type of object.
<code>write_binary_data</code> writes nested lists, matrices, and arrays in row-major order.
</p>
<p>The destination <var>D</var> may be a file name or a stream.
When the destination is a file name,
the global variable <code>file_output_append</code> governs
whether the output file is appended or truncated.
When the destination is a stream,
no special action is taken by <code>write_binary_data</code> after all the data are written;
in particular, the stream remains open.
</p>
<p>The byte order in elements of the destination
is specified by <code>assume_external_byte_order</code>.
</p>
<div class=categorybox>
·
<p>@ref{Category: Package numericalio} ·
@ref{Category: File output}
</div>
</p></dd></dl>
<hr size="6">
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC318" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="maxima_69.html#SEC326" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_82.html#SEC380" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<p>
<font size="-1">
This document was generated by <em>root</em> on <em>January, 10 2014</em> using <a href="http://texi2html.cvshome.org/"><em>texi2html 1.76</em></a>.
</font>
<br>
</p>
</body>
</html>
|