44 { 11., 0., 13., 0., 15. },
45 { 0., 22., 0., 24., 0. },
46 { 31., 0., 33., 0., 35. },
47 { 0., 42., 0., 44., 0. },
48 { 51., 0., 53., 0., 55. }
54 for (
int r = 0; r < 5; r++) {
55 for (
int c = 0;
c < 5;
c++) {
56 if (
mat[r][
c] != mh(r + 1,
c + 1)) {
68 for (
int r = 0; r < 5; r++) {
69 for (
int c = 0;
c < 5;
c++) {
70 if (
mat[
c][r] != mh(r + 1,
c + 1)) {
83 for (
int r = 0; r < 5; r++) {
84 if (
mat[r][c] != vh(r + 1)) {
96 for (
int c = 0;
c < 5;
c++) {
97 if (
mat[r][
c] != vh(
c + 1)) {
108 std::vector<integer> perm(5), invperm(5);
114 for (
int i = 0; i < 5; i++) {
115 invperm[perm[i]] = i;
122 for (
int r = 0; r < 5; r++) {
123 for (
int c = 0;
c < 5;
c++) {
124 if (
mat[r][
c] != 0.) {
125 spm(r + 1,
c + 1) =
mat[r][
c];
126 nm(r + 1,
c + 1) =
mat[r][
c];
127 npm(r + 1,
c + 1) =
mat[r][
c];
132 std::cout <<
"matrix in sparse form: " << std::endl
135 std::cout <<
"matrix in naive form: " << std::endl
138 std::cout <<
"matrix in naive permuted form: " << std::endl
141 std::vector<doublereal> Ax0;
142 std::vector<integer> Ai0, Ap0;
147 std::cout <<
"matrix in cc<0> form: " << std::endl
148 << ccm0 << std::endl;
150 std::cout <<
"matrix in cc<0> form again: " << std::endl;
152 for (
int ir = 1; ir <= 5; ir++) {
153 for (
int ic = 1; ic <= 5; ic++) {
154 std::cout << std::setw(16) << const_ccm0(ir, ic);
156 std::cout << std::endl;
159 std::vector<doublereal> Ax1;
160 std::vector<integer> Ai1, Ap1;
165 std::cout <<
"matrix in cc<1> form: " << std::endl
166 << ccm1 << std::endl;
168 std::cout <<
"matrix in cc<1> form again: " << std::endl;
170 for (
int ir = 1; ir <= 5; ir++) {
171 for (
int ic = 1; ic <= 5; ic++) {
172 std::cout << std::setw(16) << const_ccm1(ir, ic);
174 std::cout << std::endl;
178 std::cout <<
"matrix in dir<0> form: " << std::endl
179 << dirm0 << std::endl;
181 std::cout <<
"matrix in dir<0> form again: " << std::endl;
183 for (
int ir = 1; ir <= 5; ir++) {
184 for (
int ic = 1; ic <= 5; ic++) {
185 std::cout << std::setw(16) << const_dirm0(ir, ic);
187 std::cout << std::endl;
191 std::cout <<
"matrix in dir<1> form: " << std::endl
192 << dirm1 << std::endl;
194 std::cout <<
"matrix in dir<1> form again: " << std::endl;
196 for (
int ir = 1; ir <= 5; ir++) {
197 for (
int ic = 1; ic <= 5; ic++) {
198 std::cout << std::setw(16) << const_dirm1(ir, ic);
200 std::cout << std::endl;
205 for (
int i = 1; i <= 5; i++) {
209 std::cout <<
"sp*v(" << i <<
")=" << std::endl
212 std::cerr <<
"*** failed!" << std::endl;
216 std::cout <<
"sp^T*v(" << i <<
")=" << std::endl
219 std::cerr <<
"*** failed!" << std::endl;
223 std::cout <<
"naive*v(" << i <<
")=" << std::endl
226 std::cerr <<
"*** failed!" << std::endl;
230 std::cout <<
"naive^T*v(" << i <<
")=" << std::endl
233 std::cerr <<
"*** failed!" << std::endl;
237 std::cout <<
"naiveperm*v(" << i <<
")=" << std::endl
240 std::cerr <<
"*** failed!" << std::endl;
244 std::cout <<
"naiveperm^T*v(" << i <<
")=" << std::endl
247 std::cerr <<
"*** failed!" << std::endl;
251 std::cout <<
"cc<0>*v(" << i <<
")=" << std::endl
254 std::cerr <<
"*** failed!" << std::endl;
258 std::cout <<
"cc<0>^T*v(" << i <<
")=" << std::endl
261 std::cerr <<
"*** failed!" << std::endl;
265 std::cout <<
"cc<1>*v(" << i <<
")=" << std::endl
268 std::cerr <<
"*** failed!" << std::endl;
272 std::cout <<
"cc<1>^T*v(" << i <<
")=" << std::endl
275 std::cerr <<
"*** failed!" << std::endl;
279 std::cout <<
"dir<0>*v(" << i <<
")=" << std::endl
282 std::cerr <<
"*** failed!" << std::endl;
286 std::cout <<
"dir<0>^T*v(" << i <<
")=" << std::endl
289 std::cerr <<
"*** failed!" << std::endl;
293 std::cout <<
"dir<1>*v(" << i <<
")=" << std::endl
296 std::cerr <<
"*** failed!" << std::endl;
300 std::cout <<
"dir<1>^T*v(" << i <<
")=" << std::endl
303 std::cerr <<
"*** failed!" << std::endl;
319 std::cout <<
"sp*eye=" << std::endl
320 << fmout << std::endl;
322 std::cerr <<
"*** failed!" << std::endl;
326 std::cout <<
"sp^T*eye=" << std::endl
327 << fmout << std::endl;
329 std::cerr <<
"*** failed!" << std::endl;
333 std::cout <<
"naive*eye=" << std::endl
334 << fmout << std::endl;
336 std::cerr <<
"*** failed!" << std::endl;
340 std::cout <<
"naive^T*eye=" << std::endl
341 << fmout << std::endl;
343 std::cerr <<
"*** failed!" << std::endl;
347 std::cout <<
"naiveperm*eye=" << std::endl
348 << fmout << std::endl;
350 std::cerr <<
"*** failed!" << std::endl;
354 std::cout <<
"naiveperm^T*eye=" << std::endl
355 << fmout << std::endl;
357 std::cerr <<
"*** failed!" << std::endl;
361 std::cout <<
"cc<0>*eye=" << std::endl
362 << fmout << std::endl;
364 std::cerr <<
"*** failed!" << std::endl;
368 std::cout <<
"cc<0>^T*eye=" << std::endl
369 << fmout << std::endl;
371 std::cerr <<
"*** failed!" << std::endl;
375 std::cout <<
"cc<1>*eye=" << std::endl
376 << fmout << std::endl;
378 std::cerr <<
"*** failed!" << std::endl;
382 std::cout <<
"cc<1>^T*eye=" << std::endl
383 << fmout << std::endl;
385 std::cerr <<
"*** failed!" << std::endl;
389 std::cout <<
"dir<0>*eye=" << std::endl
390 << fmout << std::endl;
392 std::cerr <<
"*** failed!" << std::endl;
396 std::cout <<
"dir<0>^T*eye=" << std::endl
397 << fmout << std::endl;
399 std::cerr <<
"*** failed!" << std::endl;
403 std::cout <<
"dir<1>*eye=" << std::endl
404 << fmout << std::endl;
406 std::cerr <<
"*** failed!" << std::endl;
410 std::cout <<
"dir<1>^T*eye=" << std::endl
411 << fmout << std::endl;
413 std::cerr <<
"*** failed!" << std::endl;
static int check_vec_transpose(VectorHandler &vh, unsigned r)
integer MakeCompressedColumnForm(doublereal *const Ax, integer *const Ai, integer *const Ap, int offset=0) const
static int check_mat(MatrixHandler &mh)
static doublereal mat[5][5]
static std::stack< cleanup * > c
static int check_mat_transpose(MatrixHandler &mh)
virtual VectorHandler & MatTVecMul(VectorHandler &out, const VectorHandler &in) const
virtual MatrixHandler & MatMatMul(MatrixHandler &out, const MatrixHandler &in) const
virtual MatrixHandler & MatTMatMul(MatrixHandler &out, const MatrixHandler &in) const
virtual VectorHandler & MatVecMul(VectorHandler &out, const VectorHandler &in) const
static int check_vec(VectorHandler &vh, unsigned c)