Mercurial > hg > octave-lyh
diff liboctave/dSparse.cc @ 6924:be176b7e110a
[project @ 2007-09-25 19:08:19 by dbateman]
author | dbateman |
---|---|
date | Tue, 25 Sep 2007 19:08:20 +0000 |
parents | 2f17d5556756 |
children | 2d326000e09b |
line wrap: on
line diff
--- a/liboctave/dSparse.cc +++ b/liboctave/dSparse.cc @@ -1278,9 +1278,11 @@ octave_idx_type nm = (nc < nr ? nc : nr); err = 0; - if (nr == 0 || nc == 0 || nr != b.rows ()) + if (nr != b.rows ()) (*current_liboctave_error_handler) ("matrix dimension mismatch solution of linear equations"); + else if (nr == 0 || nc == 0 || b.cols () == 0) + retval = Matrix (nc, b.cols (), 0.0); else { // Print spparms("spumoni") info if requested @@ -1336,9 +1338,11 @@ octave_idx_type nm = (nc < nr ? nc : nr); err = 0; - if (nr == 0 || nc == 0 || nr != b.rows ()) + if (nr != b.rows ()) (*current_liboctave_error_handler) ("matrix dimension mismatch solution of linear equations"); + else if (nr == 0 || nc == 0 || b.cols () == 0) + retval = SparseMatrix (nc, b.cols ()); else { // Print spparms("spumoni") info if requested @@ -1424,9 +1428,11 @@ octave_idx_type nm = (nc < nr ? nc : nr); err = 0; - if (nr == 0 || nc == 0 || nr != b.rows ()) + if (nr != b.rows ()) (*current_liboctave_error_handler) ("matrix dimension mismatch solution of linear equations"); + else if (nr == 0 || nc == 0 || b.cols () == 0) + retval = ComplexMatrix (nc, b.cols (), Complex (0.0, 0.0)); else { // Print spparms("spumoni") info if requested @@ -1482,9 +1488,11 @@ octave_idx_type nm = (nc < nr ? nc : nr); err = 0; - if (nr == 0 || nc == 0 || nr != b.rows ()) + if (nr != b.rows ()) (*current_liboctave_error_handler) ("matrix dimension mismatch solution of linear equations"); + else if (nr == 0 || nc == 0 || b.cols () == 0) + retval = SparseComplexMatrix (nc, b.cols ()); else { // Print spparms("spumoni") info if requested @@ -1571,9 +1579,11 @@ octave_idx_type nm = (nc > nr ? nc : nr); err = 0; - if (nr == 0 || nc == 0 || nr != b.rows ()) + if (nr != b.rows ()) (*current_liboctave_error_handler) ("matrix dimension mismatch solution of linear equations"); + else if (nr == 0 || nc == 0 || b.cols () == 0) + retval = Matrix (nc, b.cols (), 0.0); else { // Print spparms("spumoni") info if requested @@ -1804,9 +1814,11 @@ octave_idx_type nm = (nc > nr ? nc : nr); err = 0; - if (nr == 0 || nc == 0 || nr != b.rows ()) + if (nr != b.rows ()) (*current_liboctave_error_handler) ("matrix dimension mismatch solution of linear equations"); + else if (nr == 0 || nc == 0 || b.cols () == 0) + retval = SparseMatrix (nc, b.cols ()); else { // Print spparms("spumoni") info if requested @@ -2089,9 +2101,11 @@ octave_idx_type nm = (nc > nr ? nc : nr); err = 0; - if (nr == 0 || nc == 0 || nr != b.rows ()) + if (nr != b.rows ()) (*current_liboctave_error_handler) ("matrix dimension mismatch solution of linear equations"); + else if (nr == 0 || nc == 0 || b.cols () == 0) + retval = ComplexMatrix (nc, b.cols (), Complex (0.0, 0.0)); else { // Print spparms("spumoni") info if requested @@ -2325,9 +2339,11 @@ octave_idx_type nm = (nc > nr ? nc : nr); err = 0; - if (nr == 0 || nc == 0 || nr != b.rows ()) + if (nr != b.rows ()) (*current_liboctave_error_handler) ("matrix dimension mismatch solution of linear equations"); + else if (nr == 0 || nc == 0 || b.cols () == 0) + retval = SparseComplexMatrix (nc, b.cols ()); else { // Print spparms("spumoni") info if requested @@ -2613,9 +2629,11 @@ octave_idx_type nm = (nc > nr ? nc : nr); err = 0; - if (nr == 0 || nc == 0 || nr != b.rows ()) + if (nr != b.rows ()) (*current_liboctave_error_handler) ("matrix dimension mismatch solution of linear equations"); + else if (nr == 0 || nc == 0 || b.cols () == 0) + retval = Matrix (nc, b.cols (), 0.0); else { // Print spparms("spumoni") info if requested @@ -2871,9 +2889,11 @@ octave_idx_type nm = (nc > nr ? nc : nr); err = 0; - if (nr == 0 || nc == 0 || nr != b.rows ()) + if (nr != b.rows ()) (*current_liboctave_error_handler) ("matrix dimension mismatch solution of linear equations"); + else if (nr == 0 || nc == 0 || b.cols () == 0) + retval = SparseMatrix (nc, b.cols ()); else { // Print spparms("spumoni") info if requested @@ -3176,9 +3196,11 @@ octave_idx_type nm = (nc > nr ? nc : nr); err = 0; - if (nr == 0 || nc == 0 || nr != b.rows ()) + if (nr != b.rows ()) (*current_liboctave_error_handler) ("matrix dimension mismatch solution of linear equations"); + else if (nr == 0 || nc == 0 || b.cols () == 0) + retval = ComplexMatrix (nc, b.cols (), Complex (0.0, 0.0)); else { // Print spparms("spumoni") info if requested @@ -3435,9 +3457,11 @@ octave_idx_type nm = (nc > nr ? nc : nr); err = 0; - if (nr == 0 || nc == 0 || nr != b.rows ()) + if (nr != b.rows ()) (*current_liboctave_error_handler) ("matrix dimension mismatch solution of linear equations"); + else if (nr == 0 || nc == 0 || b.cols () == 0) + retval = SparseComplexMatrix (nc, b.cols ()); else { // Print spparms("spumoni") info if requested @@ -3741,9 +3765,11 @@ octave_idx_type nc = cols (); err = 0; - if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) + if (nr != nc || nr != b.rows ()) (*current_liboctave_error_handler) ("matrix dimension mismatch solution of linear equations"); + else if (nr == 0 || b.cols () == 0) + retval = Matrix (nc, b.cols (), 0.0); else if (calc_cond) (*current_liboctave_error_handler) ("calculation of condition number not implemented"); @@ -3896,9 +3922,11 @@ octave_idx_type nc = cols (); err = 0; - if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) + if (nr != nc || nr != b.rows ()) (*current_liboctave_error_handler) ("matrix dimension mismatch solution of linear equations"); + else if (nr == 0 || b.cols () == 0) + retval = SparseMatrix (nc, b.cols ()); else if (calc_cond) (*current_liboctave_error_handler) ("calculation of condition number not implemented"); @@ -4054,9 +4082,11 @@ octave_idx_type nc = cols (); err = 0; - if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) + if (nr != nc || nr != b.rows ()) (*current_liboctave_error_handler) ("matrix dimension mismatch solution of linear equations"); + else if (nr == 0 || b.cols () == 0) + retval = ComplexMatrix (nc, b.cols (), Complex (0.0, 0.0)); else if (calc_cond) (*current_liboctave_error_handler) ("calculation of condition number not implemented"); @@ -4216,9 +4246,11 @@ octave_idx_type nc = cols (); err = 0; - if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) + if (nr != nc || nr != b.rows ()) (*current_liboctave_error_handler) ("matrix dimension mismatch solution of linear equations"); + else if (nr == 0 || b.cols () == 0) + retval = SparseComplexMatrix (nc, b.cols ()); else if (calc_cond) (*current_liboctave_error_handler) ("calculation of condition number not implemented"); @@ -4413,9 +4445,11 @@ octave_idx_type nc = cols (); err = 0; - if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) + if (nr != nc || nr != b.rows ()) (*current_liboctave_error_handler) ("matrix dimension mismatch solution of linear equations"); + else if (nr == 0 || b.cols () == 0) + retval = Matrix (nc, b.cols (), 0.0); else { // Print spparms("spumoni") info if requested @@ -4688,9 +4722,11 @@ octave_idx_type nc = cols (); err = 0; - if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) + if (nr != nc || nr != b.rows ()) (*current_liboctave_error_handler) ("matrix dimension mismatch solution of linear equations"); + else if (nr == 0 || b.cols () == 0) + retval = SparseMatrix (nc, b.cols ()); else { // Print spparms("spumoni") info if requested @@ -5039,9 +5075,11 @@ octave_idx_type nc = cols (); err = 0; - if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) + if (nr != nc || nr != b.rows ()) (*current_liboctave_error_handler) ("matrix dimension mismatch solution of linear equations"); + else if (nr == 0 || b.cols () == 0) + retval = ComplexMatrix (nc, b.cols (), Complex (0.0, 0.0)); else { // Print spparms("spumoni") info if requested @@ -5386,9 +5424,11 @@ octave_idx_type nc = cols (); err = 0; - if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) + if (nr != nc || nr != b.rows ()) (*current_liboctave_error_handler) ("matrix dimension mismatch solution of linear equations"); + else if (nr == 0 || b.cols () == 0) + retval = SparseComplexMatrix (nc, b.cols ()); else { // Print spparms("spumoni") info if requested @@ -5908,9 +5948,11 @@ octave_idx_type nc = cols (); err = 0; - if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) + if (nr != nc || nr != b.rows ()) (*current_liboctave_error_handler) ("matrix dimension mismatch solution of linear equations"); + else if (nr == 0 || b.cols () == 0) + retval = Matrix (nc, b.cols (), 0.0); else { // Print spparms("spumoni") info if requested @@ -6140,9 +6182,11 @@ octave_idx_type nc = cols (); err = 0; - if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) + if (nr != nc || nr != b.rows ()) (*current_liboctave_error_handler) ("matrix dimension mismatch solution of linear equations"); + else if (nr == 0 || b.cols () == 0) + retval = SparseMatrix (nc, b.cols ()); else { // Print spparms("spumoni") info if requested @@ -6420,9 +6464,11 @@ octave_idx_type nc = cols (); err = 0; - if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) + if (nr != nc || nr != b.rows ()) (*current_liboctave_error_handler) ("matrix dimension mismatch solution of linear equations"); + else if (nr == 0 || b.cols () == 0) + retval = ComplexMatrix (nc, b.cols (), Complex (0.0, 0.0)); else { // Print spparms("spumoni") info if requested @@ -6672,9 +6718,11 @@ octave_idx_type nc = cols (); err = 0; - if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) + if (nr != nc || nr != b.rows ()) (*current_liboctave_error_handler) ("matrix dimension mismatch solution of linear equations"); + else if (nr == 0 || b.cols () == 0) + retval = SparseComplexMatrix (nc, b.cols ()); else { // Print spparms("spumoni") info if requested