Mercurial > hg > octave-avbm
changeset 3582:a93683ccc9ba
[project @ 2000-02-05 10:00:49 by jwe]
author | jwe |
---|---|
date | Sat, 05 Feb 2000 10:00:51 +0000 |
parents | aa8f5aa90c25 |
children | 78827ee3508f |
files | liboctave/CColVector.cc liboctave/CColVector.h liboctave/CRowVector.cc liboctave/CRowVector.h liboctave/ChangeLog liboctave/MArray-C.cc liboctave/MArray-ch.cc liboctave/MArray-d.cc liboctave/MArray-i.cc liboctave/MArray-s.cc liboctave/Makefile.in liboctave/mx-op-defs.h |
diffstat | 12 files changed, 44 insertions(+), 307 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/CColVector.cc +++ b/liboctave/CColVector.cc @@ -270,122 +270,6 @@ return *this; } -// column vector by scalar -> column vector operations - -ComplexColumnVector -operator + (const ComplexColumnVector& v, double s) -{ - int len = v.length (); - return ComplexColumnVector (add (v.data (), len, s), len); -} - -ComplexColumnVector -operator - (const ComplexColumnVector& v, double s) -{ - int len = v.length (); - return ComplexColumnVector (subtract (v.data (), len, s), len); -} - -ComplexColumnVector -operator * (const ComplexColumnVector& v, double s) -{ - int len = v.length (); - return ComplexColumnVector (multiply (v.data (), len, s), len); -} - -ComplexColumnVector -operator / (const ComplexColumnVector& v, double s) -{ - int len = v.length (); - return ComplexColumnVector (divide (v.data (), len, s), len); -} - -ComplexColumnVector -operator + (const ColumnVector& a, const Complex& s) -{ - int len = a.length (); - return ComplexColumnVector (add (a.data (), len, s), len); -} - -ComplexColumnVector -operator - (const ColumnVector& a, const Complex& s) -{ - int len = a.length (); - return ComplexColumnVector (subtract (a.data (), len, s), len); -} - -ComplexColumnVector -operator * (const ColumnVector& a, const Complex& s) -{ - int len = a.length (); - return ComplexColumnVector (multiply (a.data (), len, s), len); -} - -ComplexColumnVector -operator / (const ColumnVector& a, const Complex& s) -{ - int len = a.length (); - return ComplexColumnVector (divide (a.data (), len, s), len); -} - -// scalar by column vector -> column vector operations - -ComplexColumnVector -operator + (double s, const ComplexColumnVector& a) -{ - int a_len = a.length (); - return ComplexColumnVector (add (a.data (), a_len, s), a_len); -} - -ComplexColumnVector -operator - (double s, const ComplexColumnVector& a) -{ - int a_len = a.length (); - return ComplexColumnVector (subtract (s, a.data (), a_len), a_len); -} - -ComplexColumnVector -operator * (double s, const ComplexColumnVector& a) -{ - int a_len = a.length (); - return ComplexColumnVector (multiply (a.data (), a_len, s), a_len); -} - -ComplexColumnVector -operator / (double s, const ComplexColumnVector& a) -{ - int a_len = a.length (); - return ComplexColumnVector (divide (s, a.data (), a_len), a_len); -} - -ComplexColumnVector -operator + (const Complex& s, const ColumnVector& a) -{ - int a_len = a.length (); - return ComplexColumnVector (add (a.data (), a_len, s), a_len); -} - -ComplexColumnVector -operator - (const Complex& s, const ColumnVector& a) -{ - int a_len = a.length (); - return ComplexColumnVector (subtract (s, a.data (), a_len), a_len); -} - -ComplexColumnVector -operator * (const Complex& s, const ColumnVector& a) -{ - int a_len = a.length (); - return ComplexColumnVector (multiply (a.data (), a_len, s), a_len); -} - -ComplexColumnVector -operator / (const Complex& s, const ColumnVector& a) -{ - int a_len = a.length (); - return ComplexColumnVector (divide (s, a.data (), a_len), a_len); -} - // matrix by column vector -> column vector operations ComplexColumnVector
--- a/liboctave/CColVector.h +++ b/liboctave/CColVector.h @@ -81,46 +81,6 @@ ComplexColumnVector& operator += (const ColumnVector& a); ComplexColumnVector& operator -= (const ColumnVector& a); - // column vector by scalar -> column vector operations - - friend ComplexColumnVector operator + (const ComplexColumnVector& a, - double s); - friend ComplexColumnVector operator - (const ComplexColumnVector& a, - double s); - friend ComplexColumnVector operator * (const ComplexColumnVector& a, - double s); - friend ComplexColumnVector operator / (const ComplexColumnVector& a, - double s); - - friend ComplexColumnVector operator + (const ColumnVector& a, - const Complex& s); - friend ComplexColumnVector operator - (const ColumnVector& a, - const Complex& s); - friend ComplexColumnVector operator * (const ColumnVector& a, - const Complex& s); - friend ComplexColumnVector operator / (const ColumnVector& a, - const Complex& s); - - // scalar by column vector -> column vector operations - - friend ComplexColumnVector operator + (double s, - const ComplexColumnVector& a); - friend ComplexColumnVector operator - (double s, - const ComplexColumnVector& a); - friend ComplexColumnVector operator * (double s, - const ComplexColumnVector& a); - friend ComplexColumnVector operator / (double s, - const ComplexColumnVector& a); - - friend ComplexColumnVector operator + (const Complex& s, - const ColumnVector& a); - friend ComplexColumnVector operator - (const Complex& s, - const ColumnVector& a); - friend ComplexColumnVector operator * (const Complex& s, - const ColumnVector& a); - friend ComplexColumnVector operator / (const Complex& s, - const ColumnVector& a); - // matrix by column vector -> column vector operations friend ComplexColumnVector operator * (const ComplexMatrix& a,
--- a/liboctave/CRowVector.cc +++ b/liboctave/CRowVector.cc @@ -270,122 +270,6 @@ return *this; } -// row vector by scalar -> row vector operations - -ComplexRowVector -operator + (const ComplexRowVector& v, double s) -{ - int len = v.length (); - return ComplexRowVector (add (v.data (), len, s), len); -} - -ComplexRowVector -operator - (const ComplexRowVector& v, double s) -{ - int len = v.length (); - return ComplexRowVector (subtract (v.data (), len, s), len); -} - -ComplexRowVector -operator * (const ComplexRowVector& v, double s) -{ - int len = v.length (); - return ComplexRowVector (multiply (v.data (), len, s), len); -} - -ComplexRowVector -operator / (const ComplexRowVector& v, double s) -{ - int len = v.length (); - return ComplexRowVector (divide (v.data (), len, s), len); -} - -ComplexRowVector -operator + (const RowVector& v, const Complex& s) -{ - int len = v.length (); - return ComplexRowVector (add (v.data (), len, s), len); -} - -ComplexRowVector -operator - (const RowVector& v, const Complex& s) -{ - int len = v.length (); - return ComplexRowVector (subtract (v.data (), len, s), len); -} - -ComplexRowVector -operator * (const RowVector& v, const Complex& s) -{ - int len = v.length (); - return ComplexRowVector (multiply (v.data (), len, s), len); -} - -ComplexRowVector -operator / (const RowVector& v, const Complex& s) -{ - int len = v.length (); - return ComplexRowVector (divide (v.data (), len, s), len); -} - -// scalar by row vector -> row vector operations - -ComplexRowVector -operator + (double s, const ComplexRowVector& a) -{ - int a_len = a.length (); - return ComplexRowVector (add (a.data (), a_len, s), a_len); -} - -ComplexRowVector -operator - (double s, const ComplexRowVector& a) -{ - int a_len = a.length (); - return ComplexRowVector (subtract (s, a.data (), a_len), a_len); -} - -ComplexRowVector -operator * (double s, const ComplexRowVector& a) -{ - int a_len = a.length (); - return ComplexRowVector (multiply (a.data (), a_len, s), a_len); -} - -ComplexRowVector -operator / (double s, const ComplexRowVector& a) -{ - int a_len = a.length (); - return ComplexRowVector (divide (s, a.data (), a_len), a_len); -} - -ComplexRowVector -operator + (const Complex& s, const RowVector& a) -{ - int a_len = a.length (); - return ComplexRowVector (add (a.data (), a_len, s), a_len); -} - -ComplexRowVector -operator - (const Complex& s, const RowVector& a) -{ - int a_len = a.length (); - return ComplexRowVector (subtract (s, a.data (), a_len), a_len); -} - -ComplexRowVector -operator * (const Complex& s, const RowVector& a) -{ - int a_len = a.length (); - return ComplexRowVector (multiply (a.data (), a_len, s), a_len); -} - -ComplexRowVector -operator / (const Complex& s, const RowVector& a) -{ - int a_len = a.length (); - return ComplexRowVector (divide (s, a.data (), a_len), a_len); -} - // row vector by matrix -> row vector ComplexRowVector
--- a/liboctave/CRowVector.h +++ b/liboctave/CRowVector.h @@ -80,30 +80,6 @@ ComplexRowVector& operator += (const RowVector& a); ComplexRowVector& operator -= (const RowVector& a); - // row vector by scalar -> row vector operations - - friend ComplexRowVector operator + (const ComplexRowVector& a, double s); - friend ComplexRowVector operator - (const ComplexRowVector& a, double s); - friend ComplexRowVector operator * (const ComplexRowVector& a, double s); - friend ComplexRowVector operator / (const ComplexRowVector& a, double s); - - friend ComplexRowVector operator + (const RowVector& a, const Complex& s); - friend ComplexRowVector operator - (const RowVector& a, const Complex& s); - friend ComplexRowVector operator * (const RowVector& a, const Complex& s); - friend ComplexRowVector operator / (const RowVector& a, const Complex& s); - - // scalar by row vector -> row vector operations - - friend ComplexRowVector operator + (double s, const ComplexRowVector& a); - friend ComplexRowVector operator - (double s, const ComplexRowVector& a); - friend ComplexRowVector operator * (double s, const ComplexRowVector& a); - friend ComplexRowVector operator / (double s, const ComplexRowVector& a); - - friend ComplexRowVector operator + (const Complex& s, const RowVector& a); - friend ComplexRowVector operator - (const Complex& s, const RowVector& a); - friend ComplexRowVector operator * (const Complex& s, const RowVector& a); - friend ComplexRowVector operator / (const Complex& s, const RowVector& a); - // row vector by matrix -> row vector friend ComplexRowVector operator * (const ComplexRowVector& a,
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,5 +1,19 @@ 2000-02-05 John W. Eaton <jwe@bevo.che.wisc.edu> + * vx-rv-crv.h, vx-cv-ccv.h, vx-crv-rv.h, vx-ccv-cv.h, + vx-rv-crv.cc, vx-cv-ccv.cc, vx-crv-rv.cc, vx-ccv-cv.cc: + More new files. + * Makefile.in: Add them to the appropriate lists. + + * vx-ccv-s.h, vx-crv-s.h, vx-cs-cv.h, vx-cs-rv.h, vx-cv-cs.h, + vx-rv-cs.h, vx-s-ccv.h, vx-s-crv.h, vx-ccv-s.cc, vx-crv-s.cc, + vx-cs-cv.cc, vx-cs-rv.cc, vx-cv-cs.cc, vx-rv-cs.cc, vx-s-ccv.cc, + vx-s-crv.cc:, New files. + * Makefile.in: Add them to the appropriate lists. + + * CRowVector.h, CRowVector.cc, CColVector.h, CColVector.cc: + Delete scalar by vector and vector by scalar binary ops. + * MArray-defs.h: More new macros to handle MDiagArray operators. * dDiagMatrix.h, CDiagMatrix.h: Use the op-forwarding macros.
--- a/liboctave/MArray-C.cc +++ b/liboctave/MArray-C.cc @@ -47,7 +47,7 @@ template class MDiagArray2<Complex>; -INSTANTIATE_MDIAGARRAY_FRIENDS (Complex) +INSTANTIATE_MDIAGARRAY2_FRIENDS (Complex) /* ;;; Local Variables: ***
--- a/liboctave/MArray-ch.cc +++ b/liboctave/MArray-ch.cc @@ -45,7 +45,7 @@ template class MDiagArray2<char>; -INSTANTIATE_MDIAGARRAY_FRIENDS (char) +INSTANTIATE_MDIAGARRAY2_FRIENDS (char) /* ;;; Local Variables: ***
--- a/liboctave/MArray-d.cc +++ b/liboctave/MArray-d.cc @@ -45,7 +45,7 @@ template class MDiagArray2<double>; -INSTANTIATE_MDIAGARRAY_FRIENDS (double) +INSTANTIATE_MDIAGARRAY2_FRIENDS (double) /* ;;; Local Variables: ***
--- a/liboctave/MArray-i.cc +++ b/liboctave/MArray-i.cc @@ -45,7 +45,7 @@ template class MDiagArray2<int>; -INSTANTIATE_MDIAGARRAY_FRIENDS (int) +INSTANTIATE_MDIAGARRAY2_FRIENDS (int) /* ;;; Local Variables: ***
--- a/liboctave/MArray-s.cc +++ b/liboctave/MArray-s.cc @@ -45,7 +45,7 @@ template class MDiagArray2<short>; -INSTANTIATE_MDIAGARRAY_FRIENDS (short) +INSTANTIATE_MDIAGARRAY2_FRIENDS (short) /* ;;; Local Variables: ***
--- a/liboctave/Makefile.in +++ b/liboctave/Makefile.in @@ -40,6 +40,10 @@ mx-dm-cs.h mx-dm-m.h mx-dm-s.h mx-m-cdm.h mx-m-cm.h \ mx-m-cs.h mx-m-dm.h mx-s-cdm.h mx-s-cm.h mx-s-dm.h +VX_OP_INC := vx-ccv-s.h vx-crv-s.h vx-cs-cv.h vx-cs-rv.h vx-cv-cs.h \ + vx-rv-cs.h vx-s-ccv.h vx-s-crv.h \ + vx-rv-crv.h vx-cv-ccv.h vx-crv-rv.h vx-ccv-cv.h + INCLUDES := Bounds.h CollocWt.h DAE.h DAEFunc.h DASSL.h FEGrid.h \ LinConst.h LP.h LPsolve.h LSODE.h NLConst.h NLEqn.h NLFunc.h \ NLP.h ODE.h ODEFunc.h Objective.h QP.h Quad.h Range.h base-de.h \ @@ -52,7 +56,8 @@ pathsearch.h prog-args.h statdefs.h str-vec.h sun-utils.h \ sysdir.h systime.h syswait.h \ $(MATRIX_INC) \ - $(MX_OP_INC) + $(MX_OP_INC) \ + $(VX_OP_INC) TEMPLATE_SRC := Array.cc Array2.cc Array3.cc DiagArray2.cc \ MArray.cc MArray2.cc MDiagArray2.cc base-lu.cc @@ -75,6 +80,10 @@ mx-dm-cs.cc mx-dm-m.cc mx-dm-s.cc mx-m-cdm.cc mx-m-cm.cc \ mx-m-cs.cc mx-m-dm.cc mx-s-cdm.cc mx-s-cm.cc mx-s-dm.cc +VX_OP_SRC := vx-ccv-s.cc vx-crv-s.cc vx-cs-cv.cc vx-cs-rv.cc vx-cv-cs.cc \ + vx-rv-cs.cc vx-s-ccv.cc vx-s-crv.cc \ + vx-rv-crv.cc vx-cv-ccv.cc vx-crv-rv.cc vx-ccv-cv.cc + SOURCES := Bounds.cc CollocWt.cc DAE.cc DASSL.cc FEGrid.cc LinConst.cc \ LPsolve.cc LSODE.cc NLEqn.cc Quad.cc Range.cc cmd-edit.cc \ cmd-hist.cc data-conv.cc dir-ops.cc f2c-main.c file-ops.cc \ @@ -88,7 +97,8 @@ $(TEMPLATE_SRC) \ $(TI_SRC) \ $(MATRIX_SRC) \ - $(MX_OP_SRC) + $(MX_OP_SRC) \ + $(VX_OP_SRC) EXTRAS := mx-inlines.cc
--- a/liboctave/mx-op-defs.h +++ b/liboctave/mx-op-defs.h @@ -56,7 +56,7 @@ \ R r (len); \ \ - for (size_t i = 0; i < len; i++) \ + for (int i = 0; i < len; i++) \ r.elem(i) = v.elem(i) OP s; \ \ return r; \ @@ -68,6 +68,9 @@ VS_BIN_OP (R, operator *, *, V, S) \ VS_BIN_OP (R, operator /, /, V, S) +#define VS_OP_DECLS(R, V, S) \ + VS_BIN_OP_DECLS(R, V, S) + // scalar by vector by operations. #define SV_BIN_OP_DECLS(R, S, V) \ @@ -84,7 +87,7 @@ \ R r (len); \ \ - for (size_t i = 0; i < len; i++) \ + for (int i = 0; i < len; i++) \ r.elem(i) = s OP v.elem(i); \ \ return r; \ @@ -96,6 +99,9 @@ SV_BIN_OP (R, operator *, *, S, V) \ SV_BIN_OP (R, operator /, /, S, V) +#define SV_OP_DECLS(R, S, V) \ + SV_BIN_OP_DECLS(R, S, V) + // vector by vector operations. #define VV_BIN_OP_DECLS(R, V1, V2) \ @@ -119,7 +125,7 @@ { \ r.resize (v1_len); \ \ - for (size_t i = 0; i < v1_len; i++) \ + for (int i = 0; i < v1_len; i++) \ r.elem(i) = v1.elem(i) OP v2.elem(i); \ } \ \ @@ -132,7 +138,8 @@ VV_BIN_OP (R, product, *, V1, V2) \ VV_BIN_OP (R, quotient, /, V1, V2) -#endif +#define VV_OP_DECLS(R, V1, V2) \ + VV_BIN_OP_DECLS(R, V1, V2) // matrix by scalar operations. @@ -750,6 +757,8 @@ #define DMDM_OP_DECLS(R, DM1, DM2) \ DMDM_BIN_OP_DECLS (R, DM1, DM2) +#endif + /* ;;; Local Variables: *** ;;; mode: C++ ***