56 it_error(
"it_ifile::open(): Corrupt file (not an it_file)");
80 if (h.
type !=
"" && h.
name == name) {
97 for (
int i = 0; i <= n; i++) {
112 std::string &desc, uint64_t &bytes)
129 s.
read(reinterpret_cast<char *>(&h),
sizeof(h));
159 x = (tmp == 0) ?
false :
true;
196 float x_real, x_imag;
199 x = std::complex<float>(x_real, x_imag);
204 double x_real, x_imag;
207 x = std::complex<double>(x_real, x_imag);
215 v.set_size(static_cast<int>(size),
false);
216 for (
int i = 0; i < v.size(); ++i) {
227 v.set_size(static_cast<int>(size),
false);
228 for (
int i = 0; i < v.size(); ++i) {
239 v.set_size(static_cast<int>(size),
false);
240 for (
int i = 0; i < v.size(); ++i) {
251 v.set_size(static_cast<int>(size),
false);
252 for (
int i = 0; i < v.size(); ++i) {
254 v(i) =
static_cast<double>(val);
262 v.set_size(static_cast<int>(size),
false);
263 for (
int i = 0; i < v.size(); ++i)
270 float val_real, val_imag;
272 v.set_size(static_cast<int>(size),
false);
273 for (
int i = 0; i < v.size(); ++i) {
276 v(i) = std::complex<double>(val_real, val_imag);
283 double val_real, val_imag;
285 v.set_size(static_cast<int>(size),
false);
286 for (
int i = 0; i < v.size(); ++i) {
289 v(i) = std::complex<double>(val_real, val_imag);
297 std::string::size_type size2 =
static_cast<std::string::size_type
>(
size);
299 for (std::string::size_type i = 0; i < size2; ++i)
308 m.set_size(static_cast<int>(i), static_cast<int>(j),
false);
309 for (
int j = 0; j < m.cols(); ++j) {
310 for (
int i = 0; i < m.rows(); ++i) {
322 m.set_size(static_cast<int>(i), static_cast<int>(j),
false);
323 for (
int j = 0; j < m.cols(); ++j)
324 for (
int i = 0; i < m.rows(); ++i) {
335 m.set_size(static_cast<int>(i), static_cast<int>(j),
false);
336 for (
int j = 0; j < m.cols(); ++j)
337 for (
int i = 0; i < m.rows(); ++i) {
348 m.set_size(static_cast<int>(i), static_cast<int>(j),
false);
349 for (
int j = 0; j < m.cols(); ++j)
350 for (
int i = 0; i < m.rows(); ++i) {
352 m(i, j) =
static_cast<double>(val);
360 m.set_size(static_cast<int>(i), static_cast<int>(j),
false);
361 for (
int j = 0; j < m.cols(); ++j)
362 for (
int i = 0; i < m.rows(); ++i)
369 float val_real, val_imag;
371 m.set_size(static_cast<int>(i), static_cast<int>(j),
false);
372 for (
int j = 0; j < m.cols(); ++j)
373 for (
int i = 0; i < m.rows(); ++i) {
376 m(i, j) = std::complex<double>(val_real, val_imag);
383 double val_real, val_imag;
385 m.set_size(static_cast<int>(i), static_cast<int>(j),
false);
386 for (
int j = 0; j < m.cols(); ++j)
387 for (
int i = 0; i < m.rows(); ++i) {
390 m(i, j) = std::complex<double>(val_real, val_imag);
399 v.
set_size(static_cast<int>(size),
false);
400 for (
int i = 0; i < v.
size(); ++i) {
411 v.
set_size(static_cast<int>(size),
false);
412 for (
int i = 0; i < v.
size(); ++i) {
423 v.
set_size(static_cast<int>(size),
false);
424 for (
int i = 0; i < v.
size(); ++i) {
434 v.
set_size(static_cast<int>(size),
false);
435 for (
int i = 0; i < v.
size(); ++i)
444 v.
set_size(static_cast<int>(size),
false);
445 for (
int i = 0; i < v.
size(); ++i) {
447 v(i) =
static_cast<double>(val);
455 v.
set_size(static_cast<int>(size),
false);
456 for (
int i = 0; i < v.
size(); ++i)
463 float val_real, val_imag;
465 v.set_size(static_cast<int>(size),
false);
466 for (
int i = 0; i < v.size(); ++i) {
469 v(i) = std::complex<float>(val_real, val_imag);
476 float val_real, val_imag;
478 v.set_size(static_cast<int>(size),
false);
479 for (
int i = 0; i < v.size(); ++i) {
482 v(i) = std::complex<double>(val_real, val_imag);
489 double val_real, val_imag;
491 v.set_size(static_cast<int>(size),
false);
492 for (
int i = 0; i < v.size(); ++i) {
495 v(i) = std::complex<double>(val_real, val_imag);
507 low_prec(false), _strings(new Strings_Holder)
517 s.
open(name, trunc, bfstream_base::l_endian);
524 it_error(
"it_file::open(): Corrupt file (not an it_file)");
549 "write without a name");
556 const std::string &name, uint64_t
size,
557 const std::string &desc)
562 h1.
hdr_bytes = 3 *
sizeof(uint64_t) + type.size() + 1 + name.size() + 1
579 std::streampos p =
s.
tellp();
586 s.
seekp(0, std::ios::end);
590 std::streamoff skip =
static_cast<std::streamoff
>(h2.
block_bytes);
637 h.
hdr_bytes = 3 *
sizeof(uint64_t) + 1 + 1 + 1;
654 s.
seekg(0, std::ios::end);
655 std::streampos p =
s.
tellg();
656 s.
seekg(0, std::ios::beg);
660 char* buffer =
new char[int(p)];
661 char* b_ptr = buffer;
688 s.
open(fname(),
true, bfstream_base::l_endian);
690 for (uint64_t i = 0; i <
size; ++i)
728 s << static_cast<char>(x);
738 s << static_cast<int16_t>(x);
743 s << static_cast<int32_t>(x);
770 s << static_cast<uint64_t>(v.size());
771 for (
int i = 0; i < v.size(); ++i)
777 s << static_cast<uint64_t>(v.size());
778 for (
int i = 0; i < v.size(); ++i)
779 s << static_cast<int16_t>(v(i));
784 s << static_cast<uint64_t>(v.size());
785 for (
int i = 0; i < v.size(); ++i)
786 s << static_cast<int32_t>(v(i));
791 s << static_cast<uint64_t>(v.size());
793 for (
int i = 0; i < v.size(); ++i)
794 s << static_cast<float>(v(i));
797 for (
int i = 0; i < v.size(); ++i)
804 s << static_cast<uint64_t>(v.size());
806 for (
int i = 0; i < v.size(); ++i) {
807 s << static_cast<float>(v(i).real());
808 s << static_cast<float>(v(i).imag());
812 for (
int i = 0; i < v.size(); ++i) {
821 s << static_cast<uint64_t>(str.size());
822 for (std::string::size_type i = 0; i < str.size(); ++i)
828 s << static_cast<uint64_t>(m.rows())
829 << static_cast<uint64_t>(m.cols());
830 for (
int j = 0; j < m.cols(); ++j)
831 for (
int i = 0; i < m.rows(); ++i)
832 s << m(i, j).value();
837 s << static_cast<uint64_t>(m.rows())
838 << static_cast<uint64_t>(m.cols());
839 for (
int j = 0; j < m.cols(); ++j)
840 for (
int i = 0; i < m.rows(); ++i)
841 s << static_cast<int16_t>(m(i, j));
846 s << static_cast<uint64_t>(m.rows())
847 << static_cast<uint64_t>(m.cols());
848 for (
int j = 0; j < m.cols(); ++j)
849 for (
int i = 0; i < m.rows(); ++i)
850 s << static_cast<int32_t>(m(i, j));
855 s << static_cast<uint64_t>(m.rows())
856 << static_cast<uint64_t>(m.cols());
858 for (
int j = 0; j < m.cols(); ++j)
859 for (
int i = 0; i < m.rows(); ++i)
860 s << static_cast<float>(m(i, j));
863 for (
int j = 0; j < m.cols(); ++j)
864 for (
int i = 0; i < m.rows(); ++i)
871 s << static_cast<uint64_t>(m.rows())
872 << static_cast<uint64_t>(m.cols());
874 for (
int j = 0; j < m.cols(); ++j)
875 for (
int i = 0; i < m.rows(); ++i) {
876 s << static_cast<float>(m(i, j).real());
877 s << static_cast<float>(m(i, j).imag());
881 for (
int j = 0; j < m.cols(); ++j)
882 for (
int i = 0; i < m.rows(); ++i) {
891 s << static_cast<uint64_t>(v.
size());
892 for (
int i = 0; i < v.
size(); ++i)
898 s << static_cast<uint64_t>(v.
size());
899 for (
int i = 0; i < v.
size(); ++i)
900 s << static_cast<int16_t>(v(i));
905 s << static_cast<uint64_t>(v.
size());
906 for (
int i = 0; i < v.
size(); ++i)
907 s << static_cast<int32_t>(v(i));
912 s << static_cast<uint64_t>(v.
size());
913 for (
int i = 0; i < v.
size(); ++i)
919 s << static_cast<uint64_t>(v.
size());
921 for (
int i = 0; i < v.
size(); ++i)
922 s << static_cast<float>(v(i));
925 for (
int i = 0; i < v.
size(); ++i)
926 s << static_cast<double>(v(i));
932 s << static_cast<uint64_t>(v.size());
933 for (
int i = 0; i < v.size(); ++i) {
941 s << static_cast<uint64_t>(v.size());
943 for (
int i = 0; i < v.size(); ++i) {
944 s << static_cast<float>(v(i).real());
945 s << static_cast<float>(v(i).imag());
949 for (
int i = 0; i < v.size(); ++i) {
961 it_assert(h.
type ==
"int8",
"it_ifile::operator>>(): Wrong type");
970 it_assert(h.
type ==
"bool",
"it_ifile::operator>>(): Wrong type");
979 it_assert(h.
type ==
"bin",
"it_ifile::operator>>(): Wrong type");
988 it_assert(h.
type ==
"int16",
"it_ifile::operator>>(): Wrong type");
997 if (h.
type ==
"int32")
999 else if (h.
type ==
"int16") {
1002 x =
static_cast<int>(x16);
1005 it_error(
"it_ifile::operator>>(): Wrong type");
1014 it_assert(h.
type ==
"float32",
"it_ifile::operator>>(): Wrong type");
1023 if (h.
type ==
"float64")
1025 else if (h.
type ==
"float32") {
1028 x =
static_cast<double>(f32);
1031 it_error(
"it_ifile::operator>>(): Wrong type");
1041 "it_ifile::operator>>(): Wrong type");
1050 if (h.
type ==
"cfloat64")
1052 else if (h.
type ==
"cfloat32") {
1053 std::complex<float> f32_c;
1055 x =
static_cast<std::complex<double>
>(f32_c);
1058 it_error(
"it_ifile::operator>>(): Wrong type");
1067 it_assert(h.
type ==
"bvec",
"it_ifile::operator>>(): Wrong type");
1076 it_assert(h.
type ==
"svec",
"it_ifile::operator>>(): Wrong type");
1085 it_assert(h.
type ==
"ivec",
"it_ifile::operator>>(): Wrong type");
1095 if (h.
type ==
"fvec")
1097 else if (h.
type ==
"dvec")
1100 it_error(
"it_ifile::operator>>(): Wrong type");
1110 if (h.
type ==
"fcvec")
1112 else if (h.
type ==
"dcvec")
1115 it_error(
"it_ifile::operator>>(): Wrong type");
1124 it_assert(h.
type ==
"string",
"it_ifile::operator>>(): Wrong type");
1133 it_assert(h.
type ==
"bmat",
"it_ifile::operator>>(): Wrong type");
1142 it_assert(h.
type ==
"smat",
"it_ifile::operator>>(): Wrong type");
1151 it_assert(h.
type ==
"imat",
"it_ifile::operator>>(): Wrong type");
1161 if (h.
type ==
"fmat")
1163 else if (h.
type ==
"dmat")
1166 it_error(
"it_ifile::operator>>(): Wrong type");
1175 if (h.
type ==
"fcmat")
1177 else if (h.
type ==
"dcmat")
1180 it_error(
"it_ifile::operator>>(): Wrong type");
1189 it_assert(h.
type ==
"bArray",
"it_ifile::operator>>(): Wrong type");
1198 it_assert(h.
type ==
"sArray",
"it_ifile::operator>>(): Wrong type");
1207 it_assert(h.
type ==
"iArray",
"it_ifile::operator>>(): Wrong type");
1216 it_assert(h.
type ==
"fArray",
"it_ifile::operator>>(): Wrong type");
1225 if (h.
type ==
"fArray")
1227 else if (h.
type ==
"dArray")
1230 it_error(
"it_ifile::operator>>(): Wrong type");
1239 it_assert(h.
type ==
"fcArray",
"it_ifile::operator>>(): Wrong type");
1248 if (h.
type ==
"fcArray")
1250 else if (h.
type ==
"dcArray")
1253 it_error(
"it_ifile::operator>>(): Wrong type");
1262 it_assert(h.
type ==
"bvecArray",
"it_ifile::operator>>(): Wrong type");
1265 int size =
static_cast<int>(n);
1267 for (
int i = 0; i <
size; ++i)
1277 it_assert(h.
type ==
"svecArray",
"it_ifile::operator>>(): Wrong type");
1280 int size =
static_cast<int>(n);
1282 for (
int i = 0; i <
size; ++i)
1292 it_assert(h.
type ==
"ivecArray",
"it_ifile::operator>>(): Wrong type");
1295 int size =
static_cast<int>(n);
1297 for (
int i = 0; i <
size; ++i)
1307 it_assert(h.
type ==
"vecArray",
"it_ifile::operator>>(): Wrong type");
1310 int size =
static_cast<int>(n);
1312 for (
int i = 0; i <
size; ++i)
1322 it_assert(h.
type ==
"cvecArray",
"it_ifile::operator>>(): Wrong type");
1325 int size =
static_cast<int>(n);
1327 for (
int i = 0; i <
size; ++i)
1337 it_assert(h.
type ==
"stringArray",
"it_ifile::operator>>(): Wrong type");
1340 int size =
static_cast<int>(n);
1342 for (
int i = 0; i <
size; ++i)
1352 it_assert(h.
type ==
"bmatArray",
"it_ifile::operator>>(): Wrong type");
1355 int size =
static_cast<int>(n);
1357 for (
int i = 0; i <
size; ++i)
1367 it_assert(h.
type ==
"smatArray",
"it_ifile::operator>>(): Wrong type");
1370 int size =
static_cast<int>(n);
1372 for (
int i = 0; i <
size; ++i)
1382 it_assert(h.
type ==
"imatArray",
"it_ifile::operator>>(): Wrong type");
1385 int size =
static_cast<int>(n);
1387 for (
int i = 0; i <
size; ++i)
1397 it_assert(h.
type ==
"matArray",
"it_ifile::operator>>(): Wrong type");
1400 int size =
static_cast<int>(n);
1402 for (
int i = 0; i <
size; ++i)
1412 it_assert(h.
type ==
"cmatArray",
"it_ifile::operator>>(): Wrong type");
1415 int size =
static_cast<int>(n);
1417 for (
int i = 0; i <
size; ++i)
1473 it_file &operator<<(it_file &f, std::complex<float> x)
1476 f.low_level_write(x);
1480 it_file &operator<<(it_file &f, std::complex<double> x)
1483 f.low_level_write(x);
1512 + v.size() *
sizeof(float));
1515 + v.size() *
sizeof(double));
1524 + v.size() * 2 *
sizeof(float));
1527 + v.size() * 2 *
sizeof(double));
1542 + m.rows() * m.cols() *
sizeof(char));
1550 + m.rows() * m.cols() *
sizeof(int16_t));
1558 + m.rows() * m.cols() *
sizeof(int32_t));
1567 + m.rows() * m.cols() *
sizeof(float));
1570 + m.rows() * m.cols() *
sizeof(double));
1579 + m.rows() * m.cols() * 2 *
sizeof(float));
1582 + m.rows() * m.cols() * 2 *
sizeof(double));
1587 it_file &operator<<(it_file &f, const Array<bin> &v)
1590 f.low_level_write(v);
1594 it_file &operator<<(it_file &f, const Array<short> &v)
1597 + v.size() *
sizeof(int16_t));
1598 f.low_level_write(v);
1602 it_file &operator<<(it_file &f, const Array<int> &v)
1605 + v.size() *
sizeof(int32_t));
1606 f.low_level_write(v);
1610 it_file &operator<<(it_file &f, const Array<float> &v)
1613 f.low_level_write(v);
1617 it_file &operator<<(it_file &f, const Array<double> &v)
1619 if (f.get_low_precision())
1621 + v.size() *
sizeof(float));
1623 f.write_data_header(
"dArray",
sizeof(uint64_t)
1624 + v.size() *
sizeof(double));
1625 f.low_level_write(v);
1629 it_file &operator<<(it_file &f, const Array<std::complex<float> > &v)
1632 + v.size() * 2 *
sizeof(float));
1633 f.low_level_write(v);
1637 it_file &operator<<(it_file &f, const Array<std::complex<double> > &v)
1639 if (f.get_low_precision())
1641 + v.size() * 2 *
sizeof(float));
1643 f.write_data_header(
"dcArray",
sizeof(uint64_t)
1644 + v.size() * 2 *
sizeof(double));
1645 f.low_level_write(v);
1649 it_file &operator<<(it_file &f, const Array<bvec> &v)
1653 for (
int i = 0; i < v.size(); ++i)
1654 sum_l += v(i).size();
1658 + sum_l *
sizeof(
char));
1660 f.low_level_write(static_cast<uint64_t>(v.size()));
1663 for (
int i = 0; i < v.size(); ++i)
1664 f.low_level_write(v(i));
1669 it_file &operator<<(it_file &f, const Array<svec> &v)
1673 for (
int i = 0; i < v.size(); ++i)
1674 sum_l += v(i).size();
1678 + sum_l *
sizeof(int16_t));
1680 f.low_level_write(static_cast<uint64_t>(v.size()));
1683 for (
int i = 0; i < v.size(); ++i)
1684 f.low_level_write(v(i));
1689 it_file &operator<<(it_file &f, const Array<ivec> &v)
1693 for (
int i = 0; i < v.size(); ++i)
1694 sum_l += v(i).size();
1698 + sum_l *
sizeof(int32_t));
1700 f.low_level_write(static_cast<uint64_t>(v.size()));
1703 for (
int i = 0; i < v.size(); ++i)
1704 f.low_level_write(v(i));
1709 it_file &operator<<(it_file &f, const Array<vec> &v)
1713 for (
int i = 0; i < v.size(); ++i)
1714 sum_l += v(i).size();
1718 + sum_l *
sizeof(
double));
1720 f.low_level_write(static_cast<uint64_t>(v.size()));
1723 for (
int i = 0; i < v.size(); ++i)
1724 f.low_level_write(v(i));
1729 it_file &operator<<(it_file &f, const Array<cvec> &v)
1733 for (
int i = 0; i < v.size(); ++i)
1734 sum_l += v(i).size();
1738 + sum_l * 2 *
sizeof(
double));
1740 f.low_level_write(static_cast<uint64_t>(v.size()));
1743 for (
int i = 0; i < v.size(); ++i)
1744 f.low_level_write(v(i));
1749 it_file &operator<<(it_file &f, const Array<std::string> &v)
1753 for (
int i = 0; i < v.size(); ++i)
1754 sum_l +=
int(v(i).size());
1758 + sum_l *
sizeof(
char));
1760 f.low_level_write(static_cast<uint64_t>(v.size()));
1763 for (
int i = 0; i < v.size(); ++i)
1764 f.low_level_write(v(i));
1769 it_file &operator<<(it_file &f, const Array<bmat> &v)
1773 for (
int i = 0; i < v.size(); ++i)
1774 sum_l += v(i)._datasize();
1778 + sum_l *
sizeof(
char));
1780 f.low_level_write(static_cast<uint64_t>(v.size()));
1783 for (
int i = 0; i < v.size(); ++i)
1784 f.low_level_write(v(i));
1789 it_file &operator<<(it_file &f, const Array<smat> &v)
1793 for (
int i = 0; i < v.size(); ++i)
1794 sum_l += v(i)._datasize();
1798 + sum_l *
sizeof(int16_t));
1800 f.low_level_write(static_cast<uint64_t>(v.size()));
1803 for (
int i = 0; i < v.size(); ++i)
1804 f.low_level_write(v(i));
1809 it_file &operator<<(it_file &f, const Array<imat> &v)
1813 for (
int i = 0; i < v.size(); ++i)
1814 sum_l += v(i)._datasize();
1818 + sum_l *
sizeof(int32_t));
1820 f.low_level_write(static_cast<uint64_t>(v.size()));
1823 for (
int i = 0; i < v.size(); ++i)
1824 f.low_level_write(v(i));
1829 it_file &operator<<(it_file &f, const Array<mat> &v)
1833 for (
int i = 0; i < v.size(); ++i)
1834 sum_l += v(i)._datasize();
1838 + sum_l *
sizeof(
double));
1840 f.low_level_write(static_cast<uint64_t>(v.size()));
1843 for (
int i = 0; i < v.size(); ++i)
1844 f.low_level_write(v(i));
1849 it_file &operator<<(it_file &f, const Array<cmat> &v)
1853 for (
int i = 0; i < v.size(); ++i)
1854 sum_l += v(i)._datasize();
1858 + sum_l * 2 *
sizeof(
double));
1860 f.low_level_write(static_cast<uint64_t>(v.size()));
1863 for (
int i = 0; i < v.size(); ++i)
1864 f.low_level_write(v(i));
1896 it_error(
"Corrupt file (Not an it-file)");
1921 if (h.
type !=
"" && h.
name == name) {
1938 for (
int i = 0; i <= n; i++) {
1969 memset(&h, 0,
sizeof(h));
1970 s.
read(reinterpret_cast<char *>(&h),
sizeof(h));
1977 std::streampos p =
s.
tellg();
2029 float x_real, x_imag;
2032 x = std::complex<float>(x_real, x_imag);
2037 double x_real, x_imag;
2040 x = std::complex<double>(x_real, x_imag);
2049 v.set_size(i,
false);
2050 for (i = 0; i < v.size(); i++) {
2052 v(i) =
static_cast<double>(val);
2062 v.set_size(i,
false);
2063 for (i = 0; i < v.size(); i++) {
2065 v(i) =
static_cast<double>(val);
2074 v.set_size(i,
false);
2075 for (i = 0; i < v.size(); i++) {
2086 v.set_size(i,
false);
2087 for (i = 0; i < v.size(); i++)
2094 float val_real, val_imag;
2097 v.set_size(i,
false);
2098 for (i = 0; i < v.size(); i++) {
2101 v(i) = std::complex<double>(val_real, val_imag);
2108 double val_real, val_imag;
2111 v.set_size(i,
false);
2112 for (i = 0; i < v.size(); i++) {
2115 v(i) = std::complex<double>(val_real, val_imag);
2127 for (j = 0; j < i; j++) {
2139 m.set_size(i, j,
false);
2140 for (j = 0; j < m.cols(); j++)
2141 for (i = 0; i < m.rows(); i++) {
2143 m(i, j) =
static_cast<double>(val);
2153 m.set_size(i, j,
false);
2154 for (j = 0; j < m.cols(); j++)
2155 for (i = 0; i < m.rows(); i++) {
2157 m(i, j) =
static_cast<double>(val);
2166 m.set_size(i, j,
false);
2167 for (j = 0; j < m.cols(); j++)
2168 for (i = 0; i < m.rows(); i++) {
2179 m.set_size(i, j,
false);
2180 for (j = 0; j < m.cols(); j++)
2181 for (i = 0; i < m.rows(); i++)
2188 float val_real, val_imag;
2191 m.set_size(i, j,
false);
2192 for (j = 0; j < m.cols(); j++)
2193 for (i = 0; i < m.rows(); i++) {
2196 m(i, j) = std::complex<double>(val_real, val_imag);
2203 double val_real, val_imag;
2206 m.set_size(i, j,
false);
2207 for (j = 0; j < m.cols(); j++)
2208 for (i = 0; i < m.rows(); i++) {
2211 m(i, j) = std::complex<double>(val_real, val_imag);
2223 for (i = 0; i < v.
size(); i++) {
2236 for (i = 0; i < v.
size(); i++) {
2238 v(i) =
static_cast<double>(val);
2249 for (i = 0; i < v.
size(); i++) {
2251 v(i) =
static_cast<double>(val);
2261 for (i = 0; i < v.
size(); i++) {
2273 for (i = 0; i < v.
size(); i++)
2280 float val_real, val_imag;
2283 v.set_size(i,
false);
2284 for (i = 0; i < v.size(); i++) {
2287 v(i) = std::complex<float>(val_real, val_imag);
2294 float val_real, val_imag;
2297 v.set_size(i,
false);
2298 for (i = 0; i < v.size(); i++) {
2301 v(i) = std::complex<double>(val_real, val_imag);
2308 double val_real, val_imag;
2311 v.set_size(i,
false);
2312 for (i = 0; i < v.size(); i++) {
2315 v(i) = std::complex<double>(val_real, val_imag);
2325 _string(new String_Holder())
2336 s.
open(name, trunc);
2343 it_error(
"Corrupt file (Not an it-file)");
2371 const std::string &name, uint32_t
size)
2376 bool removed =
false;
2380 h1.
hdr_bytes = 1 + 3 * 4 + int(type.size()) + 1 +
int(name.size()) + 1;
2400 if (h2.
type !=
"" && h2.
name == name) {
2409 if (availpos == 0) {
2424 s.
seekg(p + static_cast<std::streamoff>(skip));
2429 s.
seekp(0, std::ios::end);
2492 s << static_cast<int32_t>(x);
2520 s << static_cast<int32_t>(v.size());
2521 for (
int i = 0; i < v.size(); i++)
2522 s << static_cast<float>(v(i));
2525 s << static_cast<int32_t>(v.size());
2526 for (
int i = 0; i < v.size(); i++)
2527 s << static_cast<double>(v(i));
2533 s << static_cast<int32_t>(v.size());
2534 for (
int i = 0; i < v.size(); i++)
2535 s << static_cast<int32_t>(v(i));
2540 s << static_cast<int32_t>(v.size());
2541 for (
int i = 0; i < v.size(); i++)
2548 s << static_cast<int32_t>(v.size());
2549 for (
int i = 0; i < v.size(); i++) {
2550 s << static_cast<float>(v(i).real());
2551 s << static_cast<float>(v(i).imag());
2555 s << static_cast<int32_t>(v.size());
2556 for (
int i = 0; i < v.size(); i++) {
2557 s << static_cast<double>(v(i).real());
2558 s << static_cast<double>(v(i).imag());
2565 int size = int(str.size());
2566 s << static_cast<int32_t>(
size);
2568 for (
int i = 0; i <
size; i++)
2577 s << static_cast<int32_t>(m.rows()) << static_cast<int32_t>(m.cols());
2578 for (j = 0; j < m.cols(); j++)
2579 for (i = 0; i < m.rows(); i++)
2580 s << static_cast<float>(m(i, j));
2583 s << static_cast<int32_t>(m.rows()) << static_cast<int32_t>(m.cols());
2584 for (j = 0; j < m.cols(); j++)
2585 for (i = 0; i < m.rows(); i++)
2586 s << static_cast<double>(m(i, j));
2594 s << static_cast<int32_t>(m.rows()) << static_cast<int32_t>(m.cols());
2595 for (j = 0; j < m.cols(); j++)
2596 for (i = 0; i < m.rows(); i++)
2597 s << static_cast<int32_t>(m(i, j));
2604 s << static_cast<int32_t>(m.rows()) << static_cast<int32_t>(m.cols());
2605 for (j = 0; j < m.cols(); j++)
2606 for (i = 0; i < m.rows(); i++)
2607 s << m(i, j).value();
2615 s << static_cast<int32_t>(m.rows()) << static_cast<int32_t>(m.cols());
2616 for (j = 0; j < m.cols(); j++)
2617 for (i = 0; i < m.rows(); i++) {
2618 s << static_cast<float>(m(i, j).real());
2619 s << static_cast<float>(m(i, j).imag());
2624 s << static_cast<int32_t>(m.rows()) << static_cast<int32_t>(m.cols());
2625 for (j = 0; j < m.cols(); j++)
2626 for (i = 0; i < m.rows(); i++) {
2627 s << static_cast<double>(m(i, j).real());
2628 s << static_cast<double>(m(i, j).imag());
2635 s << static_cast<int32_t>(v.
size());
2636 for (
int i = 0; i < v.
size(); i++)
2643 s << static_cast<int32_t>(v.
size());
2644 for (
int i = 0; i < v.
size(); i++)
2645 s << static_cast<float>(v(i));
2648 s << static_cast<int32_t>(v.
size());
2649 for (
int i = 0; i < v.
size(); i++)
2650 s << static_cast<double>(v(i));
2656 s << static_cast<int32_t>(v.
size());
2657 for (
int i = 0; i < v.
size(); i++)
2658 s << static_cast<int32_t>(v(i));
2663 s << static_cast<int32_t>(v.
size());
2664 for (
int i = 0; i < v.
size(); i++)
2670 s << static_cast<int32_t>(v.size());
2671 for (
int i = 0; i < v.size(); i++) {
2680 s << static_cast<int32_t>(v.size());
2681 for (
int i = 0; i < v.size(); i++) {
2682 s << static_cast<float>(v(i).real());
2683 s << static_cast<float>(v(i).imag());
2687 s << static_cast<int32_t>(v.size());
2688 for (
int i = 0; i < v.size(); i++) {
2689 s << static_cast<double>(v(i).real());
2690 s << static_cast<double>(v(i).imag());
2700 if (h.
type ==
"int8")
2713 if (h.
type ==
"bin")
2726 if (h.
type ==
"int16")
2739 if (h.
type ==
"int32")
2741 else if (h.
type ==
"int16") {
2757 if (h.
type ==
"float64")
2759 else if (h.
type ==
"float32") {
2775 if (h.
type ==
"float32")
2789 if (h.
type ==
"float32_complex") {
2790 std::complex<float> f32_c;
2805 if (h.
type ==
"float64_complex")
2807 else if (h.
type ==
"float32_complex") {
2808 std::complex<float> f32_c;
2823 if (h.
type ==
"fvec")
2825 else if (h.
type ==
"dvec")
2838 if (h.
type ==
"ivec")
2851 if (h.
type ==
"bvec")
2864 if (h.
type ==
"fcvec")
2866 else if (h.
type ==
"dcvec")
2879 if (h.
type ==
"string")
2892 if (h.
type ==
"fmat")
2894 else if (h.
type ==
"dmat")
2907 if (h.
type ==
"imat")
2920 if (h.
type ==
"bmat")
2933 if (h.
type ==
"fcmat")
2935 else if (h.
type ==
"dcmat")
2948 if (h.
type ==
"fArray")
2961 if (h.
type ==
"fArray")
2963 else if (h.
type ==
"dArray")
2976 if (h.
type ==
"iArray")
2989 if (h.
type ==
"bArray")
3002 if (h.
type ==
"fcArray")
3015 if (h.
type ==
"fcArray")
3017 else if (h.
type ==
"dcArray")
3030 if (h.
type ==
"vecArray") {
3034 for (
int i = 0; i < n; i++)
3048 if (h.
type ==
"ivecArray") {
3052 for (
int i = 0; i < n; i++)
3066 if (h.
type ==
"bvecArray") {
3070 for (
int i = 0; i < n; i++)
3084 if (h.
type ==
"cvecArray") {
3088 for (
int i = 0; i < n; i++)
3102 if (h.
type ==
"stringArray") {
3106 for (
int i = 0; i < n; i++)
3120 if (h.
type ==
"matArray") {
3124 for (
int i = 0; i < n; i++)
3138 if (h.
type ==
"imatArray") {
3142 for (
int i = 0; i < n; i++)
3156 if (h.
type ==
"bmatArray") {
3160 for (
int i = 0; i < n; i++)
3174 if (h.
type ==
"cmatArray") {
3178 for (
int i = 0; i < n; i++)
3238 f.low_level_write(x);
3246 f.low_level_write(x);
3327 f.
write_data_header(
"fcmat", 2*
sizeof(
int) + 2*m.rows()*m.cols()*
sizeof(float));
3329 f.
write_data_header(
"dcmat", 2*
sizeof(
int) + 2*m.rows()*m.cols()*
sizeof(double));
3338 f.low_level_write(v);
3345 if (f.get_low_precision())
3348 f.write_data_header(
"dArray",
sizeof(
int) + v.size() *
sizeof(double));
3349 f.low_level_write(v);
3357 f.low_level_write(v);
3365 f.low_level_write(v);
3370 it_file_old &operator<<(it_file_old &f, const Array<std::complex<float> > &v)
3373 f.low_level_write(v);
3378 it_file_old &operator<<(it_file_old &f, const Array<std::complex<double> > &v)
3380 if (f.get_low_precision())
3383 f.write_data_header(
"dcArray",
sizeof(
int) + v.size() * 2 *
sizeof(double));
3384 f.low_level_write(v);
3394 for (i = 0; i < v.size(); i++) {
3395 sum_l += v(i).size();
3399 f.
write_data_header(
"vecArray",
sizeof(
int)*(1 + v.size()) + sum_l *
sizeof(
double));
3401 f.low_level_write(v.size());
3404 for (i = 0; i < v.size(); i++)
3405 f.low_level_write(v(i));
3415 for (i = 0; i < v.size(); i++) {
3416 sum_l += v(i).size();
3420 f.
write_data_header(
"ivecArray",
sizeof(
int)*(1 + v.size()) + sum_l *
sizeof(
int));
3422 f.low_level_write(v.size());
3425 for (i = 0; i < v.size(); i++)
3426 f.low_level_write(v(i));
3436 for (i = 0; i < v.size(); i++) {
3437 sum_l += v(i).size();
3443 f.low_level_write(v.size());
3446 for (i = 0; i < v.size(); i++)
3447 f.low_level_write(v(i));
3457 for (i = 0; i < v.size(); i++) {
3458 sum_l += v(i).size();
3462 f.
write_data_header(
"cvecArray",
sizeof(
int)*(1 + v.size()) + sum_l *
sizeof(std::complex<double>));
3464 f.low_level_write(v.size());
3467 for (i = 0; i < v.size(); i++)
3468 f.low_level_write(v(i));
3478 for (i = 0; i < v.size(); i++) {
3479 sum_l += int(v(i).
size());
3483 f.write_data_header(
"stringArray",
sizeof(
int)*(1 + v.size()) + sum_l *
sizeof(
char));
3485 f.low_level_write(v.size());
3488 for (i = 0; i < v.size(); i++)
3489 f.low_level_write(v(i));
3499 for (i = 0; i < v.size(); i++) {
3500 sum_l += v(i)._datasize();
3504 f.
write_data_header(
"matArray",
sizeof(
int)*(1 + 2*v.size()) + sum_l *
sizeof(
double));
3506 f.low_level_write(v.size());
3509 for (i = 0; i < v.size(); i++)
3510 f.low_level_write(v(i));
3520 for (i = 0; i < v.size(); i++) {
3521 sum_l += v(i)._datasize();
3525 f.
write_data_header(
"imatArray",
sizeof(
int)*(1 + 2*v.size()) + sum_l *
sizeof(
int));
3527 f.low_level_write(v.size());
3530 for (i = 0; i < v.size(); i++)
3531 f.low_level_write(v(i));
3541 for (i = 0; i < v.size(); i++) {
3542 sum_l += v(i)._datasize();
3548 f.low_level_write(v.size());
3551 for (i = 0; i < v.size(); i++)
3552 f.low_level_write(v(i));
3562 for (i = 0; i < v.size(); i++) {
3563 sum_l += v(i)._datasize();
3567 f.
write_data_header(
"cmatArray",
sizeof(
int)*(1 + 2*v.size()) + sum_l *
sizeof(std::complex<double>));
3569 f.low_level_write(v.size());
3572 for (i = 0; i < v.size(); i++)
3573 f.low_level_write(v(i));