Mercurial > hg > octave-lyh
diff liboctave/CMatrix.cc @ 4015:6476dd85a65f
[project @ 2002-08-02 07:59:19 by jwe]
author | jwe |
---|---|
date | Fri, 02 Aug 2002 07:59:20 +0000 |
parents | f6df65db67f9 |
children | 6e86256e9c54 |
line wrap: on
line diff
--- a/liboctave/CMatrix.cc +++ b/liboctave/CMatrix.cc @@ -2333,124 +2333,31 @@ return false; } +// XXX FIXME XXX Do these really belong here? Maybe they should be +// in a base class? + boolMatrix -ComplexMatrix::all (void) const +ComplexMatrix::all (int dim) const { - int nr = rows (); - int nc = cols (); - boolMatrix retval; - if (nr > 0 && nc > 0) - { - if (nr == 1) - { - retval.resize (1, 1); - retval.elem (0, 0) = true; - for (int j = 0; j < nc; j++) - { - if (elem (0, j) == 0.0) - { - retval.elem (0, 0) = false; - break; - } - } - } - else if (nc == 1) - { - retval.resize (1, 1); - retval.elem (0, 0) = true; - for (int i = 0; i < nr; i++) - { - if (elem (i, 0) == 0.0) - { - retval.elem (0, 0) = false; - break; - } - } - } - else - { - retval.resize (1, nc); - for (int j = 0; j < nc; j++) - { - retval.elem (0, j) = true; - for (int i = 0; i < nr; i++) - { - if (elem (i, j) == 0.0) - { - retval.elem (0, j) = false; - break; - } - } - } - } - } - return retval; + MX_ALL_OP (dim); } boolMatrix -ComplexMatrix::any (void) const +ComplexMatrix::any (int dim) const { - int nr = rows (); - int nc = cols (); - boolMatrix retval; - if (nr > 0 && nc > 0) - { - if (nr == 1) - { - retval.resize (1, 1); - retval.elem (0, 0) = false; - for (int j = 0; j < nc; j++) - { - if (elem (0, j) != 0.0) - { - retval.elem (0, 0) = true; - break; - } - } - } - else if (nc == 1) - { - retval.resize (1, 1); - retval.elem (0, 0) = false; - for (int i = 0; i < nr; i++) - { - if (elem (i, 0) != 0.0) - { - retval.elem (0, 0) = true; - break; - } - } - } - else - { - retval.resize (1, nc); - for (int j = 0; j < nc; j++) - { - retval.elem (0, j) = false; - for (int i = 0; i < nr; i++) - { - if (elem (i, j) != 0.0) - { - retval.elem (0, j) = true; - break; - } - } - } - } - } - return retval; + MX_ANY_OP (dim); } ComplexMatrix ComplexMatrix::cumprod (int dim) const { - MX_CUMMULATIVE_OP (ComplexMatrix, Complex, *=); + MX_CUMULATIVE_OP (ComplexMatrix, Complex, *=); } ComplexMatrix ComplexMatrix::cumsum (int dim) const { - MX_CUMMULATIVE_OP (ComplexMatrix, Complex, +=); + MX_CUMULATIVE_OP (ComplexMatrix, Complex, +=); } ComplexMatrix