Mercurial > hg > octave-lyh
comparison liboctave/CSparse.cc @ 5760:8d7162924bd3
[project @ 2006-04-14 04:01:37 by jwe]
author | jwe |
---|---|
date | Fri, 14 Apr 2006 04:01:40 +0000 |
parents | 8bf74c0b2cbf |
children | ace8d8d26933 |
comparison
equal
deleted
inserted
replaced
5759:ce79d238f142 | 5760:8d7162924bd3 |
---|---|
1045 const octave_idx_type *Ap = cidx (); | 1045 const octave_idx_type *Ap = cidx (); |
1046 const octave_idx_type *Ai = ridx (); | 1046 const octave_idx_type *Ai = ridx (); |
1047 const Complex *Ax = data (); | 1047 const Complex *Ax = data (); |
1048 | 1048 |
1049 UMFPACK_ZNAME (report_matrix) (nr, nc, Ap, Ai, | 1049 UMFPACK_ZNAME (report_matrix) (nr, nc, Ap, Ai, |
1050 X_CAST (const double *, Ax), | 1050 reinterpret_cast<const double *> (Ax), |
1051 NULL, 1, control); | 1051 NULL, 1, control); |
1052 | 1052 |
1053 void *Symbolic; | 1053 void *Symbolic; |
1054 Matrix Info (1, UMFPACK_INFO); | 1054 Matrix Info (1, UMFPACK_INFO); |
1055 double *info = Info.fortran_vec (); | 1055 double *info = Info.fortran_vec (); |
1056 int status = UMFPACK_ZNAME (qsymbolic) | 1056 int status = UMFPACK_ZNAME (qsymbolic) |
1057 (nr, nc, Ap, Ai, X_CAST (const double *, Ax), NULL, | 1057 (nr, nc, Ap, Ai, reinterpret_cast<const double *> (Ax), NULL, |
1058 NULL, &Symbolic, control, info); | 1058 NULL, &Symbolic, control, info); |
1059 | 1059 |
1060 if (status < 0) | 1060 if (status < 0) |
1061 { | 1061 { |
1062 (*current_liboctave_error_handler) | 1062 (*current_liboctave_error_handler) |
1070 else | 1070 else |
1071 { | 1071 { |
1072 UMFPACK_ZNAME (report_symbolic) (Symbolic, control); | 1072 UMFPACK_ZNAME (report_symbolic) (Symbolic, control); |
1073 | 1073 |
1074 void *Numeric; | 1074 void *Numeric; |
1075 status = UMFPACK_ZNAME (numeric) (Ap, Ai, | 1075 status |
1076 X_CAST (const double *, Ax), NULL, | 1076 = UMFPACK_ZNAME (numeric) (Ap, Ai, |
1077 Symbolic, &Numeric, control, info) ; | 1077 reinterpret_cast<const double *> (Ax), |
1078 NULL, Symbolic, &Numeric, control, info) ; | |
1078 UMFPACK_ZNAME (free_symbolic) (&Symbolic) ; | 1079 UMFPACK_ZNAME (free_symbolic) (&Symbolic) ; |
1079 | 1080 |
1080 rcond = Info (UMFPACK_RCOND); | 1081 rcond = Info (UMFPACK_RCOND); |
1081 | 1082 |
1082 if (status < 0) | 1083 if (status < 0) |
1095 | 1096 |
1096 Complex d[2]; | 1097 Complex d[2]; |
1097 double d_exponent; | 1098 double d_exponent; |
1098 | 1099 |
1099 status = UMFPACK_ZNAME (get_determinant) | 1100 status = UMFPACK_ZNAME (get_determinant) |
1100 (X_CAST (double *, &d[0]), NULL, &d_exponent, | 1101 (reinterpret_cast<double *> (&d[0]), NULL, &d_exponent, |
1101 Numeric, info); | 1102 Numeric, info); |
1102 d[1] = d_exponent; | 1103 d[1] = d_exponent; |
1103 | 1104 |
1104 if (status < 0) | 1105 if (status < 0) |
1105 { | 1106 { |
5525 const Complex *Ax = data (); | 5526 const Complex *Ax = data (); |
5526 octave_idx_type nr = rows (); | 5527 octave_idx_type nr = rows (); |
5527 octave_idx_type nc = cols (); | 5528 octave_idx_type nc = cols (); |
5528 | 5529 |
5529 UMFPACK_ZNAME (report_matrix) (nr, nc, Ap, Ai, | 5530 UMFPACK_ZNAME (report_matrix) (nr, nc, Ap, Ai, |
5530 X_CAST (const double *, Ax), NULL, 1, control); | 5531 reinterpret_cast<const double *> (Ax), |
5532 NULL, 1, control); | |
5531 | 5533 |
5532 void *Symbolic; | 5534 void *Symbolic; |
5533 Info = Matrix (1, UMFPACK_INFO); | 5535 Info = Matrix (1, UMFPACK_INFO); |
5534 double *info = Info.fortran_vec (); | 5536 double *info = Info.fortran_vec (); |
5535 int status = UMFPACK_ZNAME (qsymbolic) (nr, nc, Ap, Ai, | 5537 int status = UMFPACK_ZNAME (qsymbolic) (nr, nc, Ap, Ai, |
5536 X_CAST (const double *, Ax), | 5538 reinterpret_cast<const double *> (Ax), |
5537 NULL, NULL, &Symbolic, control, info); | 5539 NULL, NULL, &Symbolic, control, info); |
5538 | 5540 |
5539 if (status < 0) | 5541 if (status < 0) |
5540 { | 5542 { |
5541 (*current_liboctave_error_handler) | 5543 (*current_liboctave_error_handler) |
5550 else | 5552 else |
5551 { | 5553 { |
5552 UMFPACK_ZNAME (report_symbolic) (Symbolic, control); | 5554 UMFPACK_ZNAME (report_symbolic) (Symbolic, control); |
5553 | 5555 |
5554 status = UMFPACK_ZNAME (numeric) (Ap, Ai, | 5556 status = UMFPACK_ZNAME (numeric) (Ap, Ai, |
5555 X_CAST (const double *, Ax), NULL, | 5557 reinterpret_cast<const double *> (Ax), NULL, |
5556 Symbolic, &Numeric, control, info) ; | 5558 Symbolic, &Numeric, control, info) ; |
5557 UMFPACK_ZNAME (free_symbolic) (&Symbolic) ; | 5559 UMFPACK_ZNAME (free_symbolic) (&Symbolic) ; |
5558 | 5560 |
5559 if (calc_cond) | 5561 if (calc_cond) |
5560 rcond = Info (UMFPACK_RCOND); | 5562 rcond = Info (UMFPACK_RCOND); |
5639 cm->print = -1; | 5641 cm->print = -1; |
5640 cm->print_function = NULL; | 5642 cm->print_function = NULL; |
5641 } | 5643 } |
5642 else | 5644 else |
5643 { | 5645 { |
5644 cm->print = (int)spu + 2; | 5646 cm->print = static_cast<int> (spu) + 2; |
5645 cm->print_function =&SparseCholPrint; | 5647 cm->print_function =&SparseCholPrint; |
5646 } | 5648 } |
5647 | 5649 |
5648 cm->error_handler = &SparseCholError; | 5650 cm->error_handler = &SparseCholError; |
5649 cm->complex_divide = CHOLMOD_NAME(divcomplex); | 5651 cm->complex_divide = CHOLMOD_NAME(divcomplex); |
5804 | 5806 |
5805 for (octave_idx_type j = 0, iidx = 0; j < b_nc; j++, iidx += b_nr) | 5807 for (octave_idx_type j = 0, iidx = 0; j < b_nc; j++, iidx += b_nr) |
5806 { | 5808 { |
5807 #ifdef UMFPACK_SEPARATE_SPLIT | 5809 #ifdef UMFPACK_SEPARATE_SPLIT |
5808 status = UMFPACK_ZNAME (solve) (UMFPACK_A, Ap, | 5810 status = UMFPACK_ZNAME (solve) (UMFPACK_A, Ap, |
5809 Ai, X_CAST (const double *, Ax), | 5811 Ai, |
5812 reinterpret_cast<const double *> (Ax), | |
5810 NULL, | 5813 NULL, |
5811 X_CAST (double *, &Xx[iidx]), | 5814 reinterpret_cast<double *> (&Xx[iidx]), |
5812 NULL, | 5815 NULL, |
5813 &Bx[iidx], Bz, Numeric, | 5816 &Bx[iidx], Bz, Numeric, |
5814 control, info); | 5817 control, info); |
5815 #else | 5818 #else |
5816 for (octave_idx_type i = 0; i < b_nr; i++) | 5819 for (octave_idx_type i = 0; i < b_nr; i++) |
5817 Bz[i] = b.elem (i, j); | 5820 Bz[i] = b.elem (i, j); |
5818 | 5821 |
5819 status = UMFPACK_ZNAME (solve) (UMFPACK_A, Ap, | 5822 status = UMFPACK_ZNAME (solve) (UMFPACK_A, Ap, |
5820 Ai, X_CAST (const double *, Ax), | 5823 Ai, |
5824 reinterpret_cast<const double *> (Ax), | |
5821 NULL, | 5825 NULL, |
5822 X_CAST (double *, &Xx[iidx]), | 5826 reinterpret_cast<double *>, (&Xx[iidx]), |
5823 NULL, | 5827 NULL, |
5824 X_CAST (const double *, Bz), | 5828 reinterpret_cast<const double *> (Bz), |
5825 NULL, Numeric, | 5829 NULL, Numeric, |
5826 control, info); | 5830 control, info); |
5827 #endif | 5831 #endif |
5828 | 5832 |
5829 if (status < 0) | 5833 if (status < 0) |
5894 cm->print = -1; | 5898 cm->print = -1; |
5895 cm->print_function = NULL; | 5899 cm->print_function = NULL; |
5896 } | 5900 } |
5897 else | 5901 else |
5898 { | 5902 { |
5899 cm->print = (int)spu + 2; | 5903 cm->print = static_cast<int> (spu) + 2; |
5900 cm->print_function =&SparseCholPrint; | 5904 cm->print_function =&SparseCholPrint; |
5901 } | 5905 } |
5902 | 5906 |
5903 cm->error_handler = &SparseCholError; | 5907 cm->error_handler = &SparseCholError; |
5904 cm->complex_divide = CHOLMOD_NAME(divcomplex); | 5908 cm->complex_divide = CHOLMOD_NAME(divcomplex); |
6090 #ifdef UMFPACK_SEPARATE_SPLIT | 6094 #ifdef UMFPACK_SEPARATE_SPLIT |
6091 for (octave_idx_type i = 0; i < b_nr; i++) | 6095 for (octave_idx_type i = 0; i < b_nr; i++) |
6092 Bx[i] = b.elem (i, j); | 6096 Bx[i] = b.elem (i, j); |
6093 | 6097 |
6094 status = UMFPACK_ZNAME (solve) (UMFPACK_A, Ap, | 6098 status = UMFPACK_ZNAME (solve) (UMFPACK_A, Ap, |
6095 Ai, X_CAST (const double *, Ax), | 6099 Ai, |
6100 reinterpret_cast<const double *> (Ax), | |
6096 NULL, | 6101 NULL, |
6097 X_CAST (double *, Xx), NULL, | 6102 reinterpret_cast<double *> (Xx), |
6103 NULL, | |
6098 Bx, Bz, Numeric, control, | 6104 Bx, Bz, Numeric, control, |
6099 info); | 6105 info); |
6100 #else | 6106 #else |
6101 for (octave_idx_type i = 0; i < b_nr; i++) | 6107 for (octave_idx_type i = 0; i < b_nr; i++) |
6102 Bz[i] = b.elem (i, j); | 6108 Bz[i] = b.elem (i, j); |
6103 | 6109 |
6104 status = UMFPACK_ZNAME (solve) (UMFPACK_A, Ap, Ai, | 6110 status = UMFPACK_ZNAME (solve) (UMFPACK_A, Ap, Ai, |
6105 X_CAST (const double *, Ax), | 6111 reinterpret_cast<const double *> (Ax), |
6106 NULL, | 6112 NULL, |
6107 X_CAST (double *, Xx), NULL, | 6113 reinterpret_cast<double *> (Xx), |
6108 X_CAST (double *, Bz), NULL, | 6114 NULL, |
6115 reinterpret_cast<double *> (Bz), | |
6116 NULL, | |
6109 Numeric, control, | 6117 Numeric, control, |
6110 info); | 6118 info); |
6111 #endif | 6119 #endif |
6112 if (status < 0) | 6120 if (status < 0) |
6113 { | 6121 { |
6198 cm->print = -1; | 6206 cm->print = -1; |
6199 cm->print_function = NULL; | 6207 cm->print_function = NULL; |
6200 } | 6208 } |
6201 else | 6209 else |
6202 { | 6210 { |
6203 cm->print = (int)spu + 2; | 6211 cm->print = static_cast<int> (spu) + 2; |
6204 cm->print_function =&SparseCholPrint; | 6212 cm->print_function =&SparseCholPrint; |
6205 } | 6213 } |
6206 | 6214 |
6207 cm->error_handler = &SparseCholError; | 6215 cm->error_handler = &SparseCholError; |
6208 cm->complex_divide = CHOLMOD_NAME(divcomplex); | 6216 cm->complex_divide = CHOLMOD_NAME(divcomplex); |
6360 | 6368 |
6361 for (octave_idx_type j = 0, iidx = 0; j < b_nc; j++, iidx += b_nr) | 6369 for (octave_idx_type j = 0, iidx = 0; j < b_nc; j++, iidx += b_nr) |
6362 { | 6370 { |
6363 status = | 6371 status = |
6364 UMFPACK_ZNAME (solve) (UMFPACK_A, Ap, Ai, | 6372 UMFPACK_ZNAME (solve) (UMFPACK_A, Ap, Ai, |
6365 X_CAST (const double *, Ax), | 6373 reinterpret_cast<const double *> (Ax), |
6366 NULL, X_CAST (double *, &Xx[iidx]), | 6374 NULL, |
6367 NULL, X_CAST (const double *, &Bx[iidx]), | 6375 reinterpret_cast<double *> (&Xx[iidx]), |
6376 NULL, | |
6377 reinterpret_cast<const double *> (&Bx[iidx]), | |
6368 NULL, Numeric, control, info); | 6378 NULL, Numeric, control, info); |
6369 | 6379 |
6370 if (status < 0) | 6380 if (status < 0) |
6371 { | 6381 { |
6372 (*current_liboctave_error_handler) | 6382 (*current_liboctave_error_handler) |
6435 cm->print = -1; | 6445 cm->print = -1; |
6436 cm->print_function = NULL; | 6446 cm->print_function = NULL; |
6437 } | 6447 } |
6438 else | 6448 else |
6439 { | 6449 { |
6440 cm->print = (int)spu + 2; | 6450 cm->print = static_cast<int> (spu) + 2; |
6441 cm->print_function =&SparseCholPrint; | 6451 cm->print_function =&SparseCholPrint; |
6442 } | 6452 } |
6443 | 6453 |
6444 cm->error_handler = &SparseCholError; | 6454 cm->error_handler = &SparseCholError; |
6445 cm->complex_divide = CHOLMOD_NAME(divcomplex); | 6455 cm->complex_divide = CHOLMOD_NAME(divcomplex); |
6622 { | 6632 { |
6623 for (octave_idx_type i = 0; i < b_nr; i++) | 6633 for (octave_idx_type i = 0; i < b_nr; i++) |
6624 Bx[i] = b (i,j); | 6634 Bx[i] = b (i,j); |
6625 | 6635 |
6626 status = UMFPACK_ZNAME (solve) (UMFPACK_A, Ap, | 6636 status = UMFPACK_ZNAME (solve) (UMFPACK_A, Ap, |
6627 Ai, X_CAST (const double *, Ax), | 6637 Ai, |
6628 NULL, X_CAST (double *, Xx), | 6638 reinterpret_cast<const double *> (Ax), |
6629 NULL, X_CAST (double *, Bx), | 6639 NULL, |
6640 reinterpret_cast<double *> (Xx), | |
6641 NULL, | |
6642 reinterpret_cast<double *> (Bx), | |
6630 NULL, Numeric, control, info); | 6643 NULL, Numeric, control, info); |
6631 | 6644 |
6632 if (status < 0) | 6645 if (status < 0) |
6633 { | 6646 { |
6634 (*current_liboctave_error_handler) | 6647 (*current_liboctave_error_handler) |