30 #include <Base/Math/Matrix.hh>
31 #include <Base/Math/Vector.hh>
32 #include <Base/Debug/Exception.hh>
38 #define SHOULD_THROW(command) \
40 bool has_thrown = false; \
42 catch ( BaseException b ) { has_thrown = true; } \
44 if (verbose) cout << #command << " was expected to throw an exception"\
45 <<", but it has not thrown. Test failed. \n"<<dst<<endl; \
50 const bool verbose =
false;
61 int main(
int argc,
char *argv[])
78 for (
int r=0; r<src.
size(); r++)
95 dst.Set(0, 0, src_small);
96 if (verbose) cout << dst << endl;
99 dst.Set(1, 0, src_small);
100 if (verbose) cout << dst << endl;
103 dst.Set(0, 1, src_small);
104 if (verbose) cout << dst << endl;
108 dst.Set(3, 3, src_small);
109 if (verbose) cout << dst << endl;
112 dst.Set(1, 1, src_vec);
113 if (verbose) cout << dst << endl;
116 dst.SetTranspose(1, 1, src_vec);
117 if (verbose) cout << dst << endl;
120 dst.Set(2, 4, src_vec);
121 if (verbose) cout << dst << endl;
124 dst.SetTranspose(4, 2, src_vec);
125 if (verbose) cout << dst << endl;
128 SHOULD_THROW( dst.Set(0, 0, src_big) );
130 SHOULD_THROW( dst.Set(4, 0, src_small) );
131 SHOULD_THROW( dst.Set(0, 4, src_small) );
132 SHOULD_THROW( dst.Set(4, 4, src_small) );
133 SHOULD_THROW( dst.Set(5, 5, src_small) );
135 SHOULD_THROW( dst.Set(3, 3, src_vec) );
136 SHOULD_THROW( dst.SetTranspose(3, 3, src_vec) );
137 SHOULD_THROW( dst.Set(3, 4, src_vec) );
138 SHOULD_THROW( dst.SetTranspose(4, 3, src_vec) );
Subscript num_cols() const
Subscript num_rows() const