Mercurial > octave
changeset 2349:b369227ce3d2
[project @ 1996-07-27 07:59:20 by jwe]
author | jwe |
---|---|
date | Sat, 27 Jul 1996 07:59:22 +0000 |
parents | a88c5cc51f62 |
children | 905e19d7eef8 |
files | liboctave/CMatrix.cc liboctave/CMatrix.h liboctave/ChangeLog liboctave/chMatrix.cc liboctave/chMatrix.h liboctave/dMatrix.cc liboctave/dMatrix.h |
diffstat | 7 files changed, 77 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/CMatrix.cc Thu Jul 25 09:54:41 1996 +0000 +++ b/liboctave/CMatrix.cc Sat Jul 27 07:59:22 1996 +0000 @@ -107,6 +107,20 @@ elem (i, j) = a.elem (i, j); } +ComplexMatrix::ComplexMatrix (const RowVector& rv) + : MArray2<Complex> (1, rv.length (), 0.0) +{ + for (int i = 0; i < rv.length (); i++) + elem (0, i) = rv.elem (i); +} + +ComplexMatrix::ComplexMatrix (const ColumnVector& cv) + : MArray2<Complex> (cv.length (), 1, 0.0) +{ + for (int i = 0; i < cv.length (); i++) + elem (i, 0) = cv.elem (i); +} + ComplexMatrix::ComplexMatrix (const DiagMatrix& a) : MArray2<Complex> (a.rows (), a.cols (), 0.0) { @@ -114,6 +128,20 @@ elem (i, i) = a.elem (i, i); } +ComplexMatrix::ComplexMatrix (const ComplexRowVector& rv) + : MArray2<Complex> (1, rv.length (), 0.0) +{ + for (int i = 0; i < rv.length (); i++) + elem (0, i) = rv.elem (i); +} + +ComplexMatrix::ComplexMatrix (const ComplexColumnVector& cv) + : MArray2<Complex> (cv.length (), 1, 0.0) +{ + for (int i = 0; i < cv.length (); i++) + elem (i, 0) = cv.elem (i); +} + ComplexMatrix::ComplexMatrix (const ComplexDiagMatrix& a) : MArray2<Complex> (a.rows (), a.cols (), 0.0) {
--- a/liboctave/CMatrix.h Thu Jul 25 09:54:41 1996 +0000 +++ b/liboctave/CMatrix.h Sat Jul 27 07:59:22 1996 +0000 @@ -53,8 +53,12 @@ ComplexMatrix (const Matrix& a); ComplexMatrix (const MArray2<Complex>& a) : MArray2<Complex> (a) { } ComplexMatrix (const ComplexMatrix& a) : MArray2<Complex> (a) { } + ComplexMatrix (const RowVector& rv); + ComplexMatrix (const ColumnVector& cv); ComplexMatrix (const DiagMatrix& a); // ComplexMatrix (const MDiagArray2<Complex>& a) : MArray2<Complex> (a) { } + ComplexMatrix (const ComplexRowVector& rv); + ComplexMatrix (const ComplexColumnVector& cv); ComplexMatrix (const ComplexDiagMatrix& a); ComplexMatrix (const charMatrix& a);
--- a/liboctave/ChangeLog Thu Jul 25 09:54:41 1996 +0000 +++ b/liboctave/ChangeLog Sat Jul 27 07:59:22 1996 +0000 @@ -1,3 +1,17 @@ +Sat Jul 27 02:54:44 1996 John W. Eaton <jwe@bevo.che.wisc.edu> + + * dMatrix.cc (Matrix::Matrix (const RowVector&), + Matrix::Matrix (const ColumnVector&)): New constructors. + + * CMatrix.cc (ComplexMatrix::ComplexMatrix (const RowVector&), + ComplexMatrix::ComplexMatrix (const ColumnVector&), + ComplexMatrix::ComplexMatrix (const ComplexRowVector&), + ComplexMatrix::ComplexMatrix (const ComplexColumnVector&)): + New constructors. + + * chMatrix.cc (charMatrix::charMatrix (const string_vector&)): + New constructor. + Wed Jul 24 16:39:16 1996 John W. Eaton <jwe@bevo.che.wisc.edu> * LSODE.cc (do_integrate): Check to make sure that the state and
--- a/liboctave/chMatrix.cc Thu Jul 25 09:54:41 1996 +0000 +++ b/liboctave/chMatrix.cc Sat Jul 27 07:59:22 1996 +0000 @@ -39,6 +39,7 @@ // #include <sys/types.h> // XXX FIXME XXX #include "lo-error.h" +#include "str-vec.h" #include "mx-base.h" #include "mx-inlines.cc" @@ -60,6 +61,18 @@ elem (0, i) = s[i]; } +charMatrix::charMatrix (const string_vector& s) + : MArray2<char> (s.length (), s.max_length ()) +{ + for (int i = 0; i < nr; i++) + { + int nc = s[i].length (); + + for (int j = 0; j < nc; j++) + elem (i, j) = s[i][j]; + } +} + int charMatrix::operator == (const charMatrix& a) const {
--- a/liboctave/chMatrix.h Thu Jul 25 09:54:41 1996 +0000 +++ b/liboctave/chMatrix.h Sat Jul 27 07:59:22 1996 +0000 @@ -35,6 +35,7 @@ #include "MArray2.h" #include "mx-defs.h" +#include "str-vec.h" class charMatrix : public MArray2<char> @@ -50,6 +51,7 @@ charMatrix (const charMatrix& a) : MArray2<char> (a) { } charMatrix (const char *s); charMatrix (const string& s); + charMatrix (const string_vector& s); charMatrix& operator = (const charMatrix& a) {
--- a/liboctave/dMatrix.cc Thu Jul 25 09:54:41 1996 +0000 +++ b/liboctave/dMatrix.cc Sat Jul 27 07:59:22 1996 +0000 @@ -109,6 +109,20 @@ // Matrix class. +Matrix::Matrix (const RowVector& rv) + : MArray2<double> (1, rv.length (), 0.0) +{ + for (int i = 0; i < rv.length (); i++) + elem (0, i) = rv.elem (i); +} + +Matrix::Matrix (const ColumnVector& cv) + : MArray2<double> (cv.length (), 1, 0.0) +{ + for (int i = 0; i < cv.length (); i++) + elem (i, 0) = cv.elem (i); +} + Matrix::Matrix (const DiagMatrix& a) : MArray2<double> (a.rows (), a.cols (), 0.0) {
--- a/liboctave/dMatrix.h Thu Jul 25 09:54:41 1996 +0000 +++ b/liboctave/dMatrix.h Sat Jul 27 07:59:22 1996 +0000 @@ -55,6 +55,8 @@ Matrix (int r, int c, double val) : MArray2<double> (r, c, val) { } Matrix (const MArray2<double>& a) : MArray2<double> (a) { } Matrix (const Matrix& a) : MArray2<double> (a) { } + Matrix (const RowVector& rv); + Matrix (const ColumnVector& cv); // Matrix (const MDiagArray2<double>& a) : MArray2<double> (a) { } Matrix (const DiagMatrix& a);