Mercurial > hg > octave-nkf
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 +++ b/liboctave/CMatrix.cc @@ -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 +++ b/liboctave/CMatrix.h @@ -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 +++ b/liboctave/ChangeLog @@ -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 +++ b/liboctave/chMatrix.cc @@ -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 +++ b/liboctave/chMatrix.h @@ -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 +++ b/liboctave/dMatrix.cc @@ -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 +++ b/liboctave/dMatrix.h @@ -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);