Mercurial > hg > octave-avbm
changeset 161:21b599370728
[project @ 1993-10-16 17:20:32 by jwe]
author | jwe |
---|---|
date | Sat, 16 Oct 1993 17:21:25 +0000 |
parents | be50d501b2a7 |
children | d1c5e5edbf1e |
files | liboctave/ColVector.cc liboctave/DiagMatrix.cc liboctave/Matrix.cc liboctave/Matrix.h liboctave/RowVector.cc src/pt-const.cc src/pt-const.h |
diffstat | 7 files changed, 196 insertions(+), 187 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ColVector.cc +++ b/liboctave/ColVector.cc @@ -269,25 +269,25 @@ } ComplexColumnVector -ColumnVector::operator + (Complex s) const +ColumnVector::operator + (const Complex& s) const { return ComplexColumnVector (add (data, len, s), len); } ComplexColumnVector -ColumnVector::operator - (Complex s) const +ColumnVector::operator - (const Complex& s) const { return ComplexColumnVector (subtract (data, len, s), len); } ComplexColumnVector -ColumnVector::operator * (Complex s) const +ColumnVector::operator * (const Complex& s) const { return ComplexColumnVector (multiply (data, len, s), len); } ComplexColumnVector -ColumnVector::operator / (Complex s) const +ColumnVector::operator / (const Complex& s) const { return ComplexColumnVector (divide (data, len, s), len); } @@ -545,7 +545,7 @@ data = (Complex *) NULL; } -ComplexColumnVector::ComplexColumnVector (int n, Complex val) +ComplexColumnVector::ComplexColumnVector (int n, const Complex& val) { if (n < 0) FAIL; @@ -591,7 +591,7 @@ data[0] = a; } -ComplexColumnVector::ComplexColumnVector (Complex a) +ComplexColumnVector::ComplexColumnVector (const Complex& a) { len = 1; data = new Complex [1]; @@ -667,7 +667,7 @@ } ComplexColumnVector& -ComplexColumnVector::resize (int n, Complex val) +ComplexColumnVector::resize (int n, const Complex& val) { int old_len = len; resize (n); @@ -728,7 +728,7 @@ } ComplexColumnVector& -ComplexColumnVector::fill (Complex val) +ComplexColumnVector::fill (const Complex& val) { if (len > 0) copy (data, len, val); @@ -750,7 +750,7 @@ } ComplexColumnVector& -ComplexColumnVector::fill (Complex val, int r1, int r2) +ComplexColumnVector::fill (const Complex& val, int r1, int r2) { if (r1 < 0 || r2 < 0 || r1 >= len || r2 >= len) FAIL; @@ -866,25 +866,25 @@ } ComplexColumnVector -ComplexColumnVector::operator + (Complex s) const +ComplexColumnVector::operator + (const Complex& s) const { return ComplexColumnVector (add (data, len, s), len); } ComplexColumnVector -ComplexColumnVector::operator - (Complex s) const +ComplexColumnVector::operator - (const Complex& s) const { return ComplexColumnVector (subtract (data, len, s), len); } ComplexColumnVector -ComplexColumnVector::operator * (Complex s) const +ComplexColumnVector::operator * (const Complex& s) const { return ComplexColumnVector (multiply (data, len, s), len); } ComplexColumnVector -ComplexColumnVector::operator / (Complex s) const +ComplexColumnVector::operator / (const Complex& s) const { return ComplexColumnVector (divide (data, len, s), len); } @@ -916,25 +916,25 @@ } ComplexColumnVector -operator + (Complex s, const ComplexColumnVector& a) +operator + (const Complex& s, const ComplexColumnVector& a) { return ComplexColumnVector (add (a.data, a.len, s), a.len); } ComplexColumnVector -operator - (Complex s, const ComplexColumnVector& a) +operator - (const Complex& s, const ComplexColumnVector& a) { return ComplexColumnVector (subtract (s, a.data, a.len), a.len); } ComplexColumnVector -operator * (Complex s, const ComplexColumnVector& a) +operator * (const Complex& s, const ComplexColumnVector& a) { return ComplexColumnVector (multiply (a.data, a.len, s), a.len); } ComplexColumnVector -operator / (Complex s, const ComplexColumnVector& a) +operator / (const Complex& s, const ComplexColumnVector& a) { return ComplexColumnVector (divide (s, a.data, a.len), a.len); }
--- a/liboctave/DiagMatrix.cc +++ b/liboctave/DiagMatrix.cc @@ -434,14 +434,14 @@ } ComplexMatrix -DiagMatrix::operator + (Complex s) const +DiagMatrix::operator + (const Complex& s) const { ComplexMatrix tmp (nr, nc, s); return *this + tmp; } ComplexMatrix -DiagMatrix::operator - (Complex s) const +DiagMatrix::operator - (const Complex& s) const { ComplexMatrix tmp (nr, nc, -s); return *this + tmp; @@ -462,13 +462,13 @@ } ComplexDiagMatrix -DiagMatrix::operator * (Complex s) const +DiagMatrix::operator * (const Complex& s) const { return ComplexDiagMatrix (multiply (data, len, s), nr, nc); } ComplexDiagMatrix -DiagMatrix::operator / (Complex s) const +DiagMatrix::operator / (const Complex& s) const { return ComplexDiagMatrix (divide (data, len, s), nr, nc); } @@ -946,7 +946,7 @@ data = (Complex *) NULL; } -ComplexDiagMatrix::ComplexDiagMatrix (int n, Complex val) +ComplexDiagMatrix::ComplexDiagMatrix (int n, const Complex& val) { if (n < 0) FAIL; @@ -994,7 +994,7 @@ data = (Complex *) NULL; } -ComplexDiagMatrix::ComplexDiagMatrix (int r, int c, Complex val) +ComplexDiagMatrix::ComplexDiagMatrix (int r, int c, const Complex& val) { if (r < 0 || c < 0) FAIL; @@ -1104,7 +1104,7 @@ data[0] = a; } -ComplexDiagMatrix::ComplexDiagMatrix (Complex a) +ComplexDiagMatrix::ComplexDiagMatrix (const Complex& a) { nr = 1; nc = 1; @@ -1209,7 +1209,7 @@ } ComplexDiagMatrix& -ComplexDiagMatrix::resize (int r, int c, Complex val) +ComplexDiagMatrix::resize (int r, int c, const Complex& val) { if (r < 0 || c < 0) FAIL; @@ -1270,7 +1270,7 @@ } ComplexDiagMatrix& -ComplexDiagMatrix::fill (Complex val) +ComplexDiagMatrix::fill (const Complex& val) { copy (data, len, val); return *this; @@ -1288,7 +1288,7 @@ } ComplexDiagMatrix& -ComplexDiagMatrix::fill (Complex val, int beg, int end) +ComplexDiagMatrix::fill (const Complex& val, int beg, int end) { if (beg < 0 || end >= len || end < beg) FAIL; @@ -1536,14 +1536,14 @@ } ComplexMatrix -ComplexDiagMatrix::operator + (Complex s) const +ComplexDiagMatrix::operator + (const Complex& s) const { ComplexMatrix tmp (nr, nc, s); return *this + tmp; } ComplexMatrix -ComplexDiagMatrix::operator - (Complex s) const +ComplexDiagMatrix::operator - (const Complex& s) const { ComplexMatrix tmp (nr, nc, -s); return *this + tmp; @@ -1564,13 +1564,13 @@ } ComplexDiagMatrix -ComplexDiagMatrix::operator * (Complex s) const +ComplexDiagMatrix::operator * (const Complex& s) const { return ComplexDiagMatrix (multiply (data, len, s), nr, nc); } ComplexDiagMatrix -ComplexDiagMatrix::operator / (Complex s) const +ComplexDiagMatrix::operator / (const Complex& s) const { return ComplexDiagMatrix (divide (data, len, s), nr, nc); } @@ -1590,13 +1590,13 @@ } ComplexMatrix -operator + (Complex s, const ComplexDiagMatrix& a) +operator + (const Complex& s, const ComplexDiagMatrix& a) { return a + s; } ComplexMatrix -operator - (Complex s, const ComplexDiagMatrix& a) +operator - (const Complex& s, const ComplexDiagMatrix& a) { return -a + s; } @@ -1616,13 +1616,13 @@ } ComplexDiagMatrix - operator * (Complex s, const ComplexDiagMatrix& a) + operator * (const Complex& s, const ComplexDiagMatrix& a) { return ComplexDiagMatrix (multiply (a.data, a.len, s), a.nr, a.nc); } ComplexDiagMatrix -operator / (Complex s, const ComplexDiagMatrix& a) +operator / (const Complex& s, const ComplexDiagMatrix& a) { return ComplexDiagMatrix (divide (s, a.data, a.len), a.nr, a.nc); }
--- a/liboctave/Matrix.cc +++ b/liboctave/Matrix.cc @@ -978,25 +978,25 @@ } ComplexMatrix -Matrix::operator + (Complex s) const +Matrix::operator + (const Complex& s) const { return ComplexMatrix (add (data, len, s), nr, nc); } ComplexMatrix -Matrix::operator - (Complex s) const +Matrix::operator - (const Complex& s) const { return ComplexMatrix (subtract (data, len, s), nr, nc); } ComplexMatrix -Matrix::operator * (Complex s) const +Matrix::operator * (const Complex& s) const { return ComplexMatrix (multiply (data, len, s), nr, nc); } ComplexMatrix -Matrix::operator / (Complex s) const +Matrix::operator / (const Complex& s) const { return ComplexMatrix (divide (data, len, s), nr, nc); } @@ -1960,7 +1960,7 @@ data = (Complex *) NULL; } -ComplexMatrix::ComplexMatrix (int r, int c, Complex val) +ComplexMatrix::ComplexMatrix (int r, int c, const Complex& val) { if (r < 0 || c < 0) FAIL; @@ -2046,7 +2046,7 @@ data[0] = a; } -ComplexMatrix::ComplexMatrix (Complex a) +ComplexMatrix::ComplexMatrix (const Complex& a) { nr = 1; nc = 1; @@ -2156,7 +2156,7 @@ } ComplexMatrix& -ComplexMatrix::resize (int r, int c, Complex val) +ComplexMatrix::resize (int r, int c, const Complex& val) { if (r < 0 || c < 0) FAIL; @@ -2313,7 +2313,7 @@ } ComplexMatrix& -ComplexMatrix::fill (Complex val) +ComplexMatrix::fill (const Complex& val) { if (nr > 0 && nc > 0) copy (data, len, val); @@ -2338,7 +2338,7 @@ } ComplexMatrix& -ComplexMatrix::fill (Complex val, int r1, int c1, int r2, int c2) +ComplexMatrix::fill (const Complex& val, int r1, int c1, int r2, int c2) { if (r1 < 0 || r2 < 0 || c1 < 0 || c2 < 0 || r1 >= nr || r2 >= nr || c1 >= nc || c2 >= nc) @@ -3218,25 +3218,25 @@ } ComplexMatrix -ComplexMatrix::operator + (Complex s) const +ComplexMatrix::operator + (const Complex& s) const { return ComplexMatrix (add (data, len, s), nr, nc); } ComplexMatrix -ComplexMatrix::operator - (Complex s) const +ComplexMatrix::operator - (const Complex& s) const { return ComplexMatrix (subtract (data, len, s), nr, nc); } ComplexMatrix -ComplexMatrix::operator * (Complex s) const +ComplexMatrix::operator * (const Complex& s) const { return ComplexMatrix (multiply (data, len, s), nr, nc); } ComplexMatrix -ComplexMatrix::operator / (Complex s) const +ComplexMatrix::operator / (const Complex& s) const { return ComplexMatrix (divide (data, len, s), nr, nc); } @@ -3268,25 +3268,25 @@ } ComplexMatrix -operator + (Complex s, const ComplexMatrix& a) +operator + (const Complex& s, const ComplexMatrix& a) { return ComplexMatrix (add (s, a.data, a.len), a.nr, a.nc); } ComplexMatrix -operator - (Complex s, const ComplexMatrix& a) +operator - (const Complex& s, const ComplexMatrix& a) { return ComplexMatrix (subtract (s, a.data, a.len), a.nr, a.nc); } ComplexMatrix -operator * (Complex s, const ComplexMatrix& a) +operator * (const Complex& s, const ComplexMatrix& a) { return ComplexMatrix (multiply (s, a.data, a.len), a.nr, a.nc); } ComplexMatrix -operator / (Complex s, const ComplexMatrix& a) +operator / (const Complex& s, const ComplexMatrix& a) { return ComplexMatrix (divide (s, a.data, a.len), a.nr, a.nc); }
--- a/liboctave/Matrix.h +++ b/liboctave/Matrix.h @@ -429,10 +429,10 @@ Matrix operator * (double s) const; Matrix operator / (double s) const; - ComplexMatrix operator + (Complex s) const; - ComplexMatrix operator - (Complex s) const; - ComplexMatrix operator * (Complex s) const; - ComplexMatrix operator / (Complex s) const; + ComplexMatrix operator + (const Complex& s) const; + ComplexMatrix operator - (const Complex& s) const; + ComplexMatrix operator * (const Complex& s) const; + ComplexMatrix operator / (const Complex& s) const; // scalar by matrix -> matrix operations @@ -630,10 +630,10 @@ ColumnVector operator * (double s) const; ColumnVector operator / (double s) const; - ComplexColumnVector operator + (Complex s) const; - ComplexColumnVector operator - (Complex s) const; - ComplexColumnVector operator * (Complex s) const; - ComplexColumnVector operator / (Complex s) const; + ComplexColumnVector operator + (const Complex& s) const; + ComplexColumnVector operator - (const Complex& s) const; + ComplexColumnVector operator * (const Complex& s) const; + ComplexColumnVector operator / (const Complex& s) const; // scalar by column vector -> column vector operations @@ -791,10 +791,10 @@ RowVector operator * (double s) const; RowVector operator / (double s) const; - ComplexRowVector operator + (Complex s) const; - ComplexRowVector operator - (Complex s) const; - ComplexRowVector operator * (Complex s) const; - ComplexRowVector operator / (Complex s) const; + ComplexRowVector operator + (const Complex& s) const; + ComplexRowVector operator - (const Complex& s) const; + ComplexRowVector operator * (const Complex& s) const; + ComplexRowVector operator / (const Complex& s) const; // scalar by row vector -> row vector operations @@ -967,16 +967,16 @@ Matrix operator + (double s) const; Matrix operator - (double s) const; - ComplexMatrix operator + (Complex s) const; - ComplexMatrix operator - (Complex s) const; + ComplexMatrix operator + (const Complex& s) const; + ComplexMatrix operator - (const Complex& s) const; // diagonal matrix by scalar -> diagonal matrix operations DiagMatrix operator * (double s) const; DiagMatrix operator / (double s) const; - ComplexDiagMatrix operator * (Complex s) const; - ComplexDiagMatrix operator / (Complex s) const; + ComplexDiagMatrix operator * (const Complex& s) const; + ComplexDiagMatrix operator / (const Complex& s) const; // scalar by diagonal matrix -> matrix operations @@ -1111,13 +1111,13 @@ ComplexMatrix (void); ComplexMatrix (int r, int c); ComplexMatrix (int r, int c, double val); - ComplexMatrix (int r, int c, Complex val); + ComplexMatrix (int r, int c, const Complex& val); ComplexMatrix (const Matrix& a); ComplexMatrix (const ComplexMatrix& a); ComplexMatrix (const DiagMatrix& a); ComplexMatrix (const ComplexDiagMatrix& a); ComplexMatrix (double a); - ComplexMatrix (Complex a); + ComplexMatrix (const Complex& a); ~ComplexMatrix (void); ComplexMatrix& operator = (const Matrix& a); @@ -1137,7 +1137,7 @@ ComplexMatrix& resize (int r, int c); ComplexMatrix& resize (int r, int c, double val); - ComplexMatrix& resize (int r, int c, Complex val); + ComplexMatrix& resize (int r, int c, const Complex& val); int operator == (const ComplexMatrix& a) const; int operator != (const ComplexMatrix& a) const; @@ -1155,9 +1155,9 @@ ComplexMatrix& insert (const ComplexDiagMatrix& a, int r, int c); ComplexMatrix& fill (double val); - ComplexMatrix& fill (Complex val); + ComplexMatrix& fill (const Complex& val); ComplexMatrix& fill (double val, int r1, int c1, int r2, int c2); - ComplexMatrix& fill (Complex val, int r1, int c1, int r2, int c2); + ComplexMatrix& fill (const Complex& val, int r1, int c1, int r2, int c2); ComplexMatrix append (const Matrix& a) const; ComplexMatrix append (const RowVector& a) const; @@ -1253,10 +1253,10 @@ ComplexMatrix operator * (double s) const; ComplexMatrix operator / (double s) const; - ComplexMatrix operator + (Complex s) const; - ComplexMatrix operator - (Complex s) const; - ComplexMatrix operator * (Complex s) const; - ComplexMatrix operator / (Complex s) const; + ComplexMatrix operator + (const Complex& s) const; + ComplexMatrix operator - (const Complex& s) const; + ComplexMatrix operator * (const Complex& s) const; + ComplexMatrix operator / (const Complex& s) const; // scalar by matrix -> matrix operations @@ -1265,10 +1265,10 @@ friend ComplexMatrix operator * (double s, const ComplexMatrix& a); friend ComplexMatrix operator / (double s, const ComplexMatrix& a); - friend ComplexMatrix operator + (Complex s, const ComplexMatrix& a); - friend ComplexMatrix operator - (Complex s, const ComplexMatrix& a); - friend ComplexMatrix operator * (Complex s, const ComplexMatrix& a); - friend ComplexMatrix operator / (Complex s, const ComplexMatrix& a); + friend ComplexMatrix operator + (const Complex& s, const ComplexMatrix& a); + friend ComplexMatrix operator - (const Complex& s, const ComplexMatrix& a); + friend ComplexMatrix operator * (const Complex& s, const ComplexMatrix& a); + friend ComplexMatrix operator / (const Complex& s, const ComplexMatrix& a); // matrix by column vector -> column vector operations @@ -1421,11 +1421,11 @@ ComplexColumnVector (void); ComplexColumnVector (int n); ComplexColumnVector (int n, double val); - ComplexColumnVector (int n, Complex val); + ComplexColumnVector (int n, const Complex& val); ComplexColumnVector (const ColumnVector& a); ComplexColumnVector (const ComplexColumnVector& a); ComplexColumnVector (double a); - ComplexColumnVector (Complex a); + ComplexColumnVector (const Complex& a); ~ComplexColumnVector (void); ComplexColumnVector& operator = (const ColumnVector& a); @@ -1444,7 +1444,7 @@ ComplexColumnVector& resize (int n); ComplexColumnVector& resize (int n, double val); - ComplexColumnVector& resize (int n, Complex val); + ComplexColumnVector& resize (int n, const Complex& val); int operator == (const ComplexColumnVector& a) const; int operator != (const ComplexColumnVector& a) const; @@ -1455,9 +1455,9 @@ ComplexColumnVector& insert (const ComplexColumnVector& a, int r); ComplexColumnVector& fill (double val); - ComplexColumnVector& fill (Complex val); + ComplexColumnVector& fill (const Complex& val); ComplexColumnVector& fill (double val, int r1, int r2); - ComplexColumnVector& fill (Complex val, int r1, int r2); + ComplexColumnVector& fill (const Complex& val, int r1, int r2); ComplexColumnVector stack (const ColumnVector& a) const; ComplexColumnVector stack (const ComplexColumnVector& a) const; @@ -1480,10 +1480,10 @@ ComplexColumnVector operator * (double s) const; ComplexColumnVector operator / (double s) const; - ComplexColumnVector operator + (Complex s) const; - ComplexColumnVector operator - (Complex s) const; - ComplexColumnVector operator * (Complex s) const; - ComplexColumnVector operator / (Complex s) const; + ComplexColumnVector operator + (const Complex& s) const; + ComplexColumnVector operator - (const Complex& s) const; + ComplexColumnVector operator * (const Complex& s) const; + ComplexColumnVector operator / (const Complex& s) const; // scalar by column vector -> column vector operations @@ -1496,13 +1496,13 @@ friend ComplexColumnVector operator / (double s, const ComplexColumnVector& a); - friend ComplexColumnVector operator + (Complex s, + friend ComplexColumnVector operator + (const Complex& s, const ComplexColumnVector& a); - friend ComplexColumnVector operator - (Complex s, + friend ComplexColumnVector operator - (const Complex& s, const ComplexColumnVector& a); - friend ComplexColumnVector operator * (Complex s, + friend ComplexColumnVector operator * (const Complex& s, const ComplexColumnVector& a); - friend ComplexColumnVector operator / (Complex s, + friend ComplexColumnVector operator / (const Complex& s, const ComplexColumnVector& a); // column vector by row vector -> matrix operations @@ -1615,11 +1615,11 @@ ComplexRowVector (void); ComplexRowVector (int n); ComplexRowVector (int n, double val); - ComplexRowVector (int n, Complex val); + ComplexRowVector (int n, const Complex& val); ComplexRowVector (const RowVector& a); ComplexRowVector (const ComplexRowVector& a); ComplexRowVector (double a); - ComplexRowVector (Complex a); + ComplexRowVector (const Complex& a); ~ComplexRowVector (void); ComplexRowVector& operator = (const RowVector& a); @@ -1638,7 +1638,7 @@ ComplexRowVector& resize (int n); ComplexRowVector& resize (int n, double val); - ComplexRowVector& resize (int n, Complex val); + ComplexRowVector& resize (int n, const Complex& val); int operator == (const ComplexRowVector& a) const; int operator != (const ComplexRowVector& a) const; @@ -1649,9 +1649,9 @@ ComplexRowVector& insert (const ComplexRowVector& a, int c); ComplexRowVector& fill (double val); - ComplexRowVector& fill (Complex val); + ComplexRowVector& fill (const Complex& val); ComplexRowVector& fill (double val, int c1, int c2); - ComplexRowVector& fill (Complex val, int c1, int c2); + ComplexRowVector& fill (const Complex& val, int c1, int c2); ComplexRowVector append (const RowVector& a) const; ComplexRowVector append (const ComplexRowVector& a) const; @@ -1674,10 +1674,10 @@ ComplexRowVector operator * (double s) const; ComplexRowVector operator / (double s) const; - ComplexRowVector operator + (Complex s) const; - ComplexRowVector operator - (Complex s) const; - ComplexRowVector operator * (Complex s) const; - ComplexRowVector operator / (Complex s) const; + ComplexRowVector operator + (const Complex& s) const; + ComplexRowVector operator - (const Complex& s) const; + ComplexRowVector operator * (const Complex& s) const; + ComplexRowVector operator / (const Complex& s) const; // scalar by row vector -> row vector operations @@ -1686,10 +1686,14 @@ friend ComplexRowVector operator * (double s, const ComplexRowVector& a); friend ComplexRowVector operator / (double s, const ComplexRowVector& a); - friend ComplexRowVector operator + (Complex s, const ComplexRowVector& a); - friend ComplexRowVector operator - (Complex s, const ComplexRowVector& a); - friend ComplexRowVector operator * (Complex s, const ComplexRowVector& a); - friend ComplexRowVector operator / (Complex s, const ComplexRowVector& a); + friend ComplexRowVector operator + (const Complex& s, const + ComplexRowVector& a); + friend ComplexRowVector operator - (const Complex& s, const + ComplexRowVector& a); + friend ComplexRowVector operator * (const Complex& s, const + ComplexRowVector& a); + friend ComplexRowVector operator / (const Complex& s, const + ComplexRowVector& a); // row vector by column vector -> scalar @@ -1804,10 +1808,10 @@ ComplexDiagMatrix (void); ComplexDiagMatrix (int n); ComplexDiagMatrix (int n, double val); - ComplexDiagMatrix (int n, Complex val); + ComplexDiagMatrix (int n, const Complex& val); ComplexDiagMatrix (int r, int c); ComplexDiagMatrix (int r, int c, double val); - ComplexDiagMatrix (int r, int c, Complex val); + ComplexDiagMatrix (int r, int c, const Complex& val); ComplexDiagMatrix (const RowVector& a); ComplexDiagMatrix (const ComplexRowVector& a); ComplexDiagMatrix (const ColumnVector& a); @@ -1815,7 +1819,7 @@ ComplexDiagMatrix (const DiagMatrix& a); ComplexDiagMatrix (const ComplexDiagMatrix& a); ComplexDiagMatrix (double a); - ComplexDiagMatrix (Complex a); + ComplexDiagMatrix (const Complex& a); ~ComplexDiagMatrix (void); ComplexDiagMatrix& operator = (const DiagMatrix& a); @@ -1835,15 +1839,15 @@ ComplexDiagMatrix& resize (int r, int c); ComplexDiagMatrix& resize (int r, int c, double val); - ComplexDiagMatrix& resize (int r, int c, Complex val); + ComplexDiagMatrix& resize (int r, int c, const Complex& val); int operator == (const ComplexDiagMatrix& a) const; int operator != (const ComplexDiagMatrix& a) const; ComplexDiagMatrix& fill (double val); - ComplexDiagMatrix& fill (Complex val); + ComplexDiagMatrix& fill (const Complex& val); ComplexDiagMatrix& fill (double val, int beg, int end); - ComplexDiagMatrix& fill (Complex val, int beg, int end); + ComplexDiagMatrix& fill (const Complex& val, int beg, int end); ComplexDiagMatrix& fill (const ColumnVector& a); ComplexDiagMatrix& fill (const ComplexColumnVector& a); ComplexDiagMatrix& fill (const RowVector& a); @@ -1880,32 +1884,36 @@ ComplexMatrix operator + (double s) const; ComplexMatrix operator - (double s) const; - ComplexMatrix operator + (Complex s) const; - ComplexMatrix operator - (Complex s) const; + ComplexMatrix operator + (const Complex& s) const; + ComplexMatrix operator - (const Complex& s) const; // diagonal matrix by scalar -> diagonal matrix operations ComplexDiagMatrix operator * (double s) const; ComplexDiagMatrix operator / (double s) const; - ComplexDiagMatrix operator * (Complex s) const; - ComplexDiagMatrix operator / (Complex s) const; + ComplexDiagMatrix operator * (const Complex& s) const; + ComplexDiagMatrix operator / (const Complex& s) const; // scalar by diagonal matrix -> matrix operations friend ComplexMatrix operator + (double s, const ComplexDiagMatrix& a); friend ComplexMatrix operator - (double s, const ComplexDiagMatrix& a); - friend ComplexMatrix operator + (Complex s, const ComplexDiagMatrix& a); - friend ComplexMatrix operator - (Complex s, const ComplexDiagMatrix& a); + friend ComplexMatrix operator + (const Complex& s, const + ComplexDiagMatrix& a); + friend ComplexMatrix operator - (const Complex& s, const + ComplexDiagMatrix& a); // scalar by diagonal matrix -> diagonal matrix operations friend ComplexDiagMatrix operator * (double s, const ComplexDiagMatrix& a); friend ComplexDiagMatrix operator / (double s, const ComplexDiagMatrix& a); - friend ComplexDiagMatrix operator * (Complex s, const ComplexDiagMatrix& a); - friend ComplexDiagMatrix operator / (Complex s, const ComplexDiagMatrix& a); + friend ComplexDiagMatrix operator * (const Complex& s, const + ComplexDiagMatrix& a); + friend ComplexDiagMatrix operator / (const Complex& s, const + ComplexDiagMatrix& a); // diagonal matrix by column vector -> column vector operations @@ -2089,7 +2097,8 @@ ComplexMatrix balancing_mat; }; -inline ComplexAEPBALANCE::ComplexAEPBALANCE (const ComplexMatrix& a, const char * balance_job) +inline ComplexAEPBALANCE::ComplexAEPBALANCE (const ComplexMatrix& a, + const char * balance_job) { init(a,balance_job); }
--- a/liboctave/RowVector.cc +++ b/liboctave/RowVector.cc @@ -241,25 +241,25 @@ } ComplexRowVector -RowVector::operator + (Complex s) const +RowVector::operator + (const Complex& s) const { return ComplexRowVector (add (data, len, s), len); } ComplexRowVector -RowVector::operator - (Complex s) const +RowVector::operator - (const Complex& s) const { return ComplexRowVector (subtract (data, len, s), len); } ComplexRowVector -RowVector::operator * (Complex s) const +RowVector::operator * (const Complex& s) const { return ComplexRowVector (multiply (data, len, s), len); } ComplexRowVector -RowVector::operator / (Complex s) const +RowVector::operator / (const Complex& s) const { return ComplexRowVector (divide (data, len, s), len); } @@ -566,7 +566,7 @@ data = (Complex *) NULL; } -ComplexRowVector::ComplexRowVector (int n, Complex val) +ComplexRowVector::ComplexRowVector (int n, const Complex& val) { if (n < 0) FAIL; @@ -612,7 +612,7 @@ data[0] = a; } -ComplexRowVector::ComplexRowVector (Complex a) +ComplexRowVector::ComplexRowVector (const Complex& a) { len = 1; data = new Complex [1]; @@ -688,7 +688,7 @@ } ComplexRowVector& -ComplexRowVector::resize (int n, Complex val) +ComplexRowVector::resize (int n, const Complex& val) { int old_len = len; resize (n); @@ -749,7 +749,7 @@ } ComplexRowVector& -ComplexRowVector::fill (Complex val) +ComplexRowVector::fill (const Complex& val) { if (len > 0) copy (data, len, val); @@ -771,7 +771,7 @@ } ComplexRowVector& -ComplexRowVector::fill (Complex val, int c1, int c2) +ComplexRowVector::fill (const Complex& val, int c1, int c2) { if (c1 < 0 || c2 < 0 || c1 >= len || c2 >= len) FAIL; @@ -887,25 +887,25 @@ } ComplexRowVector -ComplexRowVector::operator + (Complex s) const +ComplexRowVector::operator + (const Complex& s) const { return ComplexRowVector (add (data, len, s), len); } ComplexRowVector -ComplexRowVector::operator - (Complex s) const +ComplexRowVector::operator - (const Complex& s) const { return ComplexRowVector (subtract (data, len, s), len); } ComplexRowVector -ComplexRowVector::operator * (Complex s) const +ComplexRowVector::operator * (const Complex& s) const { return ComplexRowVector (multiply (data, len, s), len); } ComplexRowVector -ComplexRowVector::operator / (Complex s) const +ComplexRowVector::operator / (const Complex& s) const { return ComplexRowVector (divide (data, len, s), len); } @@ -937,25 +937,25 @@ } ComplexRowVector -operator + (Complex s, const ComplexRowVector& a) +operator + (const Complex& s, const ComplexRowVector& a) { return ComplexRowVector (add (a.data, a.len, s), a.len); } ComplexRowVector -operator - (Complex s, const ComplexRowVector& a) +operator - (const Complex& s, const ComplexRowVector& a) { return ComplexRowVector (subtract (s, a.data, a.len), a.len); } ComplexRowVector -operator * (Complex s, const ComplexRowVector& a) +operator * (const Complex& s, const ComplexRowVector& a) { return ComplexRowVector (multiply (a.data, a.len, s), a.len); } ComplexRowVector -operator / (Complex s, const ComplexRowVector& a) +operator / (const Complex& s, const ComplexRowVector& a) { return ComplexRowVector (divide (s, a.data, a.len), a.len); }
--- a/src/pt-const.cc +++ b/src/pt-const.cc @@ -84,7 +84,7 @@ type_tag = scalar_constant; } -tree_constant_rep::tree_constant_rep (Matrix& m) +tree_constant_rep::tree_constant_rep (const Matrix& m) { if (m.rows () == 1 && m.columns () == 1) { @@ -98,7 +98,7 @@ } } -tree_constant_rep::tree_constant_rep (DiagMatrix& d) +tree_constant_rep::tree_constant_rep (const DiagMatrix& d) { if (d.rows () == 1 && d.columns () == 1) { @@ -112,7 +112,7 @@ } } -tree_constant_rep::tree_constant_rep (RowVector& v) +tree_constant_rep::tree_constant_rep (const RowVector& v) { int len = v.capacity (); if (len == 1) @@ -141,7 +141,7 @@ } } -tree_constant_rep::tree_constant_rep (RowVector& v, int prefer_column_vector) +tree_constant_rep::tree_constant_rep (const RowVector& v, int prefer_column_vector) { int len = v.capacity (); if (len == 1) @@ -170,7 +170,7 @@ } } -tree_constant_rep::tree_constant_rep (ColumnVector& v) +tree_constant_rep::tree_constant_rep (const ColumnVector& v) { int len = v.capacity (); if (len == 1) @@ -199,7 +199,7 @@ } } -tree_constant_rep::tree_constant_rep (ColumnVector& v, +tree_constant_rep::tree_constant_rep (const ColumnVector& v, int prefer_column_vector) { int len = v.capacity (); @@ -229,13 +229,13 @@ } } -tree_constant_rep::tree_constant_rep (Complex c) +tree_constant_rep::tree_constant_rep (const Complex& c) { complex_scalar = new Complex (c); type_tag = complex_scalar_constant; } -tree_constant_rep::tree_constant_rep (ComplexRowVector& v) +tree_constant_rep::tree_constant_rep (const ComplexRowVector& v) { int len = v.capacity (); if (len == 1) @@ -264,7 +264,7 @@ } } -tree_constant_rep::tree_constant_rep (ComplexMatrix& m) +tree_constant_rep::tree_constant_rep (const ComplexMatrix& m) { if (m.rows () == 1 && m.columns () == 1) { @@ -278,7 +278,7 @@ } } -tree_constant_rep::tree_constant_rep (ComplexDiagMatrix& d) +tree_constant_rep::tree_constant_rep (const ComplexDiagMatrix& d) { if (d.rows () == 1 && d.columns () == 1) { @@ -292,7 +292,7 @@ } } -tree_constant_rep::tree_constant_rep (ComplexRowVector& v, +tree_constant_rep::tree_constant_rep (const ComplexRowVector& v, int prefer_column_vector) { int len = v.capacity (); @@ -322,7 +322,7 @@ } } -tree_constant_rep::tree_constant_rep (ComplexColumnVector& v) +tree_constant_rep::tree_constant_rep (const ComplexColumnVector& v) { int len = v.capacity (); if (len == 1) @@ -351,7 +351,7 @@ } } -tree_constant_rep::tree_constant_rep (ComplexColumnVector& v, +tree_constant_rep::tree_constant_rep (const ComplexColumnVector& v, int prefer_column_vector) { int len = v.capacity (); @@ -387,7 +387,7 @@ type_tag = string_constant; } -tree_constant_rep::tree_constant_rep (String& s) +tree_constant_rep::tree_constant_rep (const String& s) { string = strsave (s); type_tag = string_constant; @@ -426,7 +426,7 @@ } } -tree_constant_rep::tree_constant_rep (Range& r) +tree_constant_rep::tree_constant_rep (const Range& r) { if (r.nelem () > 1) { @@ -454,7 +454,7 @@ type_tag = magic_colon; } -tree_constant_rep::tree_constant_rep (tree_constant_rep& t) +tree_constant_rep::tree_constant_rep (const tree_constant_rep& t) { type_tag = t.type_tag;
--- a/src/pt-const.h +++ b/src/pt-const.h @@ -235,30 +235,30 @@ tree_constant_rep (void); tree_constant_rep (double d); - tree_constant_rep (Matrix& m); - tree_constant_rep (DiagMatrix& d); - tree_constant_rep (RowVector& v); - tree_constant_rep (RowVector& v, int pcv); - tree_constant_rep (ColumnVector& v); - tree_constant_rep (ColumnVector& v, int pcv); + tree_constant_rep (const Matrix& m); + tree_constant_rep (const DiagMatrix& d); + tree_constant_rep (const RowVector& v); + tree_constant_rep (const RowVector& v, int pcv); + tree_constant_rep (const ColumnVector& v); + tree_constant_rep (const ColumnVector& v, int pcv); - tree_constant_rep (Complex c); - tree_constant_rep (ComplexMatrix& m); - tree_constant_rep (ComplexDiagMatrix& d); - tree_constant_rep (ComplexRowVector& v); - tree_constant_rep (ComplexRowVector& v, int pcv); - tree_constant_rep (ComplexColumnVector& v); - tree_constant_rep (ComplexColumnVector& v, int pcv); + tree_constant_rep (const Complex& c); + tree_constant_rep (const ComplexMatrix& m); + tree_constant_rep (const ComplexDiagMatrix& d); + tree_constant_rep (const ComplexRowVector& v); + tree_constant_rep (const ComplexRowVector& v, int pcv); + tree_constant_rep (const ComplexColumnVector& v); + tree_constant_rep (const ComplexColumnVector& v, int pcv); tree_constant_rep (const char *s); - tree_constant_rep (String& s); + tree_constant_rep (const String& s); tree_constant_rep (double base, double limit, double inc); - tree_constant_rep (Range& r); + tree_constant_rep (const Range& r); tree_constant_rep (tree_constant_rep::constant_type t); - tree_constant_rep (tree_constant_rep& t); + tree_constant_rep (const tree_constant_rep& t); ~tree_constant_rep (void); @@ -529,48 +529,48 @@ tree_constant (double d) { rep = new tree_constant_rep (d); rep->count = 1; } - tree_constant (Matrix& m) + tree_constant (const Matrix& m) { rep = new tree_constant_rep (m); rep->count = 1; } - tree_constant (DiagMatrix& d) + tree_constant (const DiagMatrix& d) { rep = new tree_constant_rep (d); rep->count = 1; } - tree_constant (RowVector& v) + tree_constant (const RowVector& v) { rep = new tree_constant_rep (v); rep->count = 1; } - tree_constant (RowVector& v, int pcv) + tree_constant (const RowVector& v, int pcv) { rep = new tree_constant_rep (v, pcv); rep->count = 1; } - tree_constant (ColumnVector& v) + tree_constant (const ColumnVector& v) { rep = new tree_constant_rep (v); rep->count = 1; } - tree_constant (ColumnVector& v, int pcv) + tree_constant (const ColumnVector& v, int pcv) { rep = new tree_constant_rep (v, pcv); rep->count = 1; } - tree_constant (Complex c) + tree_constant (const Complex& c) { rep = new tree_constant_rep (c); rep->count = 1; } - tree_constant (ComplexMatrix& m) + tree_constant (const ComplexMatrix& m) { rep = new tree_constant_rep (m); rep->count = 1; } - tree_constant (ComplexDiagMatrix& d) + tree_constant (const ComplexDiagMatrix& d) { rep = new tree_constant_rep (d); rep->count = 1; } - tree_constant (ComplexRowVector& v) + tree_constant (const ComplexRowVector& v) { rep = new tree_constant_rep (v); rep->count = 1; } - tree_constant (ComplexRowVector& v, int pcv) + tree_constant (const ComplexRowVector& v, int pcv) { rep = new tree_constant_rep (v, pcv); rep->count = 1; } - tree_constant (ComplexColumnVector& v) + tree_constant (const ComplexColumnVector& v) { rep = new tree_constant_rep (v); rep->count = 1; } - tree_constant (ComplexColumnVector& v, int pcv) + tree_constant (const ComplexColumnVector& v, int pcv) { rep = new tree_constant_rep (v, pcv); rep->count = 1; } tree_constant (const char *s) { rep = new tree_constant_rep (s); rep->count = 1; } - tree_constant (String& s) + tree_constant (const String& s) { rep = new tree_constant_rep (s); rep->count = 1; } tree_constant (double base, double limit, double inc) { rep = new tree_constant_rep (base, limit, inc); rep->count = 1; } - tree_constant (Range& r) + tree_constant (const Range& r) { rep = new tree_constant_rep (r); rep->count = 1; } tree_constant (tree_constant_rep::constant_type t) { rep = new tree_constant_rep (t); rep->count = 1; } - tree_constant (tree_constant& a) + tree_constant (const tree_constant& a) { rep = a.rep; rep->count++; } tree_constant (tree_constant_rep& r) { rep = &r; rep->count++; }