arrays-io.texi | arrays-io.texi | |||
---|---|---|---|---|
@node Array I/O | @node Array I/O, Array storage, Array globals, Arrays | |||
@section Inputting and Outputting Arrays | @section Inputting and Outputting Arrays | |||
@subsection Output formatting | @subsection Output formatting | |||
@cindex persistence | @cindex persistence | |||
@cindex Array persistence | @cindex Array persistence | |||
@cindex output formatting | @cindex output formatting | |||
@cindex Array output formatting | @cindex Array output formatting | |||
@cindex saving arrays | @cindex saving arrays | |||
@cindex writing arrays to output streams | @cindex writing arrays to output streams | |||
skipping to change at line 37 | skipping to change at line 37 | |||
@end smallexample | @end smallexample | |||
@subsection Inputting arrays | @subsection Inputting arrays | |||
@cindex inputting arrays from an input stream | @cindex inputting arrays from an input stream | |||
@cindex Array inputting from istream | @cindex Array inputting from istream | |||
@cindex restoring arrays from an input stream | @cindex restoring arrays from an input stream | |||
@cindex Array restoring from istream | @cindex Array restoring from istream | |||
Arrays may be restored from an istream using the @code{>>} operator. | Arrays may be restored from an istream using the @code{>>} operator. | |||
@strong{Note:} you must know the dimensionality of the array being restored | ||||
@strong{Caution:} you must know the dimensionality of the array being resto | ||||
red | ||||
from the stream. The @code{>>} operator expects an array in the same input | from the stream. The @code{>>} operator expects an array in the same input | |||
format as generated by the @code{<<} operator, namely: | format as generated by the @code{<<} operator, namely: | |||
@cindex Array persistence format | @cindex Array persistence format | |||
@itemize @bullet | @itemize @bullet | |||
@item The size of the array, for example ``32'' for a 1-dimensional array of | @item The size of the array, for example ``32'' for a 1-dimensional array of | |||
32 elements, ``12 x 64 x 128'' for a 3-dimensional array of size 12x64x128. | 32 elements, ``12 x 64 x 128'' for a 3-dimensional array of size 12x64x128. | |||
skipping to change at line 70 | skipping to change at line 71 | |||
istream& operator>>(istream&, Array<T,N>&); | istream& operator>>(istream&, Array<T,N>&); | |||
@end example | @end example | |||
Here is an example of saving and restoring arrays from files. You can find | Here is an example of saving and restoring arrays from files. You can find | |||
this example in the Blitz++ distribution as @file{examples/io.cpp}. | this example in the Blitz++ distribution as @file{examples/io.cpp}. | |||
@smallexample | @smallexample | |||
@include examples/io.texi | @include examples/io.texi | |||
@end smallexample | @end smallexample | |||
@strong{Note:} The storage order and starting indices are not restored from | @strong{Caution:} The storage order and starting indices are not restored f rom | |||
the input stream. If you are restoring (for example) a Fortran-style array , | the input stream. If you are restoring (for example) a Fortran-style array , | |||
you must create a Fortran-style array, and then restore it. For example, | you must create a Fortran-style array, and then restore it. For example, | |||
this code restores a Fortran-style array from the standard input stream: | this code restores a Fortran-style array from the standard input stream: | |||
@example | @example | |||
Array<float,2> B(fortranArray); | Array<float,2> B(fortranArray); | |||
cin >> B; | cin >> B; | |||
@end example | @end example | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 5 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |