/usr/share/doc/libblitz-doc/examples/io.cpp is in libblitz-doc 1:0.10-3.2.
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 | #include <blitz/array.h>
#ifdef BZ_HAVE_STD
#include <fstream>
#else
#include <fstream.h>
#endif
BZ_USING_NAMESPACE(blitz)
const char* filename = "io.data";
void write_arrays()
{
ofstream ofs(filename);
if (ofs.bad())
{
cerr << "Unable to write to file: " << filename << endl;
exit(1);
}
Array<float,3> A(3,4,5);
A = 111 + tensor::i + 10 * tensor::j + 100 * tensor::k;
ofs << A << endl;
Array<float,2> B(3,4);
B = 11 + tensor::i + 10 * tensor::j;
ofs << B << endl;
Array<float,1> C(4);
C = 1 + tensor::i;
ofs << C << endl;
}
int main()
{
write_arrays();
ifstream ifs(filename);
if (ifs.bad())
{
cerr << "Unable to open file: " << filename << endl;
exit(1);
}
Array<float,3> A;
Array<float,2> B;
Array<float,1> C;
ifs >> A >> B >> C;
cout << "Arrays restored from file: " << endl << A << B << C << endl;
return 0;
}
|