Mercurial > hg > octave-lyh
changeset 3580:2923f52d8fda
[project @ 2000-02-05 07:14:21 by jwe]
author | jwe |
---|---|
date | Sat, 05 Feb 2000 07:14:25 +0000 |
parents | 8a0571a2becc |
children | aa8f5aa90c25 |
files | liboctave/CDiagMatrix.cc liboctave/CDiagMatrix.h liboctave/CMatrix.cc liboctave/CMatrix.h liboctave/ChangeLog liboctave/MArray-defs.h liboctave/MDiagArray2.cc liboctave/MDiagArray2.h liboctave/dColVector.cc liboctave/dColVector.h liboctave/dDiagMatrix.cc liboctave/dDiagMatrix.h liboctave/dMatrix.cc liboctave/dMatrix.h liboctave/dRowVector.cc liboctave/dRowVector.h |
diffstat | 16 files changed, 113 insertions(+), 439 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/CDiagMatrix.cc +++ b/liboctave/CDiagMatrix.cc @@ -418,120 +418,6 @@ return *this; } -ComplexDiagMatrix& -ComplexDiagMatrix::operator -= (const DiagMatrix& a) -{ - int r = rows (); - int c = cols (); - - int a_nr = a.rows (); - int a_nc = a.cols (); - - if (r != a_nr || c != a_nc) - { - gripe_nonconformant ("operator -=", r, c, a_nr, a_nc); - return *this; - } - - if (r == 0 || c == 0) - return *this; - - Complex *d = fortran_vec (); // Ensures only one reference to my privates! - - subtract2 (d, a.data (), length ()); - return *this; -} - -ComplexDiagMatrix& -ComplexDiagMatrix::operator += (const ComplexDiagMatrix& a) -{ - int r = rows (); - int c = cols (); - - int a_nr = a.rows (); - int a_nc = a.cols (); - - if (r != a_nr || c != a_nc) - { - gripe_nonconformant ("operator +=", r, c, a_nr, a_nc); - return *this; - } - - if (r == 0 || c == 0) - return *this; - - Complex *d = fortran_vec (); // Ensures only one reference to my privates! - - add2 (d, a.data (), length ()); - return *this; -} - -ComplexDiagMatrix& -ComplexDiagMatrix::operator -= (const ComplexDiagMatrix& a) -{ - int r = rows (); - int c = cols (); - - int a_nr = a.rows (); - int a_nc = a.cols (); - - if (r != a_nr || c != a_nc) - { - gripe_nonconformant ("operator -=", r, c, a_nr, a_nc); - return *this; - } - - if (r == 0 || c == 0) - return *this; - - Complex *d = fortran_vec (); // Ensures only one reference to my privates! - - subtract2 (d, a.data (), length ()); - return *this; -} - -// diagonal matrix by diagonal matrix -> diagonal matrix operations - -ComplexDiagMatrix -operator * (const ComplexDiagMatrix& a, const ComplexDiagMatrix& b) -{ - int a_nr = a.rows (); - int a_nc = a.cols (); - - int b_nr = b.rows (); - int b_nc = b.cols (); - - if (a_nc != b_nr) - { - gripe_nonconformant ("operator *", a_nr, a_nc, b_nr, b_nc); - return ComplexDiagMatrix (); - } - - if (a_nr == 0 || a_nc == 0 || b_nc == 0) - return ComplexDiagMatrix (a_nr, a_nc, 0.0); - - ComplexDiagMatrix c (a_nr, b_nc); - - int len = a_nr < b_nc ? a_nr : b_nc; - - for (int i = 0; i < len; i++) - { - Complex a_element = a.elem (i, i); - Complex b_element = b.elem (i, i); - - if (a_element == 0.0 || b_element == 0.0) - c.elem (i, i) = 0.0; - else if (a_element == 1.0) - c.elem (i, i) = b_element; - else if (b_element == 1.0) - c.elem (i, i) = a_element; - else - c.elem (i, i) = a_element * b_element; - } - - return c; -} - ComplexDiagMatrix operator * (const ComplexDiagMatrix& a, const DiagMatrix& b) {
--- a/liboctave/CDiagMatrix.h +++ b/liboctave/CDiagMatrix.h @@ -103,9 +103,6 @@ ComplexDiagMatrix& operator += (const DiagMatrix& a); ComplexDiagMatrix& operator -= (const DiagMatrix& a); - ComplexDiagMatrix& operator += (const ComplexDiagMatrix& a); - ComplexDiagMatrix& operator -= (const ComplexDiagMatrix& a); - // other operations ComplexColumnVector diag (void) const; @@ -132,6 +129,8 @@ ComplexDiagMatrix operator * (const DiagMatrix& a, const ComplexDiagMatrix& b); +MDIAGARRAY2_FORWARD_DEFS (MDiagArray2, ComplexDiagMatrix, Complex) + #endif /*
--- a/liboctave/CMatrix.cc +++ b/liboctave/CMatrix.cc @@ -1961,54 +1961,6 @@ return *this; } -ComplexMatrix& -ComplexMatrix::operator += (const ComplexMatrix& a) -{ - int nr = rows (); - int nc = cols (); - - int a_nr = a.rows (); - int a_nc = a.cols (); - - if (nr != a_nr || nc != a_nc) - { - gripe_nonconformant ("operator +=", nr, nc, a_nr, a_nc); - return *this; - } - - if (nr == 0 || nc == 0) - return *this; - - Complex *d = fortran_vec (); // Ensures only one reference to my privates! - - add2 (d, a.data (), length ()); - return *this; -} - -ComplexMatrix& -ComplexMatrix::operator -= (const ComplexMatrix& a) -{ - int nr = rows (); - int nc = cols (); - - int a_nr = a.rows (); - int a_nc = a.cols (); - - if (nr != a_nr || nc != a_nc) - { - gripe_nonconformant ("operator -=", nr, nc, a_nr, a_nc); - return *this; - } - - if (nr == 0 || nc == 0) - return *this; - - Complex *d = fortran_vec (); // Ensures only one reference to my privates! - - subtract2 (d, a.data (), length ()); - return *this; -} - // unary operations boolMatrix
--- a/liboctave/CMatrix.h +++ b/liboctave/CMatrix.h @@ -196,9 +196,6 @@ ComplexMatrix& operator += (const Matrix& a); ComplexMatrix& operator -= (const Matrix& a); - ComplexMatrix& operator += (const ComplexMatrix& a); - ComplexMatrix& operator -= (const ComplexMatrix& a); - // unary operations boolMatrix operator ! (void) const;
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,8 @@ +2000-02-05 John W. Eaton <jwe@bevo.che.wisc.edu> + + * MArray-defs.h: More new macros to handle MDiagArray operators. + * dDiagMatrix.h, CDiagMatrix.h: Use the op-forwarding macros. + 2000-02-04 John W. Eaton <jwe@bevo.che.wisc.edu> * oct-rl-edit.c (octave_rl_set_event_hook): Take address of
--- a/liboctave/MArray-defs.h +++ b/liboctave/MArray-defs.h @@ -60,19 +60,16 @@ MARRAY_OP_ASSIGN_DECL (A_T, E_T, -=, PFX, LTGT, RHS_T); // Generate forward declarations for OP= operators. -#define MARRAY_OP_ASSIGN_FWD_DECLS(A_T) \ - MARRAY_OP_ASSIGN_DECLS (A_T, T, template <typename T>, , T) \ - MARRAY_OP_ASSIGN_DECLS (A_T, T, template <typename T>, , A_T<T>) \ +#define MARRAY_OP_ASSIGN_FWD_DECLS(A_T, RHS_T) \ + MARRAY_OP_ASSIGN_DECLS (A_T, T, template <typename T>, , RHS_T) // Generate friend declarations for the OP= operators. -#define MARRAY_OP_ASSIGN_FRIENDS(A_T) \ - MARRAY_OP_ASSIGN_DECLS (A_T, T, friend, <>, T) \ - MARRAY_OP_ASSIGN_DECLS (A_T, T, friend, <>, A_T<T>) +#define MARRAY_OP_ASSIGN_FRIENDS(A_T, RHS_T) \ + MARRAY_OP_ASSIGN_DECLS (A_T, T, friend, <>, RHS_T) // Instantiate the OP= operators. -#define MARRAY_OP_ASSIGN_DEFS(A_T, E_T) \ - MARRAY_OP_ASSIGN_DECLS (A_T, E_T, template, , E_T) \ - MARRAY_OP_ASSIGN_DECLS (A_T, E_T, template, , A_T<E_T>) +#define MARRAY_OP_ASSIGN_DEFS(A_T, E_T, RHS_T) \ + MARRAY_OP_ASSIGN_DECLS (A_T, E_T, template, , RHS_T) // A function that can be used to forward OP= operations from derived // classes back to us. @@ -144,24 +141,51 @@ MARRAY_BINOP_DECL (A_T, E_T, quotient, PFX, LTGT, A_T<E_T>, A_T<E_T>); \ MARRAY_BINOP_DECL (A_T, E_T, product, PFX, LTGT, A_T<E_T>, A_T<E_T>); +#define MDIAGARRAY2_DAS_BINOP_DECLS(A_T, E_T, PFX, LTGT, X_T, Y_T) \ + MARRAY_BINOP_DECL (A_T, E_T, operator *, PFX, LTGT, X_T, Y_T); \ + MARRAY_BINOP_DECL (A_T, E_T, operator /, PFX, LTGT, X_T, Y_T); + +#define MDIAGARRAY2_SDA_BINOP_DECLS(A_T, E_T, PFX, LTGT, X_T, Y_T) \ + MARRAY_BINOP_DECL (A_T, E_T, operator *, PFX, LTGT, X_T, Y_T); + +#define MDIAGARRAY2_DADA_BINOP_DECLS(A_T, E_T, PFX, LTGT) \ + MARRAY_BINOP_DECL (A_T, E_T, operator +, PFX, LTGT, A_T<E_T>, A_T<E_T>); \ + MARRAY_BINOP_DECL (A_T, E_T, operator -, PFX, LTGT, A_T<E_T>, A_T<E_T>); \ + MARRAY_BINOP_DECL (A_T, E_T, product, PFX, LTGT, A_T<E_T>, A_T<E_T>); + // Generate forward declarations for binary operators. #define MARRAY_BINOP_FWD_DECLS(A_T) \ MARRAY_BINOP_DECLS (A_T, T, template <typename T>, , A_T<T>, T) \ MARRAY_BINOP_DECLS (A_T, T, template <typename T>, , T, A_T<T>) \ MARRAY_AA_BINOP_DECLS (A_T, T, template <typename T>, ) +#define MDIAGARRAY2_BINOP_FWD_DECLS(A_T) \ + MDIAGARRAY2_DAS_BINOP_DECLS (A_T, T, template <typename T>, , A_T<T>, T) \ + MDIAGARRAY2_SDA_BINOP_DECLS (A_T, T, template <typename T>, , T, A_T<T>) \ + MDIAGARRAY2_DADA_BINOP_DECLS (A_T, T, template <typename T>, ) + // Generate friend declarations for the binary operators. #define MARRAY_BINOP_FRIENDS(A_T) \ MARRAY_BINOP_DECLS (A_T, T, friend, <>, A_T<T>, T) \ MARRAY_BINOP_DECLS (A_T, T, friend, <>, T, A_T<T>) \ MARRAY_AA_BINOP_DECLS (A_T, T, friend, <>) +#define MDIAGARRAY2_BINOP_FRIENDS(A_T) \ + MDIAGARRAY2_DAS_BINOP_DECLS (A_T, T, friend, <>, A_T<T>, T) \ + MDIAGARRAY2_SDA_BINOP_DECLS (A_T, T, friend, <>, T, A_T<T>) \ + MDIAGARRAY2_DADA_BINOP_DECLS (A_T, T, friend, <>) + // Instantiate the binary operators. #define MARRAY_BINOP_DEFS(A_T, E_T) \ MARRAY_BINOP_DECLS (A_T, E_T, template, , A_T<E_T>, E_T) \ MARRAY_BINOP_DECLS (A_T, E_T, template, , E_T, A_T<E_T>) \ MARRAY_AA_BINOP_DECLS (A_T, E_T, template, ) +#define MDIAGARRAY2_BINOP_DEFS(A_T, E_T) \ + MDIAGARRAY2_DAS_BINOP_DECLS (A_T, E_T, template, , A_T<E_T>, E_T) \ + MDIAGARRAY2_SDA_BINOP_DECLS (A_T, E_T, template, , E_T, A_T<E_T>) \ + MDIAGARRAY2_DADA_BINOP_DECLS (A_T, E_T, template, ) + // A function that can be used to forward binary operations from derived // classes back to us. #define MARRAY_BINOP_FWD_FCN(R, F, T, C_X, X_T, C_Y, Y_T) \ @@ -186,35 +210,70 @@ MARRAY_BINOP_FWD_FCN (R, product, T, C_X, X_T, C_Y, Y_T) \ MARRAY_BINOP_FWD_FCN (R, quotient, T, C_X, X_T, C_Y, Y_T) +#define MDIAGARRAY2_DAS_BINOP_FWD_DEFS(R, T, C_X, X_T, C_Y, Y_T) \ + MARRAY_BINOP_FWD_FCN (R, operator *, T, C_X, X_T, C_Y, Y_T) \ + MARRAY_BINOP_FWD_FCN (R, operator /, T, C_X, X_T, C_Y, Y_T) + +#define MDIAGARRAY2_SDA_BINOP_FWD_DEFS(R, T, C_X, X_T, C_Y, Y_T) \ + MARRAY_BINOP_FWD_FCN (R, operator *, T, C_X, X_T, C_Y, Y_T) + +#define MDIAGARRAY2_DADA_BINOP_FWD_DEFS(R, T, C_X, X_T, C_Y, Y_T) \ + MARRAY_BINOP_FWD_FCN (R, operator +, T, C_X, X_T, C_Y, Y_T) \ + MARRAY_BINOP_FWD_FCN (R, operator -, T, C_X, X_T, C_Y, Y_T) \ + MARRAY_BINOP_FWD_FCN (R, product, T, C_X, X_T, C_Y, Y_T) + // Forward declarations for the MArray operators. #define MARRAY_OPS_FORWARD_DECLS(A_T) \ template <class T> \ class A_T; \ \ - MARRAY_OP_ASSIGN_FWD_DECLS (A_T) \ + MARRAY_OP_ASSIGN_FWD_DECLS (A_T, T) \ + MARRAY_OP_ASSIGN_FWD_DECLS (A_T, A_T<T>) \ MARRAY_UNOP_FWD_DECLS (A_T) \ MARRAY_BINOP_FWD_DECLS (A_T) +#define MDIAGARRAY2_OPS_FORWARD_DECLS(A_T) \ + template <class T> \ + class A_T; \ + \ + MARRAY_OP_ASSIGN_FWD_DECLS (A_T, A_T<T>) \ + MARRAY_UNOP_FWD_DECLS (A_T) \ + MDIAGARRAY2_BINOP_FWD_DECLS (A_T) + // Friend declarations for the MArray operators. #define MARRAY_OPS_FRIEND_DECLS(A_T) \ - MARRAY_OP_ASSIGN_FRIENDS (A_T) \ + MARRAY_OP_ASSIGN_FRIENDS (A_T, T) \ + MARRAY_OP_ASSIGN_FRIENDS (A_T, A_T<T>) \ MARRAY_UNOP_FRIENDS (A_T) \ MARRAY_BINOP_FRIENDS (A_T) +#define MDIAGARRAY2_OPS_FRIEND_DECLS(A_T) \ + MARRAY_OP_ASSIGN_FRIENDS (A_T, A_T<T>) \ + MARRAY_UNOP_FRIENDS (A_T) \ + MDIAGARRAY2_BINOP_FRIENDS (A_T) + // The following macros are for external use. // Instantiate all the MArray friends for MArray element type T. #define INSTANTIATE_MARRAY_FRIENDS(T) \ MARRAY_OP_ASSIGN_DEFS (MArray, T) \ + MARRAY_OP_ASSIGN_DEFS (MArray, MArray<T>) \ MARRAY_UNOP_DEFS (MArray, T) \ MARRAY_BINOP_DEFS (MArray, T) // Instantiate all the MArray friends for MArray element type T. #define INSTANTIATE_MARRAY2_FRIENDS(T) \ - MARRAY_OP_ASSIGN_DEFS (MArray2, T) \ + MARRAY_OP_ASSIGN_DEFS (MArray2, T, T) \ + MARRAY_OP_ASSIGN_DEFS (MArray2, T, MArray2<T>) \ MARRAY_UNOP_DEFS (MArray2, T) \ MARRAY_BINOP_DEFS (MArray2, T) +// Instantiate all the MArray friends for MArray element type T. +#define INSTANTIATE_MDIAGARRAY2_FRIENDS(T) \ + MARRAY_OP_ASSIGN_DEFS (MArray2, T, MArray2<T>) \ + MARRAY_UNOP_DEFS (MArray2, T) \ + MDIAGARRAY2_BINOP_DEFS (MArray2, T) + // Define all the MArray forwarding functions for return type R and // MArray element type T #define MARRAY_FORWARD_DEFS(B, R, T) \ @@ -237,5 +296,22 @@ MARRAY_AA_BINOP_FWD_DEFS \ (R, T, dynamic_cast<const B<T>&>, R, dynamic_cast<const B<T>&>, R) +#define MDIAGARRAY2_FORWARD_DEFS(B, R, T) \ + MARRAY_OP_ASSIGN_FWD_DEFS \ + (R, T, \ + dynamic_cast<B<T>&>, R, dynamic_cast<const B<T>&>, R) \ + \ + MARRAY_UNOP_FWD_DEFS \ + (R, T, dynamic_cast<const B<T>&>, R) \ + \ + MDIAGARRAY2_DAS_BINOP_FWD_DEFS \ + (R, T, dynamic_cast<const B<T>&>, R, , T) \ + \ + MDIAGARRAY2_SDA_BINOP_FWD_DEFS \ + (R, T, , T, dynamic_cast<const B<T>&>, R) \ + \ + MDIAGARRAY2_DADA_BINOP_FWD_DEFS \ + (R, T, dynamic_cast<const B<T>&>, R, dynamic_cast<const B<T>&>, R) + // Now we have all the definitions we need.
--- a/liboctave/MDiagArray2.cc +++ b/liboctave/MDiagArray2.cc @@ -152,6 +152,13 @@ template <class T> MDiagArray2<T> +operator + (const MDiagArray2<T>& a) +{ + return a; +} + +template <class T> +MDiagArray2<T> operator - (const MDiagArray2<T>& a) { int l = a.length ();
--- a/liboctave/MDiagArray2.h +++ b/liboctave/MDiagArray2.h @@ -31,48 +31,13 @@ #include "DiagArray2.h" #include "MArray2.h" -#if defined (LTGT) -#undef LTGT -#endif - -#if !defined (CXX_NEW_FRIEND_TEMPLATE_DECL) -#define LTGT -#else +// Two dimensional diagonal array with math ops. -#define LTGT <> - -template <class T> -class MDiagArray2; - -template <typename T> MDiagArray2<T>& -operator += (MDiagArray2<T>& a, const MDiagArray2<T>& b); - -template <typename T> MDiagArray2<T>& -operator -= (MDiagArray2<T>& a, const MDiagArray2<T>& b); +// But first, some preprocessor abuse... -template <typename T> MDiagArray2<T> -operator * (const MDiagArray2<T>& a, const T& s); - -template <typename T> MDiagArray2<T> -operator / (const MDiagArray2<T>& a, const T& s); - -template <typename T> MDiagArray2<T> -operator * (const T& s, const MDiagArray2<T>& a); - -template <typename T> MDiagArray2<T> -operator + (const MDiagArray2<T>& a, const MDiagArray2<T>& b); +#include "MArray-defs.h" -template <typename T> MDiagArray2<T> -operator - (const MDiagArray2<T>& a, const MDiagArray2<T>& b); - -template <typename T> MDiagArray2<T> -product (const MDiagArray2<T>& a, const MDiagArray2<T>& b); - -template <typename T> MDiagArray2<T> -operator - (const MDiagArray2<T>& a); -#endif - -// Two dimensional diagonal array with math ops. +MDIAGARRAY2_OPS_FORWARD_DECLS (MDiagArray2) template <class T> class MDiagArray2 : public DiagArray2<T> @@ -109,20 +74,13 @@ return retval; } -}; -#undef LTGT + // Currently, the OPS functions don't need to be friends, but that + // may change. -#define INSTANTIATE_MDIAGARRAY_FRIENDS(T) \ - template MDiagArray2<T>& operator += (MDiagArray2<T>& a, const MDiagArray2<T>& b); \ - template MDiagArray2<T>& operator -= (MDiagArray2<T>& a, const MDiagArray2<T>& b); \ - template MDiagArray2<T> operator * (const MDiagArray2<T>& a, const T& s); \ - template MDiagArray2<T> operator / (const MDiagArray2<T>& a, const T& s); \ - template MDiagArray2<T> operator * (const T& s, const MDiagArray2<T>& a); \ - template MDiagArray2<T> operator + (const MDiagArray2<T>& a, const MDiagArray2<T>& b); \ - template MDiagArray2<T> operator - (const MDiagArray2<T>& a, const MDiagArray2<T>& b); \ - template MDiagArray2<T> product (const MDiagArray2<T>& a, const MDiagArray2<T>& b); \ - template MDiagArray2<T> operator - (const MDiagArray2<T>& a); + MDIAGARRAY2_OPS_FRIEND_DECLS (MDiagArray2) + +}; #endif
--- a/liboctave/dColVector.cc +++ b/liboctave/dColVector.cc @@ -163,52 +163,6 @@ return result; } -// column vector by column vector -> column vector operations - -ColumnVector& -ColumnVector::operator += (const ColumnVector& a) -{ - int len = length (); - - int a_len = a.length (); - - if (len != a_len) - { - gripe_nonconformant ("operator +=", len, a_len); - return *this; - } - - if (len == 0) - return *this; - - double *d = fortran_vec (); // Ensures only one reference to my privates! - - add2 (d, a.data (), len); - return *this; -} - -ColumnVector& -ColumnVector::operator -= (const ColumnVector& a) -{ - int len = length (); - - int a_len = a.length (); - - if (len != a_len) - { - gripe_nonconformant ("operator -=", len, a_len); - return *this; - } - - if (len == 0) - return *this; - - double *d = fortran_vec (); // Ensures only one reference to my privates! - - subtract2 (d, a.data (), len); - return *this; -} - // matrix by column vector -> column vector operations ColumnVector
--- a/liboctave/dColVector.h +++ b/liboctave/dColVector.h @@ -68,11 +68,6 @@ ColumnVector extract (int r1, int r2) const; - // column vector by column vector -> column vector operations - - ColumnVector& operator += (const ColumnVector& a); - ColumnVector& operator -= (const ColumnVector& a); - // matrix by column vector -> column vector operations friend ColumnVector operator * (const Matrix& a, const ColumnVector& b);
--- a/liboctave/dDiagMatrix.cc +++ b/liboctave/dDiagMatrix.cc @@ -304,54 +304,6 @@ // diagonal matrix by diagonal matrix -> diagonal matrix operations -DiagMatrix& -DiagMatrix::operator += (const DiagMatrix& a) -{ - int r = rows (); - int c = cols (); - - int a_nr = a.rows (); - int a_nc = a.cols (); - - if (r != a_nr || c != a_nc) - { - gripe_nonconformant ("operator +=", r, c, a_nr, a_nc); - return *this; - } - - if (c == 0 || r == 0) - return *this; - - double *d = fortran_vec (); // Ensures only one reference to my privates! - - add2 (d, a.data (), length ()); - return *this; -} - -DiagMatrix& -DiagMatrix::operator -= (const DiagMatrix& a) -{ - int r = rows (); - int c = cols (); - - int a_nr = a.rows (); - int a_nc = a.cols (); - - if (r != a_nr || c != a_nc) - { - gripe_nonconformant ("operator -=", r, c, a_nr, a_nc); - return *this; - } - - if (r == 0 || c == 0) - return *this; - - double *d = fortran_vec (); // Ensures only one reference to my privates! - - subtract2 (d, a.data (), length ()); - return *this; -} - // diagonal matrix by diagonal matrix -> diagonal matrix operations DiagMatrix
--- a/liboctave/dDiagMatrix.h +++ b/liboctave/dDiagMatrix.h @@ -85,11 +85,6 @@ DiagMatrix inverse (void) const; DiagMatrix inverse (int& info) const; - // diagonal matrix by diagonal matrix -> diagonal matrix operations - - DiagMatrix& operator += (const DiagMatrix& a); - DiagMatrix& operator -= (const DiagMatrix& a); - // other operations ColumnVector diag (void) const; @@ -109,6 +104,8 @@ DiagMatrix operator * (const DiagMatrix& a, const DiagMatrix& b); +MDIAGARRAY2_FORWARD_DEFS (MDiagArray2, DiagMatrix, double) + #endif /*
--- a/liboctave/dMatrix.cc +++ b/liboctave/dMatrix.cc @@ -1536,56 +1536,6 @@ } Matrix& -Matrix::operator += (const Matrix& a) -{ - int nr = rows (); - int nc = cols (); - - int a_nr = a.rows (); - int a_nc = a.cols (); - - if (nr != a_nr || nc != a_nc) - { - gripe_nonconformant ("operator +=", nr, nc, a_nr, a_nc); - return *this; - } - - if (nr == 0 || nc == 0) - return *this; - - double *d = fortran_vec (); // Ensures only one reference to my privates! - - add2 (d, a.data (), length ()); - - return *this; -} - -Matrix& -Matrix::operator -= (const Matrix& a) -{ - int nr = rows (); - int nc = cols (); - - int a_nr = a.rows (); - int a_nc = a.cols (); - - if (nr != a_nr || nc != a_nc) - { - gripe_nonconformant ("operator -=", nr, nc, a_nr, a_nc); - return *this; - } - - if (nr == 0 || nc == 0) - return *this; - - double *d = fortran_vec (); // Ensures only one reference to my privates! - - subtract2 (d, a.data (), length ()); - - return *this; -} - -Matrix& Matrix::operator += (const DiagMatrix& a) { int nr = rows ();
--- a/liboctave/dMatrix.h +++ b/liboctave/dMatrix.h @@ -165,9 +165,6 @@ Matrix expm (void) const; - Matrix& operator += (const Matrix& a); - Matrix& operator -= (const Matrix& a); - Matrix& operator += (const DiagMatrix& a); Matrix& operator -= (const DiagMatrix& a);
--- a/liboctave/dRowVector.cc +++ b/liboctave/dRowVector.cc @@ -164,52 +164,6 @@ return result; } -// row vector by row vector -> row vector operations - -RowVector& -RowVector::operator += (const RowVector& a) -{ - int len = length (); - - int a_len = a.length (); - - if (len != a_len) - { - gripe_nonconformant ("operator +=", len, a_len); - return *this; - } - - if (len == 0) - return *this; - - double *d = fortran_vec (); // Ensures only one reference to my privates! - - add2 (d, a.data (), len); - return *this; -} - -RowVector& -RowVector::operator -= (const RowVector& a) -{ - int len = length (); - - int a_len = a.length (); - - if (len != a_len) - { - gripe_nonconformant ("operator -=", len, a_len); - return *this; - } - - if (len == 0) - return *this; - - double *d = fortran_vec (); // Ensures only one reference to my privates! - - subtract2 (d, a.data (), len); - return *this; -} - // row vector by matrix -> row vector RowVector
--- a/liboctave/dRowVector.h +++ b/liboctave/dRowVector.h @@ -68,11 +68,6 @@ RowVector extract (int c1, int c2) const; - // row vector by row vector -> row vector operations - - RowVector& operator += (const RowVector& a); - RowVector& operator -= (const RowVector& a); - // row vector by matrix -> row vector friend RowVector operator * (const RowVector& a, const Matrix& b);