source: Sophya/trunk/SophyaExt/Blitz/blitz/array/io.cc@ 2820

Last change on this file since 2820 was 221, checked in by ansari, 26 years ago

Creation module DPC/Blitz (blitz 0.4) Reza 09/04/99

File size: 962 bytes
Line 
1#ifndef BZ_ARRAY_H
2 #error <blitz/array/io.cc> must be included via <blitz/array.h>
3#endif
4
5#ifndef BZ_ARRAYIO_CC
6#define BZ_ARRAYIO_CC
7
8BZ_NAMESPACE(blitz)
9
10template<class T_numtype>
11ostream& operator<<(ostream& os, const Array<T_numtype,1>& x)
12{
13 os << "[ ";
14 for (int i=x.lbound(firstRank); i <= x.ubound(firstRank); ++i)
15 {
16 os << setw(10) << x(i);
17 if (!((i+1)%7))
18 os << endl << " ";
19 }
20 os << " ]";
21 return os;
22}
23
24template<class T_numtype>
25ostream& operator<<(ostream& os, const Array<T_numtype,2>& x)
26{
27 os << x.rows() << " x " << x.columns() << endl;
28 for (int i=x.lbound(firstRank); i <= x.ubound(firstRank); ++i)
29 {
30 for (int j=x.lbound(secondRank); j <= x.ubound(secondRank); ++j)
31 {
32 os << setw(10) << x(i,j);
33 if (!((j+1)%7))
34 os << endl << " ";
35 }
36 os << endl;
37 }
38
39 return os;
40}
41
42BZ_NAMESPACE_END
43
44#endif // BZ_ARRAYIO_CC
Note: See TracBrowser for help on using the repository browser.