# HG changeset patch # User jordigh # Date 1329948453 0 # Node ID d84d2fea3c90c60694d9dd5f6074db941d4c0161 # Parent 954f2f00d7829f0d180a598e2fd774cd19e44f8a Re-enable compilation of fixed package diff -r 954f2f00d782 -r d84d2fea3c90 main/fixed/doc/Makefile --- a/main/fixed/doc/Makefile Wed Feb 22 21:56:05 2012 +0000 +++ b/main/fixed/doc/Makefile Wed Feb 22 22:07:33 2012 +0000 @@ -5,7 +5,7 @@ MKDOC = ../../../admin/mkdoc MKTEXI = ../../../admin/mktexi MAKEINFO = makeinfo --no-split -TEXI2PDF = texi2ppf --clean +TEXI2PDF = texi2pdf --clean DVIPS = dvips LN_S = ln -s endif diff -r 954f2f00d782 -r d84d2fea3c90 main/fixed/src/Array-f.cc --- a/main/fixed/src/Array-f.cc Wed Feb 22 21:56:05 2012 +0000 +++ b/main/fixed/src/Array-f.cc Wed Feb 22 22:07:33 2012 +0000 @@ -29,6 +29,30 @@ //#include "fixedMatrix.h" //#include "fixedCMatrix.h" +inline FixedPoint +xmin (const FixedPoint& x, const FixedPoint& y) +{ + return x <= y ? x : y; +} + +inline FixedPoint +xmax (const FixedPoint& x, const FixedPoint& y) +{ + return x >= y ? x : y; +} + +inline FixedPointComplex +xmin (const FixedPointComplex& x, const FixedPointComplex& y) +{ + return x <= y ? x : y; +} + +inline FixedPointComplex +xmax (const FixedPointComplex& x, const FixedPointComplex& y) +{ + return x >= y ? x : y; +} + #include #include #include @@ -50,38 +74,13 @@ (arg (a) > arg (b)))); } -INSTANTIATE_ARRAY(FixedPoint, OCTAVE_FIXED_API); +INSTANTIATE_ARRAY (FixedPoint, ); template class MArray; -INSTANTIATE_ARRAY(FixedPointComplex, OCTAVE_FIXED_API); -template class MArray; - INSTANTIATE_MARRAY_FRIENDS (FixedPoint, ) -INSTANTIATE_MARRAY_FRIENDS (FixedPointComplex, ) - -#include -#include -#include -template class Array2; -template class MArray2; -template class Array2; -template class MArray2; - -INSTANTIATE_MARRAY2_FRIENDS (FixedPoint, OCTAVE_FIXED_API) -INSTANTIATE_MARRAY2_FRIENDS (FixedPointComplex, OCTAVE_FIXED_API) - -#include -#include -#include -#include - -template class ArrayN; -template class MArrayN; -template class ArrayN; -template class MArrayN; - -INSTANTIATE_MARRAYN_FRIENDS (FixedPoint, ) -INSTANTIATE_MARRAYN_FRIENDS (FixedPointComplex, ) +INSTANTIATE_ARRAY (FixedPointComplex, ); +template class MArray; +INSTANTIATE_MARRAY_FRIENDS (FixedPointComplex, ) /* ;;; Local Variables: *** diff -r 954f2f00d782 -r d84d2fea3c90 main/fixed/src/Makefile --- a/main/fixed/src/Makefile Wed Feb 22 21:56:05 2012 +0000 +++ b/main/fixed/src/Makefile Wed Feb 22 22:07:33 2012 +0000 @@ -27,8 +27,8 @@ op-fcs-fs.cc op-fcs-fm.cc op-fcm-fs.cc op-fcm-fm.cc \ op-fcs-fcs.cc op-fcs-fcm.cc op-fcm-fcs.cc op-fcm-fcm.cc \ fixed-var.cc fixed.cc -FIXEDOBJECTS = fixed-int.o $(patsubst %.cc,%.o,$(FIXEDSOURCES)) -FIXEDDEPENDS = fixed-int.d $(patsubst %.cc,%.d,$(FIXEDSOURCES)) +FIXEDOBJECTS = int/fixed.o $(patsubst %.cc,%.o,$(FIXEDSOURCES)) +FIXEDDEPENDS = int/fixed.d $(patsubst %.cc,%.d,$(FIXEDSOURCES)) TARGETS = $(FIXEDTARGET) OBJECTS = $(FIXEDOBJECTS) @@ -73,45 +73,42 @@ endif $(FIXEDTARGET) : $(DEPENDS) $(FIXEDOBJECTS) - @echo "Linking $@"; \ + @echo "Linking $@"; $(MKOCTFILE) $(ADD_FLAGS) $(MOFLAGS) $(FIXEDOBJECTS) $(EXTRALIBS) -o $@ $(FIXEDVERTARGET) : - @echo "Creating $@"; $(RM) -f $@; \ + @echo "Creating $@"; $(RM) -f $@; echo "#define OCTAVEFIXEDVERSION \"$(OCTAVEFIXEDVERSION)\"" > $@ ifneq (,$(DEPENDS)) sinclude $(DEPENDS) endif -fixed-int.d : int/fixed.cc - @echo "Depending $<"; \ - $(MKOCTFILE) $(MOFLAGS) $(DEFINES) -M int/fixed.cc; \ - $(LN_S) $(patsubst %.cc,%.d,$<) $@ +int/fixed.d : int/fixed.cc + @echo "Depending $<"; + $(MKOCTFILE) $(MOFLAGS) $(DEFINES) -M int/fixed.cc; fixed-var.d : $(FIXEDVERTARGET) -fixed-int.o : int/fixed.cc fixed-int.d - @echo "Compiling $@ from $<"; \ - $(MKOCTFILE) $(MOFLAGS) $(DEFINES) -c $<; \ - $(RM) -f $@ ; \ - $(LN_S) $(patsubst %.cc,%.o,$<) $@ +int/fixed.o : int/fixed.cc int/fixed.d + @echo "Compiling $@ from $<" + $(MKOCTFILE) $(MOFLAGS) $(DEFINES) -c -o $@ $< %.d: %.cc - @echo "Depending $<"; \ + @echo "Depending $<" $(MKOCTFILE) $(MOFLAGS) $(DEFINES) -M $< %.o:%.cc %.o:%.cc %.d - @echo "Compiling $@"; \ + @echo "Compiling $@" $(MKOCTFILE) $(MOFLAGS) $(DEFINES) -c $< clean: - @echo "Cleaning..."; \ + @echo "Cleaning..." $(RM) -f $(DELETES) realclean: - @echo "Cleaning..."; \ + @echo "Cleaning..." $(RM) -f $(DELETES) Makeconf config.log config.status dist: diff -r 954f2f00d782 -r d84d2fea3c90 main/fixed/src/fixed.cc --- a/main/fixed/src/fixed.cc Wed Feb 22 21:56:05 2012 +0000 +++ b/main/fixed/src/fixed.cc Wed Feb 22 22:07:33 2012 +0000 @@ -213,7 +213,7 @@ } else { if (args(0).is_complex_type()) { ComplexMatrix a = args(0).complex_matrix_value(); - MArray2 b(a.rows(),a.cols()); + MArray b(dim_vector (a.rows(),a.cols())); for (int j = 0; j < a.cols(); j++) for (int i = 0; i < a.rows(); i++) b(i,j) = (int)real(a(i,j)); @@ -225,7 +225,7 @@ retval = new octave_fixed_complex_matrix (fr, fi); } else { Matrix a = args(0).matrix_value(); - MArray2 b(a.rows(),a.cols()); + MArray b(dim_vector (a.rows(),a.cols())); for (int j = 0; j < a.cols(); j++) for (int i = 0; i < a.rows(); i++) b(i,j) = (int)a(i,j); @@ -237,7 +237,7 @@ if (args(0).is_complex_type() || args(1).is_complex_type() || ((nargin > 2) && args(2).is_complex_type())) { - MArray2 mir, mii, mdr, mdi; + MArray mir, mii, mdr, mdi; ComplexMatrix a, b; if (args(0).is_complex_type()) a = args(0).complex_matrix_value(); @@ -252,8 +252,8 @@ b = b + Complex(0.,1.)*b; } - mir.resize(a.rows(),a.cols()); - mii.resize(a.rows(),a.cols()); + mir.resize(dim_vector (a.rows(),a.cols())); + mii.resize(dim_vector (a.rows(),a.cols())); for (int j = 0; j < a.cols(); j++) for (int i = 0; i < a.rows(); i++) { mir(i,j) = (int) real(a(i,j)); @@ -266,8 +266,8 @@ } } - mdr.resize(b.rows(),b.cols()); - mdi.resize(b.rows(),b.cols()); + mdr.resize(dim_vector (b.rows(),b.cols())); + mdi.resize(dim_vector (b.rows(),b.cols())); for (int j = 0; j < b.cols(); j++) for (int i = 0; i < b.rows(); i++) { mdr(i,j) = (int) real(b(i,j)); @@ -281,12 +281,12 @@ } if ((mir.rows() == 1) && (mir.cols() == 1)) { - mir.resize(mdr.rows(),mdr.cols(),mir(0,0)); - mii.resize(mdr.rows(),mdr.cols(),mii(0,0)); + mir.resize(dim_vector (mdr.rows(),mdr.cols()), mir(0,0)); + mii.resize(dim_vector (mdr.rows(),mdr.cols()), mii(0,0)); } if ((mdr.rows() == 1) && (mdr.cols() == 1)) { - mdr.resize(mir.rows(),mir.cols(),mdr(0,0)); - mdi.resize(mir.rows(),mir.cols(),mdi(0,0)); + mdr.resize(dim_vector (mir.rows(),mir.cols()), mdr(0,0)); + mdi.resize(dim_vector (mir.rows(),mir.cols()), mdi(0,0)); } if ((mir.rows() != mdr.rows()) || (mir.cols() != mdr.cols())) { @@ -326,11 +326,11 @@ } } } else { - MArray2 mis, mds; + MArray mis, mds; Matrix a = args(0).matrix_value(); Matrix b = args(1).matrix_value(); - mis.resize(a.rows(),a.cols()); + mis.resize(dim_vector (a.rows(),a.cols())); for (int j = 0; j < a.cols(); j++) for (int i = 0; i < a.rows(); i++) { mis(i,j) = (int)a(i,j); @@ -339,7 +339,7 @@ return retval; } } - mds.resize(b.rows(),b.cols()); + mds.resize(dim_vector (b.rows(),b.cols())); for (int j=0; j < b.cols(); j++) for (int i=0; i < b.rows(); i++) { mds(i,j) = (int)b(i,j); @@ -350,9 +350,9 @@ } if ((mis.rows() == 1) && (mis.cols() == 1)) - mis.resize(mds.rows(),mds.cols(),mis(0,0)); + mis.resize(dim_vector (mds.rows(),mds.cols()),mis(0,0)); if ((mds.rows() == 1) && (mds.cols() == 1)) - mds.resize(mis.rows(),mis.cols(),mds(0,0)); + mds.resize(dim_vector (mis.rows(),mis.cols()),mds(0,0)); if ((mis.rows() != mds.rows()) || (mis.cols() != mds.cols())) { error("fixed: dimension mismatch in args"); @@ -414,8 +414,8 @@ if (args(0).type_id () == octave_fixed::static_type_id ()) { \ FixedPoint f = ((const octave_fixed&) args(0).get_rep()) \ .fixed_value (); \ - if ((REAL_CAN_RET_CMPLX_UPPER && (f.fixedpoint() > UPPER)) || \ - (REAL_CAN_RET_CMPLX_LOWER && (f.fixedpoint() < LOWER))) \ + if ((REAL_CAN_RET_CMPLX_UPPER && (f > UPPER)) || \ + (REAL_CAN_RET_CMPLX_LOWER && (f < LOWER))) \ retval = new octave_fixed_complex \ (FUNC (FixedPointComplex(f,FixedPoint(f.getintsize(), \ f.getdecsize())))); \ @@ -425,9 +425,9 @@ octave_fixed_matrix::static_type_id ()) { \ FixedMatrix f = ((const octave_fixed_matrix&) args(0).get_rep()) \ .fixed_matrix_value (); \ - if ((REAL_CAN_RET_CMPLX_UPPER && (f.row_max().max().fixedpoint() \ + if ((REAL_CAN_RET_CMPLX_UPPER && (f.row_max().max() \ > UPPER)) || \ - (REAL_CAN_RET_CMPLX_LOWER && (f.row_min().min().fixedpoint() \ + (REAL_CAN_RET_CMPLX_LOWER && (f.row_min().min() \ < LOWER))) { \ retval = new octave_fixed_complex_matrix \ (FUNC (FixedComplexMatrix(f))); \ @@ -955,9 +955,9 @@ int n = nc + k; FixedComplexMatrix r; if (same) - r.resize(n,n,FixedPointComplex(is,ds)); + r.resize(dim_vector (n,n), FixedPointComplex(is,ds)); else - r.resize(n,n); + r.resize(dim_vector (n,n)); for (int i = 0; i < nc; i++) r (i+roff, i+coff) = m (0, i); retval = new octave_fixed_complex_matrix (r); @@ -965,9 +965,9 @@ int n = nr + k; FixedComplexMatrix r; if (same) - r.resize(n,n,FixedPointComplex(is,ds)); + r.resize(dim_vector (n,n), FixedPointComplex(is,ds)); else - r.resize(n,n); + r.resize(dim_vector (n,n)); for (int i = 0; i < nr; i++) r (i+roff, i+coff) = m (i, 0); retval = new octave_fixed_complex_matrix (r); @@ -1024,7 +1024,7 @@ int n = nc + k; FixedMatrix r; if (same) - r.resize(n,n,FixedPoint(is,ds)); + r.resize(n,n, FixedPoint(is,ds)); else r.resize(n,n); for (int i = 0; i < nc; i++) diff -r 954f2f00d782 -r d84d2fea3c90 main/fixed/src/fixedCColVector.cc --- a/main/fixed/src/fixedCColVector.cc Wed Feb 22 21:56:05 2012 +0000 +++ b/main/fixed/src/fixedCColVector.cc Wed Feb 22 22:07:33 2012 +0000 @@ -41,7 +41,8 @@ FixedComplexColumnVector::FixedComplexColumnVector (const MArray &is, - const MArray &ds) : MArray (is.length()) + const MArray &ds) + : MArray (dim_vector (is.length(), 1)) { if (length() != ds.length()) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -53,7 +54,8 @@ } FixedComplexColumnVector::FixedComplexColumnVector (const ColumnVector &is, - const ColumnVector &ds) : MArray (is.length()) + const ColumnVector &ds) + : MArray (dim_vector (is.length(), 1)) { if (length() != ds.length()) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -64,9 +66,9 @@ elem (i) = FixedPointComplex((unsigned int)is(i), (unsigned int)ds(i)); } -FixedComplexColumnVector::FixedComplexColumnVector ( - const ComplexColumnVector &is, const ComplexColumnVector &ds) : - MArray (is.length()) +FixedComplexColumnVector::FixedComplexColumnVector + (const ComplexColumnVector &is, const ComplexColumnVector &ds) + : MArray (dim_vector (is.length(), 1)) { if (length() != ds.length()) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -77,25 +79,26 @@ elem (i) = FixedPointComplex(is(i), ds(i)); } -FixedComplexColumnVector::FixedComplexColumnVector (unsigned int is, - unsigned int ds, const FixedComplexColumnVector& a) : - MArray (a.length()) +FixedComplexColumnVector::FixedComplexColumnVector + (unsigned int is, unsigned int ds, const FixedComplexColumnVector& a) + : MArray (dim_vector (a.length(), 1)) { for (int i = 0; i < length (); i++) elem (i) = FixedPointComplex(is, ds, a(i)); } -FixedComplexColumnVector::FixedComplexColumnVector (Complex is, - Complex ds, const FixedComplexColumnVector& a) : - MArray (a.length()) +FixedComplexColumnVector::FixedComplexColumnVector + (Complex is, Complex ds, const FixedComplexColumnVector& a) + : MArray (dim_vector (a.length(), 1)) { for (int i = 0; i < length (); i++) elem (i) = FixedPointComplex(is, ds, a(i)); } -FixedComplexColumnVector::FixedComplexColumnVector (const MArray &is, - const MArray &ds, const FixedComplexColumnVector& a) : - MArray (is.length()) +FixedComplexColumnVector::FixedComplexColumnVector + (const MArray &is, const MArray &ds, + const FixedComplexColumnVector& a) + : MArray (dim_vector (is.length(), 1)) { if ((length() != ds.length()) || (length() != a.length())) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -107,9 +110,10 @@ a(i)); } -FixedComplexColumnVector::FixedComplexColumnVector (const ColumnVector &is, - const ColumnVector &ds, const FixedComplexColumnVector& a) : - MArray (is.length()) +FixedComplexColumnVector::FixedComplexColumnVector + (const ColumnVector &is, const ColumnVector &ds, + const FixedComplexColumnVector& a) + : MArray (dim_vector (is.length(), 1)) { if ((length() != ds.length()) || (length() != a.length())) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -121,10 +125,10 @@ a(i)); } -FixedComplexColumnVector::FixedComplexColumnVector ( - const ComplexColumnVector &is, const ComplexColumnVector &ds, - const FixedComplexColumnVector& a) : - MArray (is.length()) +FixedComplexColumnVector::FixedComplexColumnVector + (const ComplexColumnVector &is, const ComplexColumnVector &ds, + const FixedComplexColumnVector& a) + : MArray (dim_vector (is.length(), 1)) { if ((length() != ds.length()) || (length() != a.length())) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -135,25 +139,25 @@ elem (i) = FixedPointComplex(is(i), ds(i), a(i)); } -FixedComplexColumnVector::FixedComplexColumnVector (unsigned int is, - unsigned int ds, const FixedColumnVector& a) : - MArray (a.length()) +FixedComplexColumnVector::FixedComplexColumnVector + (unsigned int is, unsigned int ds, const FixedColumnVector& a) + : MArray (dim_vector (a.length(), 1)) { for (int i = 0; i < length (); i++) elem (i) = FixedPointComplex(is, ds, a(i)); } -FixedComplexColumnVector::FixedComplexColumnVector (Complex is, - Complex ds, const FixedColumnVector& a) : - MArray (a.length()) +FixedComplexColumnVector::FixedComplexColumnVector + (Complex is, Complex ds, const FixedColumnVector& a) + : MArray (dim_vector (a.length(), 1)) { for (int i = 0; i < length (); i++) elem (i) = FixedPointComplex(is, ds, FixedPointComplex(a(i))); } -FixedComplexColumnVector::FixedComplexColumnVector (const MArray &is, - const MArray &ds, const FixedColumnVector& a) : - MArray (is.length()) +FixedComplexColumnVector::FixedComplexColumnVector + (const MArray &is, const MArray &ds, const FixedColumnVector& a) + : MArray (dim_vector (is.length(), 1)) { if ((length() != ds.length()) || (length() != a.length())) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -165,9 +169,10 @@ a(i)); } -FixedComplexColumnVector::FixedComplexColumnVector (const ColumnVector &is, - const ColumnVector &ds, const FixedColumnVector& a) : - MArray (is.length()) +FixedComplexColumnVector::FixedComplexColumnVector + (const ColumnVector &is, const ColumnVector &ds, + const FixedColumnVector& a) + : MArray (dim_vector (is.length(), 1)) { if ((length() != ds.length()) || (length() != a.length())) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -179,9 +184,10 @@ a(i)); } -FixedComplexColumnVector::FixedComplexColumnVector ( - const ComplexColumnVector &is, const ComplexColumnVector &ds, - const FixedColumnVector& a) : MArray (is.length()) +FixedComplexColumnVector::FixedComplexColumnVector + (const ComplexColumnVector &is, const ComplexColumnVector &ds, + const FixedColumnVector& a) + : MArray (dim_vector (is.length(), 1)) { if ((length() != ds.length()) || (length() != a.length())) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -192,25 +198,25 @@ elem (i) = FixedPointComplex(is(i), ds(i), FixedPointComplex(a(i))); } -FixedComplexColumnVector::FixedComplexColumnVector (unsigned int is, - unsigned int ds, const ComplexColumnVector& a) : - MArray (a.length()) +FixedComplexColumnVector::FixedComplexColumnVector + (unsigned int is, unsigned int ds, const ComplexColumnVector& a) + : MArray (dim_vector (a.length(), 1)) { for (int i = 0; i < length (); i++) elem (i) = FixedPointComplex(is, ds, a(i)); } -FixedComplexColumnVector::FixedComplexColumnVector (Complex is, - Complex ds, const ComplexColumnVector& a) : - MArray (a.length()) +FixedComplexColumnVector::FixedComplexColumnVector + (Complex is, Complex ds, const ComplexColumnVector& a) + : MArray (dim_vector (a.length(), 1)) { for (int i = 0; i < length (); i++) elem (i) = FixedPointComplex(is, ds, a(i)); } -FixedComplexColumnVector::FixedComplexColumnVector (const MArray &is, - const MArray &ds, const ComplexColumnVector& a) : - MArray (is.length()) +FixedComplexColumnVector::FixedComplexColumnVector + (const MArray &is, const MArray &ds, const ComplexColumnVector& a) + : MArray (dim_vector (is.length(), 1)) { if ((length() != ds.length()) || (length() != a.length())) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -222,9 +228,10 @@ a(i)); } -FixedComplexColumnVector::FixedComplexColumnVector (const ColumnVector &is, - const ColumnVector &ds, const ComplexColumnVector& a) : - MArray (is.length()) +FixedComplexColumnVector::FixedComplexColumnVector + (const ColumnVector &is, const ColumnVector &ds, + const ComplexColumnVector& a) + : MArray (dim_vector (is.length(), 1)) { if ((length() != ds.length()) || (length() != a.length())) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -236,9 +243,10 @@ a(i)); } -FixedComplexColumnVector::FixedComplexColumnVector ( - const ComplexColumnVector &is, const ComplexColumnVector &ds, - const ComplexColumnVector& a) : MArray (is.length()) +FixedComplexColumnVector::FixedComplexColumnVector + (const ComplexColumnVector &is, const ComplexColumnVector &ds, + const ComplexColumnVector& a) + : MArray (dim_vector (is.length(), 1)) { if ((length() != ds.length()) || (length() != a.length())) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -249,25 +257,25 @@ elem (i) = FixedPointComplex(is(i), ds(i), a(i)); } -FixedComplexColumnVector::FixedComplexColumnVector (unsigned int is, - unsigned int ds, const ColumnVector& a) : - MArray (a.length()) +FixedComplexColumnVector::FixedComplexColumnVector + (unsigned int is, unsigned int ds, const ColumnVector& a) + : MArray (dim_vector (a.length(), 1)) { for (int i = 0; i < length (); i++) elem (i) = FixedPointComplex(is, ds, a(i)); } -FixedComplexColumnVector::FixedComplexColumnVector (Complex is, - Complex ds, const ColumnVector& a) : - MArray (a.length()) +FixedComplexColumnVector::FixedComplexColumnVector + (Complex is, Complex ds, const ColumnVector& a) + : MArray (dim_vector (a.length(), 1)) { for (int i = 0; i < length (); i++) elem (i) = FixedPointComplex(is, ds, a(i)); } -FixedComplexColumnVector::FixedComplexColumnVector (const MArray &is, - const MArray &ds, const ColumnVector& a) : - MArray (is.length()) +FixedComplexColumnVector::FixedComplexColumnVector + (const MArray &is, const MArray &ds, const ColumnVector& a) + : MArray (dim_vector (is.length(), 1)) { if ((length() != ds.length()) || (length() != a.length())) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -279,9 +287,9 @@ a(i)); } -FixedComplexColumnVector::FixedComplexColumnVector (const ColumnVector &is, - const ColumnVector &ds, const ColumnVector& a) : - MArray (is.length()) +FixedComplexColumnVector::FixedComplexColumnVector + (const ColumnVector &is, const ColumnVector &ds, const ColumnVector& a) + : MArray (dim_vector (is.length(), 1)) { if ((length() != ds.length()) || (length() != a.length())) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -293,9 +301,10 @@ a(i)); } -FixedComplexColumnVector::FixedComplexColumnVector ( - const ComplexColumnVector &is, const ComplexColumnVector &ds, - const ColumnVector& a) : MArray (is.length()) +FixedComplexColumnVector::FixedComplexColumnVector + (const ComplexColumnVector &is, const ComplexColumnVector &ds, + const ColumnVector& a) + : MArray (dim_vector (is.length(), 1)) { if ((length() != ds.length()) || (length() != a.length())) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -306,9 +315,10 @@ elem (i) = FixedPointComplex(is(i), ds(i), a(i)); } -FixedComplexColumnVector::FixedComplexColumnVector (unsigned int is, - unsigned int ds, const ComplexColumnVector& a, - const ComplexColumnVector& b) : MArray (a.length()) +FixedComplexColumnVector::FixedComplexColumnVector + (unsigned int is, unsigned int ds, const ComplexColumnVector& a, + const ComplexColumnVector& b) + : MArray (dim_vector (a.length(), 1)) { if (length() != b.length()) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -319,9 +329,10 @@ elem (i) = FixedPointComplex(is, ds, a(i), b(i)); } -FixedComplexColumnVector::FixedComplexColumnVector (Complex is, - Complex ds, const ComplexColumnVector& a, - const ComplexColumnVector& b) : MArray (a.length()) +FixedComplexColumnVector::FixedComplexColumnVector + (Complex is, Complex ds, const ComplexColumnVector& a, + const ComplexColumnVector& b) + : MArray (dim_vector (a.length(), 1)) { if (length() != b.length()) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -332,9 +343,10 @@ elem (i) = FixedPointComplex(is, ds, a(i), b(i)); } -FixedComplexColumnVector::FixedComplexColumnVector (const MArray &is, - const MArray &ds, const ComplexColumnVector& a, - const ComplexColumnVector& b) : MArray (is.length()) +FixedComplexColumnVector::FixedComplexColumnVector + (const MArray &is, const MArray &ds, + const ComplexColumnVector& a, const ComplexColumnVector& b) + : MArray (dim_vector (is.length(), 1)) { if ((length() != ds.length()) || (length() != a.length()) || (length() != b.length())) { @@ -347,9 +359,10 @@ a(i), b(i)); } -FixedComplexColumnVector::FixedComplexColumnVector (const ColumnVector &is, - const ColumnVector &ds, const ComplexColumnVector& a, - const ComplexColumnVector& b) : MArray (is.length()) +FixedComplexColumnVector::FixedComplexColumnVector + (const ColumnVector &is, const ColumnVector &ds, + const ComplexColumnVector& a, const ComplexColumnVector& b) + : MArray (dim_vector (is.length(), 1)) { if ((length() != ds.length()) || (length() != a.length()) || (length() != b.length())) { @@ -362,10 +375,10 @@ a(i), b(i)); } -FixedComplexColumnVector::FixedComplexColumnVector ( - const ComplexColumnVector &is, const ComplexColumnVector &ds, - const ComplexColumnVector& a, const ComplexColumnVector& b) : - MArray (is.length()) +FixedComplexColumnVector::FixedComplexColumnVector + (const ComplexColumnVector &is, const ComplexColumnVector &ds, + const ComplexColumnVector& a, const ComplexColumnVector& b) + : MArray (dim_vector (is.length(), 1)) { if ((length() != ds.length()) || (length() != a.length()) || (length() != b.length())) { @@ -472,7 +485,7 @@ FixedComplexColumnVector FixedComplexColumnVector::incdecsize () { - return chdecsize(1 + getdecsize()); + return chdecsize(Complex (1) + getdecsize()); } FixedComplexColumnVector @@ -491,7 +504,7 @@ FixedComplexColumnVector FixedComplexColumnVector::incintsize () { - return chintsize(1 + getintsize()); + return chintsize(Complex (1) + getintsize()); } // Fixed Point Complex Column Vector class. diff -r 954f2f00d782 -r d84d2fea3c90 main/fixed/src/fixedCColVector.h --- a/main/fixed/src/fixedCColVector.h Wed Feb 22 21:56:05 2012 +0000 +++ b/main/fixed/src/fixedCColVector.h Wed Feb 22 22:07:33 2012 +0000 @@ -53,10 +53,10 @@ FixedComplexColumnVector (void) : MArray () { } - explicit FixedComplexColumnVector (int n) : MArray (n) { } + explicit FixedComplexColumnVector (int n) : MArray (dim_vector (n, 1)) { } FixedComplexColumnVector (int n, FixedPointComplex val) : - MArray (n, val) { } + MArray (dim_vector (n, 1), val) { } FixedComplexColumnVector (const MArray &is, const MArray &ds); @@ -244,9 +244,11 @@ friend std::ostream& operator << (std::ostream& os, const FixedComplexColumnVector& a); friend std::istream& operator >> (std::istream& is, FixedComplexColumnVector& a); -private: - - FixedComplexColumnVector (FixedPointComplex *d, int l) : MArray (d, l) { } + void resize (octave_idx_type n, + const FixedPointComplex& rfv = Array::resize_fill_value ()) + { + Array::resize (dim_vector (n, 1), rfv); + } }; diff -r 954f2f00d782 -r d84d2fea3c90 main/fixed/src/fixedCMatrix.cc --- a/main/fixed/src/fixedCMatrix.cc Wed Feb 22 21:56:05 2012 +0000 +++ b/main/fixed/src/fixedCMatrix.cc Wed Feb 22 22:07:33 2012 +0000 @@ -46,9 +46,9 @@ // Fixed Point Complex Matrix class. -FixedComplexMatrix::FixedComplexMatrix (const MArray2 &is, - const MArray2 &ds) - : MArray2 (is.rows(), is.cols()) +FixedComplexMatrix::FixedComplexMatrix (const MArray &is, + const MArray &ds) + : MArray (dim_vector (is.rows(), is.cols())) { if ((rows() != ds.rows()) || (cols() != ds.cols())) { (*current_liboctave_error_handler) ("matrix size mismatch"); @@ -62,7 +62,7 @@ } FixedComplexMatrix::FixedComplexMatrix (const Matrix &is, const Matrix &ds) - : MArray2 (is.rows(), is.cols()) + : MArray (dim_vector (is.rows(), is.cols())) { if ((rows() != ds.rows()) || (cols() != ds.cols())) { (*current_liboctave_error_handler) ("matrix size mismatch"); @@ -77,7 +77,7 @@ FixedComplexMatrix::FixedComplexMatrix (const ComplexMatrix &is, const ComplexMatrix &ds) - : MArray2 (is.rows(), is.cols()) + : MArray (dim_vector (is.rows(), is.cols())) { if ((rows() != ds.rows()) || (cols() != ds.cols())) { (*current_liboctave_error_handler) ("matrix size mismatch"); @@ -91,7 +91,7 @@ FixedComplexMatrix::FixedComplexMatrix (unsigned int is, unsigned int ds, const FixedComplexMatrix& a) - : MArray2 (a.rows(), a.cols()) + : MArray (dim_vector (a.rows(), a.cols())) { for (int j = 0; j < cols (); j++) for (int i = 0; i < rows (); i++) @@ -100,16 +100,16 @@ FixedComplexMatrix::FixedComplexMatrix (Complex is, Complex ds, const FixedComplexMatrix& a) - : MArray2 (a.rows(), a.cols()) + : MArray (dim_vector (a.rows(), a.cols())) { for (int j = 0; j < cols (); j++) for (int i = 0; i < rows (); i++) elem (i, j) = FixedPointComplex(is, ds, a.elem (i, j)); } -FixedComplexMatrix::FixedComplexMatrix (const MArray2 &is, - const MArray2 &ds, const FixedComplexMatrix& a) - : MArray2 (a.rows(), a.cols()) +FixedComplexMatrix::FixedComplexMatrix (const MArray &is, + const MArray &ds, const FixedComplexMatrix& a) + : MArray (dim_vector (a.rows(), a.cols())) { if ((rows() != is.rows()) || (cols() != is.cols()) || (rows() != ds.rows()) || (cols() != ds.cols())) { @@ -125,7 +125,7 @@ FixedComplexMatrix::FixedComplexMatrix (const Matrix &is, const Matrix &ds, const FixedComplexMatrix& a) - : MArray2 (a.rows(), a.cols()) + : MArray (dim_vector (a.rows(), a.cols())) { if ((rows() != is.rows()) || (cols() != is.cols()) || (rows() != ds.rows()) || (cols() != ds.cols())) { @@ -141,7 +141,7 @@ FixedComplexMatrix::FixedComplexMatrix (const ComplexMatrix &is, const ComplexMatrix &ds, const FixedComplexMatrix& a) - : MArray2 (a.rows(), a.cols()) + : MArray (dim_vector (a.rows(), a.cols())) { if ((rows() != is.rows()) || (cols() != is.cols()) || (rows() != ds.rows()) || (cols() != ds.cols())) { @@ -156,7 +156,7 @@ FixedComplexMatrix::FixedComplexMatrix (unsigned int is, unsigned int ds, const FixedMatrix& a) - : MArray2 (a.rows(), a.cols()) + : MArray (dim_vector (a.rows(), a.cols())) { for (int j = 0; j < cols (); j++) for (int i = 0; i < rows (); i++) @@ -165,16 +165,16 @@ FixedComplexMatrix::FixedComplexMatrix (Complex is, Complex ds, const FixedMatrix& a) - : MArray2 (a.rows(), a.cols()) + : MArray (dim_vector (a.rows(), a.cols())) { for (int j = 0; j < cols (); j++) for (int i = 0; i < rows (); i++) elem (i, j) = FixedPointComplex(is, ds, FixedPointComplex(a.elem (i, j))); } -FixedComplexMatrix::FixedComplexMatrix (const MArray2 &is, - const MArray2 &ds, const FixedMatrix& a) - : MArray2 (a.rows(), a.cols()) +FixedComplexMatrix::FixedComplexMatrix (const MArray &is, + const MArray &ds, const FixedMatrix& a) + : MArray (dim_vector (a.rows(), a.cols())) { if ((rows() != is.rows()) || (cols() != is.cols()) || (rows() != ds.rows()) || (cols() != ds.cols())) { @@ -190,7 +190,7 @@ FixedComplexMatrix::FixedComplexMatrix (const Matrix &is, const Matrix &ds, const FixedMatrix& a) - : MArray2 (a.rows(), a.cols()) + : MArray (dim_vector (a.rows(), a.cols())) { if ((rows() != is.rows()) || (cols() != is.cols()) || (rows() != ds.rows()) || (cols() != ds.cols())) { @@ -206,7 +206,7 @@ FixedComplexMatrix::FixedComplexMatrix (const ComplexMatrix &is, const ComplexMatrix &ds, const FixedMatrix& a) - : MArray2 (a.rows(), a.cols()) + : MArray (dim_vector (a.rows(), a.cols())) { if ((rows() != is.rows()) || (cols() != is.cols()) || (rows() != ds.rows()) || (cols() != ds.cols())) { @@ -221,7 +221,7 @@ FixedComplexMatrix::FixedComplexMatrix (unsigned int is, unsigned int ds, const ComplexMatrix& a) - : MArray2 (a.rows(), a.cols()) + : MArray (dim_vector (a.rows(), a.cols())) { for (int j = 0; j < cols (); j++) for (int i = 0; i < rows (); i++) @@ -230,16 +230,16 @@ FixedComplexMatrix::FixedComplexMatrix (Complex is, Complex ds, const ComplexMatrix& a) - : MArray2 (a.rows(), a.cols()) + : MArray (dim_vector (a.rows(), a.cols())) { for (int j = 0; j < cols (); j++) for (int i = 0; i < rows (); i++) elem (i, j) = FixedPointComplex(is, ds, a.elem (i, j)); } -FixedComplexMatrix::FixedComplexMatrix (const MArray2 &is, - const MArray2 &ds, const ComplexMatrix& a) - : MArray2 (a.rows(), a.cols()) +FixedComplexMatrix::FixedComplexMatrix (const MArray &is, + const MArray &ds, const ComplexMatrix& a) + : MArray (dim_vector (a.rows(), a.cols())) { if ((rows() != is.rows()) || (cols() != is.cols()) || (rows() != ds.rows()) || (cols() != ds.cols())) { @@ -255,7 +255,7 @@ FixedComplexMatrix::FixedComplexMatrix (const Matrix &is, const Matrix &ds, const ComplexMatrix& a) - : MArray2 (a.rows(), a.cols()) + : MArray (dim_vector (a.rows(), a.cols())) { if ((rows() != is.rows()) || (cols() != is.cols()) || (rows() != ds.rows()) || (cols() != ds.cols())) { @@ -271,7 +271,7 @@ FixedComplexMatrix::FixedComplexMatrix (const ComplexMatrix &is, const ComplexMatrix &ds, const ComplexMatrix& a) - : MArray2 (a.rows(), a.cols()) + : MArray (dim_vector (a.rows(), a.cols())) { if ((rows() != is.rows()) || (cols() != is.cols()) || (rows() != ds.rows()) || (cols() != ds.cols())) { @@ -286,7 +286,7 @@ FixedComplexMatrix::FixedComplexMatrix (unsigned int is, unsigned int ds, const Matrix& a) - : MArray2 (a.rows(), a.cols()) + : MArray (dim_vector (a.rows(), a.cols())) { for (int j = 0; j < cols (); j++) for (int i = 0; i < rows (); i++) @@ -295,16 +295,16 @@ FixedComplexMatrix::FixedComplexMatrix (Complex is, Complex ds, const Matrix& a) - : MArray2 (a.rows(), a.cols()) + : MArray (dim_vector (a.rows(), a.cols())) { for (int j = 0; j < cols (); j++) for (int i = 0; i < rows (); i++) elem (i, j) = FixedPointComplex(is, ds, a.elem (i, j)); } -FixedComplexMatrix::FixedComplexMatrix (const MArray2 &is, - const MArray2 &ds, const Matrix& a) - : MArray2 (a.rows(), a.cols()) +FixedComplexMatrix::FixedComplexMatrix (const MArray &is, + const MArray &ds, const Matrix& a) + : MArray (dim_vector (a.rows(), a.cols())) { if ((rows() != is.rows()) || (cols() != is.cols()) || (rows() != ds.rows()) || (cols() != ds.cols())) { @@ -320,7 +320,7 @@ FixedComplexMatrix::FixedComplexMatrix (const Matrix &is, const Matrix &ds, const Matrix& a) - : MArray2 (a.rows(), a.cols()) + : MArray (dim_vector (a.rows(), a.cols())) { if ((rows() != is.rows()) || (cols() != is.cols()) || (rows() != ds.rows()) || (cols() != ds.cols())) { @@ -336,7 +336,7 @@ FixedComplexMatrix::FixedComplexMatrix (const ComplexMatrix &is, const ComplexMatrix &ds, const Matrix& a) - : MArray2 (a.rows(), a.cols()) + : MArray (dim_vector (a.rows(), a.cols())) { if ((rows() != is.rows()) || (cols() != is.cols()) || (rows() != ds.rows()) || (cols() != ds.cols())) { @@ -352,7 +352,7 @@ FixedComplexMatrix::FixedComplexMatrix (unsigned int is, unsigned int ds, const ComplexMatrix& a, const ComplexMatrix& b) - : MArray2 (a.rows(), a.cols()) + : MArray (dim_vector (a.rows(), a.cols())) { if ((rows() != b.rows()) || (cols() != b.cols())) { (*current_liboctave_error_handler) ("matrix size mismatch"); @@ -366,7 +366,7 @@ FixedComplexMatrix::FixedComplexMatrix (Complex is, Complex ds, const ComplexMatrix& a, const ComplexMatrix& b) - : MArray2 (a.rows(), a.cols()) + : MArray (dim_vector (a.rows(), a.cols())) { if ((rows() != b.rows()) || (cols() != b.cols())) { (*current_liboctave_error_handler) ("matrix size mismatch"); @@ -378,10 +378,10 @@ elem (i, j) = FixedPointComplex(is, ds, a.elem (i, j), b.elem(i,j)); } -FixedComplexMatrix::FixedComplexMatrix (const MArray2 &is, - const MArray2 &ds, const ComplexMatrix& a, +FixedComplexMatrix::FixedComplexMatrix (const MArray &is, + const MArray &ds, const ComplexMatrix& a, const ComplexMatrix& b) - : MArray2 (a.rows(), a.cols()) + : MArray (dim_vector (a.rows(), a.cols())) { if ((rows() != b.rows()) || (cols() != b.cols()) || (rows() != is.rows()) || (cols() != is.cols()) || (rows() != ds.rows()) @@ -398,7 +398,7 @@ FixedComplexMatrix::FixedComplexMatrix (const Matrix &is, const Matrix &ds, const ComplexMatrix& a, const ComplexMatrix& b) - : MArray2 (a.rows(), a.cols()) + : MArray (dim_vector (a.rows(), a.cols())) { if ((rows() != b.rows()) || (cols() != b.cols()) || (rows() != is.rows()) || (cols() != is.cols()) || (rows() != ds.rows()) @@ -416,7 +416,7 @@ FixedComplexMatrix::FixedComplexMatrix (const ComplexMatrix &is, const ComplexMatrix &ds, const ComplexMatrix& a, const ComplexMatrix& b) - : MArray2 (a.rows(), a.cols()) + : MArray (dim_vector (a.rows(), a.cols())) { if ((rows() != b.rows()) || (cols() != b.cols()) || (rows() != is.rows()) || (cols() != is.cols()) || (rows() != ds.rows()) @@ -432,35 +432,35 @@ } FixedComplexMatrix::FixedComplexMatrix (const FixedComplexRowVector& rv) - : MArray2 (1, rv.length (), FixedPointComplex()) + : MArray (dim_vector (1, rv.length ()), FixedPointComplex()) { for (int i = 0; i < rv.length (); i++) elem (0, i) = rv.elem (i); } FixedComplexMatrix::FixedComplexMatrix (const FixedRowVector& rv) - : MArray2 (1, rv.length (), FixedPointComplex()) + : MArray (dim_vector (1, rv.length ()), FixedPointComplex()) { for (int i = 0; i < rv.length (); i++) elem (0, i) = FixedPointComplex(rv.elem (i)); } FixedComplexMatrix::FixedComplexMatrix (const FixedComplexColumnVector& cv) - : MArray2 (cv.length (), 1, FixedPointComplex()) + : MArray (dim_vector (cv.length (), 1), FixedPointComplex()) { for (int i = 0; i < cv.length (); i++) elem (i, 0) = cv.elem (i); } FixedComplexMatrix::FixedComplexMatrix (const FixedColumnVector& cv) - : MArray2 (cv.length (), 1, FixedPointComplex()) + : MArray (dim_vector (cv.length (), 1), FixedPointComplex()) { for (int i = 0; i < cv.length (); i++) elem (i, 0) = FixedPointComplex(cv.elem (i)); } FixedComplexMatrix::FixedComplexMatrix (const FixedMatrix& m) - : MArray2 (m.rows (), m.cols (), FixedPointComplex()) + : MArray (dim_vector (m.rows (), m.cols ()), FixedPointComplex()) { for (int j = 0; j < m.cols (); j++) for (int i = 0; i < m.rows (); i++) @@ -469,7 +469,7 @@ FixedComplexMatrix::FixedComplexMatrix (const FixedMatrix& a, const FixedMatrix& b) - : MArray2 (a.rows (), a.cols (), FixedPointComplex()) + : MArray (dim_vector (a.rows (), a.cols ()), FixedPointComplex()) { if ((rows() != b.rows()) || (cols() != b.cols())) { (*current_liboctave_error_handler) ("matrix size mismatch"); @@ -665,7 +665,7 @@ FixedComplexMatrix& FixedComplexMatrix::insert (const FixedComplexMatrix& a, int r, int c) { - Array2::insert (a, r, c); + Array::insert (a, r, c); return *this; } @@ -1008,7 +1008,7 @@ { int a_len = a.length (); - retval.resize (len, a_len); + retval.resize (dim_vector (len, a_len)); for (int i = 0; i < len; i++) for (int j = 0; j < a_len; j++) @@ -1041,43 +1041,43 @@ boolMatrix FixedComplexMatrix::all (int dim) const { - return do_mx_red_op (*this, dim, mx_inline_all); + return do_mx_red_op (*this, dim, mx_inline_all); } boolMatrix FixedComplexMatrix::any (int dim) const { - return do_mx_red_op (*this, dim, mx_inline_any); + return do_mx_red_op (*this, dim, mx_inline_any); } FixedComplexMatrix FixedComplexMatrix::cumprod (int dim) const { - return do_mx_cum_op (*this, dim, mx_inline_cumprod); + return do_mx_cum_op (*this, dim, mx_inline_cumprod); } FixedComplexMatrix FixedComplexMatrix::cumsum (int dim) const { - return do_mx_cum_op (*this, dim, mx_inline_cumsum); + return do_mx_cum_op (*this, dim, mx_inline_cumsum); } FixedComplexMatrix FixedComplexMatrix::prod (int dim) const { - return do_mx_red_op (*this, dim, mx_inline_prod); + return do_mx_red_op (*this, dim, mx_inline_prod); } FixedComplexMatrix FixedComplexMatrix::sum (int dim) const { - return do_mx_red_op (*this, dim, mx_inline_sum); + return do_mx_red_op (*this, dim, mx_inline_sum); } FixedComplexMatrix FixedComplexMatrix::sumsq (int dim) const { - return do_mx_red_op (*this, dim, mx_inline_sumsq); + return do_mx_red_op (*this, dim, mx_inline_sumsq); } FixedComplexMatrix @@ -1159,7 +1159,7 @@ if (nr > 0 && nc > 0) { result.resize (nr); - index.resize (nr); + index.resize (dim_vector (nr, 1)); for (int i = 0; i < nr; i++) { @@ -1206,7 +1206,7 @@ if (nr > 0 && nc > 0) { result.resize (nr); - index.resize (nr); + index.resize (dim_vector (nr, 1)); for (int i = 0; i < nr; i++) { @@ -1253,7 +1253,7 @@ if (nr > 0 && nc > 0) { result.resize (nc); - index.resize (nc); + index.resize (dim_vector (1, nc)); for (int j = 0; j < nc; j++) { @@ -1300,7 +1300,7 @@ if (nr > 0 && nc > 0) { result.resize (nc); - index.resize (nc); + index.resize (dim_vector (1, nc)); for (int j = 0; j < nc; j++) { @@ -1385,7 +1385,7 @@ if (a_nr == 1 && a_nc == 1) { - retval.resize(b_nr,b_nc); + retval.resize(dim_vector (b_nr,b_nc)); FixedPointComplex ad = a(0,0); for (int j = 0; j < b_nc; j++) for (int i = 0; i < b_nr; i++) @@ -1393,7 +1393,7 @@ } else if (b_nr == 1 && b_nc == 1) { - retval.resize(a_nr,a_nc); + retval.resize(dim_vector (a_nr,a_nc)); FixedPointComplex bd = b(0,0); for (int j = 0; j < a_nc; j++) for (int i = 0; i < a_nr; i++) @@ -1401,7 +1401,7 @@ } else if ((a_nr == b_nr) && (a_nc == b_nc)) { - retval.resize(a_nr,a_nc); + retval.resize(dim_vector (a_nr,a_nc)); for (int j = 0; j < a_nc; j++) for (int i = 0; i < a_nr; i++) retval(i,j) = pow(a(i,j), b(i,j)); @@ -1548,7 +1548,7 @@ FixedComplexMatrix result; if (length () > 0) { - result.resize (nc, nr); + result.resize (dim_vector (nc, nr)); for (int j = 0; j < nc; j++) for (int i = 0; i < nr; i++) result.elem (j, i) = conj (elem (i, j)); @@ -1612,7 +1612,7 @@ gripe_nonconformant ("operator *", a_nr, a_nc, b_nr, b_nc); else { - retval.resize (a_nr, b_nc, FixedPointComplex()); + retval.resize (dim_vector (a_nr, b_nc), FixedPointComplex()); if (a_nr != 0 && a_nc != 0 && b_nc != 0) { for (int j = 0; j < b_nr; j++) @@ -1773,14 +1773,14 @@ return result; } -MS_CMP_OPS(FixedComplexMatrix, real, FixedPointComplex, real) -MS_BOOL_OPS(FixedComplexMatrix, FixedPointComplex, FixedPointComplex()) +MS_CMP_OPS(FixedComplexMatrix, FixedPointComplex) +MS_BOOL_OPS(FixedComplexMatrix, FixedPointComplex) -SM_CMP_OPS(FixedPointComplex, real, FixedComplexMatrix, real) -SM_BOOL_OPS(FixedPointComplex, FixedComplexMatrix, FixedPointComplex()) +SM_CMP_OPS(FixedPointComplex, FixedComplexMatrix) +SM_BOOL_OPS(FixedPointComplex, FixedComplexMatrix) -MM_CMP_OPS(FixedComplexMatrix, real, FixedComplexMatrix, real) -MM_BOOL_OPS(FixedComplexMatrix, FixedComplexMatrix, FixedPointComplex()) +MM_CMP_OPS(FixedComplexMatrix, FixedComplexMatrix) +MM_BOOL_OPS(FixedComplexMatrix, FixedComplexMatrix) /* ;;; Local Variables: *** diff -r 954f2f00d782 -r d84d2fea3c90 main/fixed/src/fixedCMatrix.h --- a/main/fixed/src/fixedCMatrix.h Wed Feb 22 21:56:05 2012 +0000 +++ b/main/fixed/src/fixedCMatrix.h Wed Feb 22 22:07:33 2012 +0000 @@ -26,7 +26,7 @@ #if !defined (octave_FixedCMatrix_h) #define octave_FixedCMatrix_h 1 -#include +#include #include #include @@ -51,20 +51,21 @@ class OCTAVE_FIXED_API -FixedComplexMatrix : public MArray2 +FixedComplexMatrix : public MArray { public: - FixedComplexMatrix (void) : MArray2 () { } + FixedComplexMatrix (void) : MArray () { } - FixedComplexMatrix (const dim_vector& dv) : MArray2 (dv) { } + FixedComplexMatrix (const dim_vector& dv) : MArray (dv) { } - FixedComplexMatrix (int r, int c) : MArray2 (r, c) { } + FixedComplexMatrix (int r, int c) + : MArray (dim_vector (r, c)) { } - FixedComplexMatrix (int r, int c, const FixedPointComplex val) : - MArray2 (r, c, val) { } + FixedComplexMatrix (int r, int c, const FixedPointComplex val) + : MArray (dim_vector (r, c), val) { } - FixedComplexMatrix (const MArray2 &is, const MArray2 &ds); + FixedComplexMatrix (const MArray &is, const MArray &ds); FixedComplexMatrix (const Matrix &is, const Matrix &ds); @@ -75,7 +76,7 @@ FixedComplexMatrix (Complex is, Complex ds, const FixedComplexMatrix& a); - FixedComplexMatrix (const MArray2 &is, const MArray2 &ds, + FixedComplexMatrix (const MArray &is, const MArray &ds, const FixedComplexMatrix& a); FixedComplexMatrix (const Matrix &is, const Matrix &ds, @@ -88,7 +89,7 @@ FixedComplexMatrix (Complex is, Complex ds, const FixedMatrix& a); - FixedComplexMatrix (const MArray2 &is, const MArray2 &ds, + FixedComplexMatrix (const MArray &is, const MArray &ds, const FixedMatrix& a); FixedComplexMatrix (const Matrix &is, const Matrix &ds, @@ -102,7 +103,7 @@ FixedComplexMatrix (Complex is, Complex ds, const ComplexMatrix& a); - FixedComplexMatrix (const MArray2 &is, const MArray2 & ds, + FixedComplexMatrix (const MArray &is, const MArray & ds, const ComplexMatrix& a); FixedComplexMatrix (const Matrix &is, const Matrix & ds, @@ -115,7 +116,7 @@ FixedComplexMatrix (Complex is, Complex ds, const Matrix& a); - FixedComplexMatrix (const MArray2 &is, const MArray2 & ds, + FixedComplexMatrix (const MArray &is, const MArray & ds, const Matrix& a); FixedComplexMatrix (const Matrix &is, const Matrix & ds, const Matrix& a); @@ -129,7 +130,7 @@ FixedComplexMatrix (Complex is, Complex ds, const ComplexMatrix &a, const ComplexMatrix &b); - FixedComplexMatrix (const MArray2 &is, const MArray2 &ds, + FixedComplexMatrix (const MArray &is, const MArray &ds, const ComplexMatrix &a, const ComplexMatrix &b); FixedComplexMatrix (const Matrix &is, const Matrix &ds, @@ -143,10 +144,13 @@ FixedComplexMatrix (const FixedMatrix& a, const FixedMatrix& b); FixedComplexMatrix (const FixedComplexMatrix& a) : - MArray2 (a) { } + MArray (a) { } - FixedComplexMatrix (const MArray2& a) : - MArray2 (a) { } + FixedComplexMatrix (const MArray& a) : + MArray (a) { } + + FixedComplexMatrix (const Array& a) : + MArray (a) { } explicit FixedComplexMatrix (const FixedComplexRowVector& rv); @@ -174,7 +178,7 @@ FixedComplexMatrix& operator = (const FixedComplexMatrix& a) { - MArray2::operator = (a); + MArray::operator = (a); return *this; } @@ -208,7 +212,7 @@ FixedComplexMatrix stack (const FixedComplexColumnVector& a) const; FixedComplexMatrix hermitian (void) const; - FixedComplexMatrix transpose (void) const { return MArray2::transpose (); } + FixedComplexMatrix transpose (void) const { return MArray::transpose (); } // resize is the destructive equivalent for this one @@ -312,11 +316,6 @@ static FixedPointComplex resize_fill_value (void) { return FixedPointComplex(); } - -private: - - FixedComplexMatrix (FixedPointComplex *d, int r, int c) : - MArray2 (d, r, c) { } }; OCTAVE_FIXED_API FixedComplexMatrix operator * (const FixedComplexColumnVector& a, @@ -403,7 +402,7 @@ MM_CMP_OP_DECLS (FixedComplexMatrix, FixedComplexMatrix, ) MM_BOOL_OP_DECLS (FixedComplexMatrix, FixedComplexMatrix, ) -MARRAY_FORWARD_DEFS (MArray2, FixedComplexMatrix, FixedPointComplex) +MARRAY_FORWARD_DEFS (MArray, FixedComplexMatrix, FixedPointComplex) #endif diff -r 954f2f00d782 -r d84d2fea3c90 main/fixed/src/fixedCNDArray.cc --- a/main/fixed/src/fixedCNDArray.cc Wed Feb 22 21:56:05 2012 +0000 +++ b/main/fixed/src/fixedCNDArray.cc Wed Feb 22 22:07:33 2012 +0000 @@ -45,9 +45,9 @@ // Fixed Point Complex Matrix class. -FixedComplexNDArray::FixedComplexNDArray (const MArrayN &is, - const MArrayN &ds) - : MArrayN (is.dims()) +FixedComplexNDArray::FixedComplexNDArray (const MArray &is, + const MArray &ds) + : MArray (is.dims()) { if (dims () != ds.dims ()) { (*current_liboctave_error_handler) ("NDArray size mismatch"); @@ -60,7 +60,7 @@ FixedComplexNDArray::FixedComplexNDArray (const NDArray &is, const NDArray &ds) - : MArrayN (is.dims()) + : MArray (is.dims()) { if (dims () != ds.dims ()) { (*current_liboctave_error_handler) ("NDArray size mismatch"); @@ -73,7 +73,7 @@ FixedComplexNDArray::FixedComplexNDArray (const ComplexNDArray &is, const ComplexNDArray &ds) - : MArrayN (is.dims()) + : MArray (is.dims()) { if (dims () != ds.dims ()) { (*current_liboctave_error_handler) ("NDArray size mismatch"); @@ -87,7 +87,7 @@ FixedComplexNDArray::FixedComplexNDArray (unsigned int is, unsigned int ds, const FixedComplexNDArray& a) - : MArrayN (a.dims()) + : MArray (a.dims()) { for (int i = 0; i < nelem (); i++) elem (i) = FixedPointComplex(is, ds, a.elem (i)); @@ -95,16 +95,16 @@ FixedComplexNDArray::FixedComplexNDArray (Complex is, Complex ds, const FixedComplexNDArray& a) - : MArrayN (a.dims()) + : MArray (a.dims()) { for (int i = 0; i < nelem (); i++) elem (i) = FixedPointComplex(is, ds, a.elem (i)); } -FixedComplexNDArray::FixedComplexNDArray (const MArrayN &is, - const MArrayN &ds, +FixedComplexNDArray::FixedComplexNDArray (const MArray &is, + const MArray &ds, const FixedComplexNDArray& a) - : MArrayN (a.dims()) + : MArray (a.dims()) { if ((dims() != is.dims()) || (dims() != ds.dims())) { (*current_liboctave_error_handler) ("NDArray size mismatch"); @@ -119,7 +119,7 @@ FixedComplexNDArray::FixedComplexNDArray (const NDArray &is, const NDArray &ds, const FixedComplexNDArray& a) - : MArrayN (a.dims()) + : MArray (a.dims()) { if ((dims() != is.dims()) || (dims() != ds.dims())) { (*current_liboctave_error_handler) ("NDArray size mismatch"); @@ -134,7 +134,7 @@ FixedComplexNDArray::FixedComplexNDArray (const ComplexNDArray &is, const ComplexNDArray &ds, const FixedComplexNDArray& a) - : MArrayN (a.dims()) + : MArray (a.dims()) { if ((dims() != is.dims()) || (dims() != ds.dims())) { (*current_liboctave_error_handler) ("NDArray size mismatch"); @@ -148,7 +148,7 @@ FixedComplexNDArray::FixedComplexNDArray (unsigned int is, unsigned int ds, const FixedNDArray& a) - : MArrayN (a.dims()) + : MArray (a.dims()) { for (int i = 0; i < nelem (); i++) elem (i) = FixedPointComplex(is, ds, a.elem (i)); @@ -156,16 +156,16 @@ FixedComplexNDArray::FixedComplexNDArray (Complex is, Complex ds, const FixedNDArray& a) - : MArrayN (a.dims()) + : MArray (a.dims()) { for (int i = 0; i < nelem (); i++) elem (i) = FixedPointComplex(is, ds, FixedPointComplex(a.elem (i))); } -FixedComplexNDArray::FixedComplexNDArray (const MArrayN &is, - const MArrayN &ds, +FixedComplexNDArray::FixedComplexNDArray (const MArray &is, + const MArray &ds, const FixedNDArray& a) - : MArrayN (a.dims()) + : MArray (a.dims()) { if ((dims() != is.dims()) || (dims() != ds.dims())) { (*current_liboctave_error_handler) ("NDArray size mismatch"); @@ -180,7 +180,7 @@ FixedComplexNDArray::FixedComplexNDArray (const NDArray &is, const NDArray &ds, const FixedNDArray& a) - : MArrayN (a.dims()) + : MArray (a.dims()) { if ((dims() != is.dims()) || (dims() != ds.dims())) { (*current_liboctave_error_handler) ("NDArray size mismatch"); @@ -195,7 +195,7 @@ FixedComplexNDArray::FixedComplexNDArray (const ComplexNDArray &is, const ComplexNDArray &ds, const FixedNDArray& a) - : MArrayN (a.dims()) + : MArray (a.dims()) { if ((dims() != is.dims()) || (dims() != ds.dims())) { (*current_liboctave_error_handler) ("NDArray size mismatch"); @@ -209,7 +209,7 @@ FixedComplexNDArray::FixedComplexNDArray (unsigned int is, unsigned int ds, const ComplexNDArray& a) - : MArrayN (a.dims()) + : MArray (a.dims()) { for (int i = 0; i < nelem (); i++) elem (i) = FixedPointComplex(is, ds, a.elem (i)); @@ -217,16 +217,16 @@ FixedComplexNDArray::FixedComplexNDArray (Complex is, Complex ds, const ComplexNDArray& a) - : MArrayN (a.dims()) + : MArray (a.dims()) { for (int i = 0; i < nelem (); i++) elem (i) = FixedPointComplex(is, ds, a.elem (i)); } -FixedComplexNDArray::FixedComplexNDArray (const MArrayN &is, - const MArrayN &ds, +FixedComplexNDArray::FixedComplexNDArray (const MArray &is, + const MArray &ds, const ComplexNDArray& a) - : MArrayN (a.dims()) + : MArray (a.dims()) { if ((dims() != is.dims()) || (dims() != ds.dims())) { (*current_liboctave_error_handler) ("NDArray size mismatch"); @@ -241,7 +241,7 @@ FixedComplexNDArray::FixedComplexNDArray (const NDArray &is, const NDArray &ds, const ComplexNDArray& a) - : MArrayN (a.dims()) + : MArray (a.dims()) { if ((dims() != is.dims()) || (dims() != ds.dims())) { (*current_liboctave_error_handler) ("NDArray size mismatch"); @@ -256,7 +256,7 @@ FixedComplexNDArray::FixedComplexNDArray (const ComplexNDArray &is, const ComplexNDArray &ds, const ComplexNDArray& a) - : MArrayN (a.dims()) + : MArray (a.dims()) { if ((dims() != is.dims()) || (dims() != ds.dims())) { (*current_liboctave_error_handler) ("NDArray size mismatch"); @@ -270,7 +270,7 @@ FixedComplexNDArray::FixedComplexNDArray (unsigned int is, unsigned int ds, const NDArray& a) - : MArrayN (a.dims()) + : MArray (a.dims()) { for (int i = 0; i < nelem (); i++) elem (i) = FixedPointComplex(is, ds, a.elem (i)); @@ -278,16 +278,16 @@ FixedComplexNDArray::FixedComplexNDArray (Complex is, Complex ds, const NDArray& a) - : MArrayN (a.dims()) + : MArray (a.dims()) { for (int i = 0; i < nelem (); i++) elem (i) = FixedPointComplex(is, ds, a.elem (i)); } -FixedComplexNDArray::FixedComplexNDArray (const MArrayN &is, - const MArrayN &ds, +FixedComplexNDArray::FixedComplexNDArray (const MArray &is, + const MArray &ds, const NDArray& a) - : MArrayN (a.dims()) + : MArray (a.dims()) { if ((dims() != is.dims()) || (dims() != ds.dims())) { (*current_liboctave_error_handler) ("NDArray size mismatch"); @@ -302,7 +302,7 @@ FixedComplexNDArray::FixedComplexNDArray (const NDArray &is, const NDArray &ds, const NDArray& a) - : MArrayN (a.dims()) + : MArray (a.dims()) { if ((dims() != is.dims()) || (dims() != ds.dims())) { (*current_liboctave_error_handler) ("NDArray size mismatch"); @@ -317,7 +317,7 @@ FixedComplexNDArray::FixedComplexNDArray (const ComplexNDArray &is, const ComplexNDArray &ds, const NDArray& a) - : MArrayN (a.dims()) + : MArray (a.dims()) { if ((dims() != is.dims()) || (dims() != ds.dims())) { (*current_liboctave_error_handler) ("NDArray size mismatch"); @@ -332,7 +332,7 @@ unsigned int ds, const ComplexNDArray& a, const ComplexNDArray& b) - : MArrayN (a.dims()) + : MArray (a.dims()) { if (dims() != b.dims()) { (*current_liboctave_error_handler) ("NDArray size mismatch"); @@ -346,7 +346,7 @@ FixedComplexNDArray::FixedComplexNDArray (Complex is, Complex ds, const ComplexNDArray& a, const ComplexNDArray& b) - : MArrayN (a.dims()) + : MArray (a.dims()) { if (dims() != b.dims()) { (*current_liboctave_error_handler) ("NDArray size mismatch"); @@ -357,11 +357,11 @@ elem (i) = FixedPointComplex(is, ds, a.elem (i), b.elem (i)); } -FixedComplexNDArray::FixedComplexNDArray (const MArrayN &is, - const MArrayN &ds, +FixedComplexNDArray::FixedComplexNDArray (const MArray &is, + const MArray &ds, const ComplexNDArray& a, const ComplexNDArray& b) - : MArrayN (a.dims()) + : MArray (a.dims()) { if ((dims() != b.dims()) || (dims() != is.dims()) || (dims() != ds.dims())) { @@ -377,7 +377,7 @@ const NDArray &ds, const ComplexNDArray& a, const ComplexNDArray& b) - : MArrayN (a.dims()) + : MArray (a.dims()) { if ((dims() != b.dims()) || (dims() != is.dims()) || (dims() != ds.dims())) { @@ -394,7 +394,7 @@ FixedComplexNDArray::FixedComplexNDArray (const ComplexNDArray &is, const ComplexNDArray &ds, const ComplexNDArray& a, const ComplexNDArray& b) - : MArrayN (a.dims()) + : MArray (a.dims()) { if ((dims() != b.dims()) || (dims() != is.dims()) || (dims() != ds.dims())) { @@ -407,7 +407,7 @@ } FixedComplexNDArray::FixedComplexNDArray (const FixedNDArray& m) - : MArrayN (m.dims (), FixedPointComplex()) + : MArray (m.dims (), FixedPointComplex()) { for (int i = 0; i < nelem (); i++) elem (i) = FixedPointComplex(m.elem (i)); @@ -415,7 +415,7 @@ FixedComplexNDArray::FixedComplexNDArray (const FixedNDArray& a, const FixedNDArray& b) - : MArrayN (a.dims (), FixedPointComplex()) + : MArray (a.dims (), FixedPointComplex()) { if (dims() != b.dims()) { (*current_liboctave_error_handler) ("NDArray size mismatch"); @@ -576,43 +576,43 @@ boolNDArray FixedComplexNDArray::all (octave_idx_type dim) const { - return do_mx_red_op (*this, dim, mx_inline_all); + return do_mx_red_op (*this, dim, mx_inline_all); } boolNDArray FixedComplexNDArray::any (octave_idx_type dim) const { - return do_mx_red_op (*this, dim, mx_inline_any); + return do_mx_red_op (*this, dim, mx_inline_any); } FixedComplexNDArray FixedComplexNDArray::cumprod (octave_idx_type dim) const { - return do_mx_cum_op (*this, dim, mx_inline_cumprod); + return do_mx_cum_op (*this, dim, mx_inline_cumprod); } FixedComplexNDArray FixedComplexNDArray::cumsum (octave_idx_type dim) const { - return do_mx_cum_op (*this, dim, mx_inline_cumsum); + return do_mx_cum_op (*this, dim, mx_inline_cumsum); } FixedComplexNDArray FixedComplexNDArray::prod (octave_idx_type dim) const { - return do_mx_red_op (*this, dim, mx_inline_prod); + return do_mx_red_op (*this, dim, mx_inline_prod); } FixedComplexNDArray FixedComplexNDArray::sum (octave_idx_type dim) const { - return do_mx_red_op (*this, dim, mx_inline_sum); + return do_mx_red_op (*this, dim, mx_inline_sum); } FixedComplexNDArray FixedComplexNDArray::sumsq (octave_idx_type dim) const { - return do_mx_red_op (*this, dim, mx_inline_sumsq); + return do_mx_red_op (*this, dim, mx_inline_sumsq); } FixedNDArray @@ -708,23 +708,23 @@ FixedComplexNDArray elem_pow (const FixedComplexNDArray &a, const FixedPointComplex &b) { - return elem_pow (a, FixedComplexNDArray(dim_vector(1), b)); + return elem_pow (a, FixedComplexNDArray(dim_vector (1, 1), b)); } FixedComplexNDArray elem_pow (const FixedPointComplex &a, const FixedComplexNDArray &b) { - return elem_pow (FixedComplexNDArray(dim_vector(1), a), b); + return elem_pow (FixedComplexNDArray(dim_vector (1, 1), a), b); } FixedComplexNDArray FixedComplexNDArray::max (octave_idx_type dim) const { - ArrayN dummy_idx; + Array dummy_idx; return max (dummy_idx, dim); } FixedComplexNDArray -FixedComplexNDArray::max (ArrayN& idx_arg, octave_idx_type dim) const +FixedComplexNDArray::max (Array& idx_arg, octave_idx_type dim) const { dim_vector dv = dims (); dim_vector dr = dims (); @@ -786,12 +786,12 @@ FixedComplexNDArray FixedComplexNDArray::min (octave_idx_type dim) const { - ArrayN dummy_idx; + Array dummy_idx; return min (dummy_idx, dim); } FixedComplexNDArray -FixedComplexNDArray::min (ArrayN& idx_arg, octave_idx_type dim) const +FixedComplexNDArray::min (Array& idx_arg, octave_idx_type dim) const { dim_vector dv = dims (); dim_vector dr = dims (); @@ -860,13 +860,13 @@ switch (nd) { case 1: - retval = FixedComplexMatrix (Array2 - (*this, dimensions(0), 1)); + retval = FixedComplexMatrix (Array + (*this, dim_vector (dimensions(0), 1))); break; case 2: - retval = FixedComplexMatrix (Array2 - (*this, dimensions(0), dimensions(1))); + retval = FixedComplexMatrix (Array + (*this, dim_vector (dimensions(0), dimensions(1)))); break; default: @@ -1094,14 +1094,14 @@ return result; } -NDS_CMP_OPS(FixedComplexNDArray, real, FixedPointComplex, real) -NDS_BOOL_OPS(FixedComplexNDArray, FixedPointComplex, FixedPointComplex()) +NDS_CMP_OPS(FixedComplexNDArray, FixedPointComplex) +NDS_BOOL_OPS(FixedComplexNDArray, FixedPointComplex) -SND_CMP_OPS(FixedPointComplex, real, FixedComplexNDArray, real) -SND_BOOL_OPS(FixedPointComplex, FixedComplexNDArray, FixedPointComplex()) +SND_CMP_OPS(FixedPointComplex, FixedComplexNDArray) +SND_BOOL_OPS(FixedPointComplex, FixedComplexNDArray) -NDND_CMP_OPS(FixedComplexNDArray, real, FixedComplexNDArray, real) -NDND_BOOL_OPS(FixedComplexNDArray, FixedComplexNDArray, FixedPointComplex()) +NDND_CMP_OPS(FixedComplexNDArray, FixedComplexNDArray) +NDND_BOOL_OPS(FixedComplexNDArray, FixedComplexNDArray) /* ;;; Local Variables: *** diff -r 954f2f00d782 -r d84d2fea3c90 main/fixed/src/fixedCNDArray.h --- a/main/fixed/src/fixedCNDArray.h Wed Feb 22 21:56:05 2012 +0000 +++ b/main/fixed/src/fixedCNDArray.h Wed Feb 22 22:07:33 2012 +0000 @@ -26,7 +26,7 @@ #if !defined (octave_FixedCNDArray_h) #define octave_FixedCNDArray_h 1 -#include +#include #include #include @@ -45,19 +45,19 @@ #include "fixedNDArray.h" class -FixedComplexNDArray : public MArrayN +FixedComplexNDArray : public MArray { public: - FixedComplexNDArray (void) : MArrayN () { } + FixedComplexNDArray (void) : MArray () { } FixedComplexNDArray (const dim_vector& dv) - : MArrayN (dv) { } + : MArray (dv) { } FixedComplexNDArray (const dim_vector& dv, const FixedPointComplex val) : - MArrayN (dv, val) { } + MArray (dv, val) { } - FixedComplexNDArray (const MArrayN &is, const MArrayN &ds); + FixedComplexNDArray (const MArray &is, const MArray &ds); FixedComplexNDArray (const NDArray &is, const NDArray &ds); @@ -69,7 +69,7 @@ FixedComplexNDArray (Complex is, Complex ds, const FixedComplexNDArray& a); - FixedComplexNDArray (const MArrayN &is, const MArrayN &ds, + FixedComplexNDArray (const MArray &is, const MArray &ds, const FixedComplexNDArray& a); FixedComplexNDArray (const NDArray &is, const NDArray &ds, @@ -83,7 +83,7 @@ FixedComplexNDArray (Complex is, Complex ds, const FixedNDArray& a); - FixedComplexNDArray (const MArrayN &is, const MArrayN &ds, + FixedComplexNDArray (const MArray &is, const MArray &ds, const FixedNDArray& a); FixedComplexNDArray (const NDArray &is, const NDArray &ds, @@ -97,7 +97,7 @@ FixedComplexNDArray (Complex is, Complex ds, const ComplexNDArray& a); - FixedComplexNDArray (const MArrayN &is, const MArrayN & ds, + FixedComplexNDArray (const MArray &is, const MArray & ds, const ComplexNDArray& a); FixedComplexNDArray (const NDArray &is, const NDArray & ds, @@ -111,7 +111,7 @@ FixedComplexNDArray (Complex is, Complex ds, const NDArray& a); - FixedComplexNDArray (const MArrayN &is, const MArrayN & ds, + FixedComplexNDArray (const MArray &is, const MArray & ds, const NDArray& a); FixedComplexNDArray (const NDArray &is, const NDArray & ds, @@ -126,7 +126,7 @@ FixedComplexNDArray (Complex is, Complex ds, const ComplexNDArray &a, const ComplexNDArray &b); - FixedComplexNDArray (const MArrayN &is, const MArrayN &ds, + FixedComplexNDArray (const MArray &is, const MArray &ds, const ComplexNDArray &a, const ComplexNDArray &b); FixedComplexNDArray (const NDArray &is, const NDArray &ds, @@ -140,13 +140,13 @@ FixedComplexNDArray (const FixedNDArray& a, const FixedNDArray& b); FixedComplexNDArray (const FixedComplexNDArray& a) - : MArrayN (a) { } + : MArray (a) { } - FixedComplexNDArray (const MArrayN& a) - : MArrayN (a) { } + FixedComplexNDArray (const MArray& a) + : MArray (a) { } - FixedComplexNDArray (const ArrayN& a) - : MArrayN (a) { } + FixedComplexNDArray (const Array& a) + : MArray (a) { } ComplexNDArray sign (void) const; ComplexNDArray getdecsize (void) const; @@ -166,7 +166,7 @@ FixedComplexNDArray& operator = (const FixedComplexNDArray& a) { - MArrayN::operator = (a); + MArray::operator = (a); return *this; } @@ -194,16 +194,16 @@ FixedComplexNDArray sumsq (octave_idx_type dim = -1) const; FixedComplexNDArray max (octave_idx_type dim = 0) const; - FixedComplexNDArray max (ArrayN& index, octave_idx_type dim = 0) const; + FixedComplexNDArray max (Array& index, octave_idx_type dim = 0) const; FixedComplexNDArray min (octave_idx_type dim = 0) const; - FixedComplexNDArray min (ArrayN& index, octave_idx_type dim = 0) const; + FixedComplexNDArray min (Array& index, octave_idx_type dim = 0) const; FixedNDArray abs (void) const; FixedComplexMatrix fixed_complex_matrix_value (void) const; FixedComplexNDArray squeeze (void) const - { return ArrayN::squeeze (); } + { return Array::squeeze (); } static void increment_index (Array& ra_idx, const dim_vector& dimensions, @@ -251,11 +251,6 @@ static FixedPointComplex resize_fill_value (void) { return FixedPointComplex(); } - -private: - - FixedComplexNDArray (FixedPointComplex *d, const dim_vector& dv) - : MArrayN (d, dv) { } }; @@ -330,7 +325,7 @@ NDND_CMP_OP_DECLS (FixedComplexNDArray, FixedComplexNDArray, ) NDND_BOOL_OP_DECLS (FixedComplexNDArray, FixedComplexNDArray, ) -MARRAY_FORWARD_DEFS (MArrayN, FixedComplexNDArray, FixedPointComplex) +MARRAY_FORWARD_DEFS (MArray, FixedComplexNDArray, FixedPointComplex) #endif diff -r 954f2f00d782 -r d84d2fea3c90 main/fixed/src/fixedCRowVector.cc --- a/main/fixed/src/fixedCRowVector.cc Wed Feb 22 21:56:05 2012 +0000 +++ b/main/fixed/src/fixedCRowVector.cc Wed Feb 22 22:07:33 2012 +0000 @@ -40,7 +40,7 @@ // Fixed Point Complex Row Vector class FixedComplexRowVector::FixedComplexRowVector (const MArray &is, - const MArray &ds) : MArray (is.length()) + const MArray &ds) : MArray (dim_vector (1, is.length())) { if (length() != ds.length()) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -52,7 +52,7 @@ } FixedComplexRowVector::FixedComplexRowVector (const RowVector &is, - const RowVector &ds) : MArray (is.length()) + const RowVector &ds) : MArray (dim_vector (1, is.length())) { if (length() != ds.length()) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -64,7 +64,7 @@ } FixedComplexRowVector::FixedComplexRowVector (const ComplexRowVector &is, - const ComplexRowVector &ds) : MArray (is.length()) + const ComplexRowVector &ds) : MArray (dim_vector (1, is.length())) { if (length() != ds.length()) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -77,7 +77,7 @@ FixedComplexRowVector::FixedComplexRowVector (unsigned int is, unsigned int ds, const FixedComplexRowVector& a) : - MArray (a.length()) + MArray (dim_vector (1, a.length())) { for (int i = 0; i < length (); i++) elem (i) = FixedPointComplex(is, ds, a(i)); @@ -85,7 +85,7 @@ FixedComplexRowVector::FixedComplexRowVector (Complex is, Complex ds, const FixedComplexRowVector& a) : - MArray (a.length()) + MArray (dim_vector (1, a.length())) { for (int i = 0; i < length (); i++) elem (i) = FixedPointComplex(is, ds, a(i)); @@ -93,7 +93,7 @@ FixedComplexRowVector::FixedComplexRowVector (const MArray &is, const MArray &ds, const FixedComplexRowVector& a) : - MArray (is.length()) + MArray (dim_vector (1, is.length())) { if ((length() != ds.length()) || (length() != a.length())) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -107,7 +107,7 @@ FixedComplexRowVector::FixedComplexRowVector (const RowVector &is, const RowVector &ds, const FixedComplexRowVector& a) : - MArray (is.length()) + MArray (dim_vector (1, is.length())) { if ((length() != ds.length()) || (length() != a.length())) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -121,7 +121,7 @@ FixedComplexRowVector::FixedComplexRowVector (const ComplexRowVector &is, const ComplexRowVector &ds, const FixedComplexRowVector& a) : - MArray (is.length()) + MArray (dim_vector (1, is.length())) { if ((length() != ds.length()) || (length() != a.length())) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -134,7 +134,7 @@ FixedComplexRowVector::FixedComplexRowVector (unsigned int is, unsigned int ds, const FixedRowVector& a) : - MArray (a.length()) + MArray (dim_vector (1, a.length())) { for (int i = 0; i < length (); i++) elem (i) = FixedPointComplex(is, ds, a(i)); @@ -142,7 +142,7 @@ FixedComplexRowVector::FixedComplexRowVector (Complex is, Complex ds, const FixedRowVector& a) : - MArray (a.length()) + MArray (dim_vector (1, a.length())) { for (int i = 0; i < length (); i++) elem (i) = FixedPointComplex(is, ds, FixedPointComplex(a(i))); @@ -150,7 +150,7 @@ FixedComplexRowVector::FixedComplexRowVector (const MArray &is, const MArray &ds, const FixedRowVector& a) : - MArray (is.length()) + MArray (dim_vector (1, is.length())) { if ((length() != ds.length()) || (length() != a.length())) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -164,7 +164,7 @@ FixedComplexRowVector::FixedComplexRowVector (const RowVector &is, const RowVector &ds, const FixedRowVector& a) : - MArray (is.length()) + MArray (dim_vector (1, is.length())) { if ((length() != ds.length()) || (length() != a.length())) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -178,7 +178,7 @@ FixedComplexRowVector::FixedComplexRowVector (const ComplexRowVector &is, const ComplexRowVector &ds, const FixedRowVector& a) : - MArray (is.length()) + MArray (dim_vector (1, is.length())) { if ((length() != ds.length()) || (length() != a.length())) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -191,7 +191,7 @@ FixedComplexRowVector::FixedComplexRowVector (unsigned int is, unsigned int ds, const ComplexRowVector& a) : - MArray (a.length()) + MArray (dim_vector (1, a.length())) { for (int i = 0; i < length (); i++) elem (i) = FixedPointComplex(is, ds, a(i)); @@ -199,7 +199,7 @@ FixedComplexRowVector::FixedComplexRowVector (Complex is, Complex ds, const ComplexRowVector& a) : - MArray (a.length()) + MArray (dim_vector (1, a.length())) { for (int i = 0; i < length (); i++) elem (i) = FixedPointComplex(is, ds, a(i)); @@ -207,7 +207,7 @@ FixedComplexRowVector::FixedComplexRowVector (const MArray &is, const MArray &ds, const ComplexRowVector& a) : - MArray (is.length()) + MArray (dim_vector (1, is.length())) { if ((length() != ds.length()) || (length() != a.length())) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -221,7 +221,7 @@ FixedComplexRowVector::FixedComplexRowVector (const RowVector &is, const RowVector &ds, const ComplexRowVector& a) : - MArray (is.length()) + MArray (dim_vector (1, is.length())) { if ((length() != ds.length()) || (length() != a.length())) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -235,7 +235,7 @@ FixedComplexRowVector::FixedComplexRowVector (const ComplexRowVector &is, const ComplexRowVector &ds, const ComplexRowVector& a) : - MArray (is.length()) + MArray (dim_vector (1, is.length())) { if ((length() != ds.length()) || (length() != a.length())) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -248,7 +248,7 @@ FixedComplexRowVector::FixedComplexRowVector (unsigned int is, unsigned int ds, const RowVector& a) : - MArray (a.length()) + MArray (dim_vector (1, a.length())) { for (int i = 0; i < length (); i++) elem (i) = FixedPointComplex(is, ds, a(i)); @@ -256,7 +256,7 @@ FixedComplexRowVector::FixedComplexRowVector (Complex is, Complex ds, const RowVector& a) : - MArray (a.length()) + MArray (dim_vector (1, a.length())) { for (int i = 0; i < length (); i++) elem (i) = FixedPointComplex(is, ds, a(i)); @@ -264,7 +264,7 @@ FixedComplexRowVector::FixedComplexRowVector (const MArray &is, const MArray &ds, const RowVector& a) : - MArray (is.length()) + MArray (dim_vector (1, is.length())) { if ((length() != ds.length()) || (length() != a.length())) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -278,7 +278,7 @@ FixedComplexRowVector::FixedComplexRowVector (const RowVector &is, const RowVector &ds, const RowVector& a) : - MArray (is.length()) + MArray (dim_vector (1, is.length())) { if ((length() != ds.length()) || (length() != a.length())) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -292,7 +292,7 @@ FixedComplexRowVector::FixedComplexRowVector (const ComplexRowVector &is, const ComplexRowVector &ds, const RowVector& a) : - MArray (is.length()) + MArray (dim_vector (1, is.length())) { if ((length() != ds.length()) || (length() != a.length())) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -305,7 +305,7 @@ FixedComplexRowVector::FixedComplexRowVector (unsigned int is, unsigned int ds, const ComplexRowVector& a, - const ComplexRowVector& b) : MArray (a.length()) + const ComplexRowVector& b) : MArray (dim_vector (1, a.length())) { if (length() != b.length()) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -318,7 +318,7 @@ FixedComplexRowVector::FixedComplexRowVector (Complex is, Complex ds, const ComplexRowVector& a, const ComplexRowVector& b) : - MArray (a.length()) + MArray (dim_vector (1, a.length())) { if (length() != b.length()) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -331,7 +331,7 @@ FixedComplexRowVector::FixedComplexRowVector (const MArray &is, const MArray &ds, const ComplexRowVector& a, - const ComplexRowVector& b) : MArray (is.length()) + const ComplexRowVector& b) : MArray (dim_vector (1, is.length())) { if ((length() != ds.length()) || (length() != a.length()) || (length() != b.length())) { @@ -346,7 +346,7 @@ FixedComplexRowVector::FixedComplexRowVector (const RowVector &is, const RowVector &ds, const ComplexRowVector& a, - const ComplexRowVector& b) : MArray (is.length()) + const ComplexRowVector& b) : MArray (dim_vector (1, is.length())) { if ((length() != ds.length()) || (length() != a.length()) || (length() != b.length())) { @@ -361,7 +361,7 @@ FixedComplexRowVector::FixedComplexRowVector (const ComplexRowVector &is, const ComplexRowVector &ds, const ComplexRowVector& a, - const ComplexRowVector& b) : MArray (is.length()) + const ComplexRowVector& b) : MArray (dim_vector (1, is.length())) { if ((length() != ds.length()) || (length() != a.length()) || (length() != b.length())) { @@ -468,7 +468,7 @@ FixedComplexRowVector FixedComplexRowVector::incdecsize () { - return chdecsize(1 + getdecsize()); + return chdecsize(Complex (1) + getdecsize()); } FixedComplexRowVector @@ -487,7 +487,7 @@ FixedComplexRowVector FixedComplexRowVector::incintsize () { - return chintsize(1 + getintsize()); + return chintsize(Complex (1) + getintsize()); } // Fixed Point Complex Row Vector class. diff -r 954f2f00d782 -r d84d2fea3c90 main/fixed/src/fixedCRowVector.h --- a/main/fixed/src/fixedCRowVector.h Wed Feb 22 21:56:05 2012 +0000 +++ b/main/fixed/src/fixedCRowVector.h Wed Feb 22 22:07:33 2012 +0000 @@ -53,10 +53,10 @@ FixedComplexRowVector (void) : MArray () { } - explicit FixedComplexRowVector (int n) : MArray (n) { } + explicit FixedComplexRowVector (int n) : MArray (dim_vector (1, n)) { } FixedComplexRowVector (int n, FixedPointComplex val) : - MArray (n, val) { } + MArray (dim_vector (1, n), val) { } FixedComplexRowVector (const MArray &is, const MArray & ds); @@ -240,9 +240,11 @@ friend std::ostream& operator << (std::ostream& os, const FixedComplexRowVector& a); friend std::istream& operator >> (std::istream& is, FixedComplexRowVector& a); -private: - - FixedComplexRowVector (FixedPointComplex *d, int l) : MArray (d, l) { } + void resize (octave_idx_type n, + const FixedPointComplex& rfv = Array::resize_fill_value ()) + { + Array::resize (dim_vector (1, n), rfv); + } }; FixedPointComplex operator * (const FixedComplexRowVector& a, diff -r 954f2f00d782 -r d84d2fea3c90 main/fixed/src/fixedColVector.cc --- a/main/fixed/src/fixedColVector.cc Wed Feb 22 21:56:05 2012 +0000 +++ b/main/fixed/src/fixedColVector.cc Wed Feb 22 22:07:33 2012 +0000 @@ -41,7 +41,7 @@ FixedColumnVector::FixedColumnVector (const MArray &is, const MArray &ds) - : MArray (is.length()) + : MArray (dim_vector (is.length(), 1)) { if (length() != ds.length()) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -54,7 +54,7 @@ FixedColumnVector::FixedColumnVector (const ColumnVector &is, const ColumnVector &ds) - : MArray (is.length()) + : MArray (dim_vector (is.length(), 1)) { if (length() != ds.length()) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -66,8 +66,9 @@ } FixedColumnVector::FixedColumnVector (const MArray &is, - const MArray &ds, const FixedColumnVector& a) - : MArray (a.length()) + const MArray &ds, + const FixedColumnVector& a) + : MArray (dim_vector (a.length(), 1)) { if ((length() != is.length()) || (length() != ds.length())) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -80,8 +81,9 @@ } FixedColumnVector::FixedColumnVector (const ColumnVector &is, - const ColumnVector &ds, const FixedColumnVector& a) - : MArray (a.length()) + const ColumnVector &ds, + const FixedColumnVector& a) + : MArray (dim_vector (a.length(), 1)) { if ((length() != is.length()) || (length() != ds.length())) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -95,15 +97,16 @@ FixedColumnVector::FixedColumnVector (unsigned int is, unsigned int ds, const FixedColumnVector& a) - : MArray (a.length()) + : MArray (dim_vector (a.length(), 1)) { for (int i = 0; i < length (); i++) elem (i) = FixedPoint(is, ds, a.elem (i)); } FixedColumnVector::FixedColumnVector (const MArray &is, - const MArray &ds, const ColumnVector& a) - : MArray (a.length()) + const MArray &ds, + const ColumnVector& a) + : MArray (dim_vector (a.length(), 1)) { if ((length() != is.length()) || (length() != ds.length())) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -116,8 +119,9 @@ } FixedColumnVector::FixedColumnVector (const ColumnVector &is, - const ColumnVector &ds, const ColumnVector& a) - : MArray (a.length()) + const ColumnVector &ds, + const ColumnVector& a) + : MArray (dim_vector (a.length(), 1)) { if ((length() != is.length()) || (length() != ds.length())) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -131,16 +135,17 @@ FixedColumnVector::FixedColumnVector (unsigned int is, unsigned int ds, const ColumnVector& a) - : MArray (a.length()) + : MArray (dim_vector (a.length(), 1)) { for (int i = 0; i < length (); i++) elem (i) = FixedPoint(is, ds, a.elem (i)); } FixedColumnVector::FixedColumnVector (const MArray &is, - const MArray &ds, const ColumnVector& a, + const MArray &ds, + const ColumnVector& a, const ColumnVector& b) - : MArray (a.length()) + : MArray (dim_vector (a.length(), 1)) { if ((length() != b.length()) || (length() != is.length()) || (length() != ds.length())) { @@ -155,9 +160,10 @@ } FixedColumnVector::FixedColumnVector (const ColumnVector &is, - const ColumnVector &ds, const ColumnVector& a, + const ColumnVector &ds, + const ColumnVector& a, const ColumnVector& b) - : MArray (a.length()) + : MArray (dim_vector (a.length(), 1)) { if ((length() != b.length()) || (length() != is.length()) || (length() != ds.length())) { @@ -171,9 +177,11 @@ (unsigned int)b.elem (i)); } -FixedColumnVector::FixedColumnVector (unsigned int is, unsigned int ds, - const ColumnVector& a, const ColumnVector& b) - : MArray (a.length()) +FixedColumnVector::FixedColumnVector (unsigned int is, + unsigned int ds, + const ColumnVector& a, + const ColumnVector& b) + : MArray (dim_vector (a.length(), 1)) { if (length() != b.length()) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -446,7 +454,7 @@ gripe_nonconformant ("operator *", nr, nc, a_len, 1); else { - retval.resize (nr, FixedPoint()); + retval.resize (nr, FixedPoint()); if (nr != 0 && nc != 0) for (int i = 0; i < nc; i++) for (int j = 0; j < nr; j++) @@ -551,21 +559,21 @@ if (a_len == 1) { - retval.resize(b_len); + retval.resize(b_len); FixedPoint ad = a(0); for (int i = 0; i < b_len; i++) retval(i) = pow(ad, b(i)); } else if (b_len == 1) { - retval.resize(a_len); + retval.resize(a_len); FixedPoint bd = b(0); for (int i = 0; i < a_len; i++) retval(i) = pow(a(i), bd); } else if (a_len == b_len) { - retval.resize(a_len); + retval.resize(a_len, 1); for (int i = 0; i < a_len; i++) retval(i) = pow(a(i), b(i)); } diff -r 954f2f00d782 -r d84d2fea3c90 main/fixed/src/fixedColVector.h --- a/main/fixed/src/fixedColVector.h Wed Feb 22 21:56:05 2012 +0000 +++ b/main/fixed/src/fixedColVector.h Wed Feb 22 22:07:33 2012 +0000 @@ -50,7 +50,8 @@ FixedColumnVector (void) : MArray () { } - explicit FixedColumnVector (int n) : MArray (n) { } + explicit FixedColumnVector (int n) + : MArray (dim_vector (n, 1)) { } FixedColumnVector (const MArray &is, const MArray &ds); @@ -82,7 +83,8 @@ FixedColumnVector (const ColumnVector &is, const ColumnVector &ds, const ColumnVector& a, const ColumnVector& b); - FixedColumnVector (int n, FixedPoint val) : MArray (n, val) { } + FixedColumnVector (int n, FixedPoint val) + : MArray (dim_vector (n,1), val) { } FixedColumnVector (const FixedColumnVector& a) : MArray (a) { } @@ -140,7 +142,8 @@ FixedPoint min (void) const; FixedPoint max (void) const; - friend FixedColumnVector operator * (const FixedMatrix& a, const FixedColumnVector& b); + friend FixedColumnVector operator * (const FixedMatrix& a, + const FixedColumnVector& b); friend FixedColumnVector real (const FixedColumnVector &x); friend FixedColumnVector imag (const FixedColumnVector &x); @@ -174,15 +177,21 @@ // i/o - friend std::ostream& operator << (std::ostream& os, const FixedColumnVector& a); - friend std::istream& operator >> (std::istream& is, FixedColumnVector& a); + friend std::ostream& operator << (std::ostream& os, + const FixedColumnVector& a); + friend std::istream& operator >> (std::istream& is, + FixedColumnVector& a); -private: + void resize (octave_idx_type n, + const FixedPoint& rfv = Array::resize_fill_value ()) + { + Array::resize (dim_vector (n, 1), rfv); + } - FixedColumnVector (FixedPoint *d, int l) : MArray (d, l) { } }; -FixedColumnVector operator * (const FixedMatrix& a, const FixedColumnVector& b); +FixedColumnVector operator * (const FixedMatrix& a, + const FixedColumnVector& b); FixedColumnVector real (const FixedColumnVector &x); FixedColumnVector imag (const FixedColumnVector &x); diff -r 954f2f00d782 -r d84d2fea3c90 main/fixed/src/fixedComplex.h --- a/main/fixed/src/fixedComplex.h Wed Feb 22 21:56:05 2012 +0000 +++ b/main/fixed/src/fixedComplex.h Wed Feb 22 22:07:33 2012 +0000 @@ -122,6 +122,8 @@ (unsigned int)a.imag(), (unsigned int)b.imag())) { } + operator bool () const { return fixedpoint() != 0.0; } + Complex sign (void) const; Complex getdecsize (void) const; Complex getintsize (void) const; diff -r 954f2f00d782 -r d84d2fea3c90 main/fixed/src/fixedMatrix.cc --- a/main/fixed/src/fixedMatrix.cc Wed Feb 22 21:56:05 2012 +0000 +++ b/main/fixed/src/fixedMatrix.cc Wed Feb 22 22:07:33 2012 +0000 @@ -44,8 +44,8 @@ // Fixed Point Matrix class. -FixedMatrix::FixedMatrix (const MArray2 &is, const MArray2 &ds) - : MArray2 (is.rows(), is.cols()) +FixedMatrix::FixedMatrix (const MArray &is, const MArray &ds) + : MArray (dim_vector (is.rows(), is.cols())) { if ((rows() != ds.rows()) || (cols() != ds.cols())) { (*current_liboctave_error_handler) ("matrix size mismatch"); @@ -59,7 +59,7 @@ FixedMatrix::FixedMatrix (const Matrix &is, const Matrix &ds) - : MArray2 (is.rows(), is.cols()) + : MArray (dim_vector (is.rows(), is.cols())) { if ((rows() != ds.rows()) || (cols() != ds.cols())) { (*current_liboctave_error_handler) ("matrix size mismatch"); @@ -71,9 +71,9 @@ elem (i, j) = FixedPoint((unsigned int)is(i,j), (unsigned int)ds(i,j)); } -FixedMatrix::FixedMatrix (const MArray2 &is, const MArray2 &ds, +FixedMatrix::FixedMatrix (const MArray &is, const MArray &ds, const FixedMatrix& a) - : MArray2 (a.rows(), a.cols()) + : MArray (dim_vector (a.rows(), a.cols())) { if ((rows() != is.rows()) || (cols() != is.cols()) || (rows() != ds.rows()) || (cols() != ds.cols())) { @@ -89,7 +89,7 @@ FixedMatrix::FixedMatrix (const Matrix &is, const Matrix &ds, const FixedMatrix& a) - : MArray2 (a.rows(), a.cols()) + : MArray (dim_vector (a.rows(), a.cols())) { if ((rows() != is.rows()) || (cols() != is.cols()) || (rows() != ds.rows()) || (cols() != ds.cols())) { @@ -105,16 +105,16 @@ FixedMatrix::FixedMatrix (unsigned int is, unsigned int ds, const FixedMatrix& a) - : MArray2 (a.rows(), a.cols()) + : MArray (dim_vector (a.rows(), a.cols())) { for (int j = 0; j < cols (); j++) for (int i = 0; i < rows (); i++) elem (i, j) = FixedPoint(is, ds, a.elem (i, j)); } -FixedMatrix::FixedMatrix (const MArray2 &is, const MArray2 &ds, +FixedMatrix::FixedMatrix (const MArray &is, const MArray &ds, const Matrix& a) - : MArray2 (a.rows(), a.cols()) + : MArray (dim_vector (a.rows(), a.cols())) { if ((rows() != is.rows()) || (cols() != is.cols()) || (rows() != ds.rows()) || (cols() != ds.cols())) { @@ -130,7 +130,7 @@ FixedMatrix::FixedMatrix (const Matrix &is, const Matrix &ds, const Matrix& a) - : MArray2 (a.rows(), a.cols()) + : MArray (dim_vector (a.rows(), a.cols())) { if ((rows() != is.rows()) || (cols() != is.cols()) || (rows() != ds.rows()) || (cols() != ds.cols())) { @@ -145,7 +145,7 @@ } FixedMatrix::FixedMatrix (unsigned int is, unsigned int ds, const Matrix& a) - : MArray2 (a.rows(), a.cols()) + : MArray (dim_vector (a.rows(), a.cols())) { for (int j = 0; j < cols (); j++) for (int i = 0; i < rows (); i++) @@ -154,7 +154,7 @@ FixedMatrix::FixedMatrix (unsigned int is, unsigned int ds, const Matrix& a, const Matrix& b) - : MArray2 (a.rows(), a.cols()) + : MArray (dim_vector (a.rows(), a.cols())) { if ((rows() != b.rows()) || (cols() != b.cols())) { (*current_liboctave_error_handler) ("matrix size mismatch"); @@ -167,9 +167,9 @@ (unsigned int)b.elem (i,j)); } -FixedMatrix::FixedMatrix (const MArray2 &is, const MArray2 &ds, +FixedMatrix::FixedMatrix (const MArray &is, const MArray &ds, const Matrix& a, const Matrix& b) - : MArray2 (a.rows(), a.cols()) + : MArray (dim_vector (a.rows(), a.cols())) { if ((rows() != b.rows()) || (cols() != b.cols()) || (rows() != is.rows()) || (cols() != is.cols()) || (rows() != ds.rows()) @@ -187,7 +187,7 @@ FixedMatrix::FixedMatrix (const Matrix &is, const Matrix &ds, const Matrix& a, const Matrix& b) - : MArray2 (a.rows(), a.cols()) + : MArray (dim_vector (a.rows(), a.cols())) { if ((rows() != b.rows()) || (cols() != b.cols()) || (rows() != is.rows()) || (cols() != is.cols()) || (rows() != ds.rows()) @@ -203,8 +203,8 @@ (unsigned int)b.elem (i,j)); } -FixedMatrix::FixedMatrix (const MArray2 &a) - : MArray2 (a.rows(), a.cols()) +FixedMatrix::FixedMatrix (const MArray &a) + : MArray (dim_vector (a.rows(), a.cols())) { for (int j = 0; j < cols (); j++) @@ -213,7 +213,7 @@ } FixedMatrix::FixedMatrix (const Matrix &a) - : MArray2 (a.rows(), a.cols()) + : MArray (dim_vector (a.rows(), a.cols())) { for (int j = 0; j < cols (); j++) @@ -222,14 +222,14 @@ } FixedMatrix::FixedMatrix (const FixedRowVector& rv) - : MArray2 (1, rv.length (), FixedPoint()) + : MArray (dim_vector (1, rv.length ()), FixedPoint()) { for (int i = 0; i < rv.length (); i++) elem (0, i) = rv.elem (i); } FixedMatrix::FixedMatrix (const FixedColumnVector& cv) - : MArray2 (cv.length (), 1, FixedPoint()) + : MArray (dim_vector (cv.length (), 1), FixedPoint()) { for (int i = 0; i < cv.length (); i++) elem (i, 0) = cv.elem (i); @@ -262,7 +262,7 @@ { int nr = rows(); int nc = cols(); - FixedMatrix retval(nr,nc); + FixedMatrix retval(dim_vector (nr,nc)); for (int i = 0; i < nr; i++) for (int j = 0; j < nc; j++) @@ -282,7 +282,7 @@ return FixedMatrix(); } - FixedMatrix retval(nr,nc); + FixedMatrix retval(dim_vector (nr, nc)); for (int i = 0; i < nr; i++) for (int j = 0; j < nc; j++) @@ -296,7 +296,7 @@ { int nr = rows(); int nc = cols(); - FixedMatrix retval(nr,nc); + FixedMatrix retval(dim_vector (nr, nc)); for (int i = 0; i < nr; i++) for (int j = 0; j < nc; j++) @@ -316,7 +316,7 @@ return FixedMatrix(); } - FixedMatrix retval(nr,nc); + FixedMatrix retval(dim_vector (nr, nc)); for (int i = 0; i < nr; i++) for (int j = 0; j < nc; j++) @@ -418,7 +418,7 @@ FixedMatrix& FixedMatrix::insert (const FixedMatrix& a, int r, int c) { - Array2::insert (a, r, c); + Array::insert (a, r, c); return *this; } @@ -761,7 +761,7 @@ { int a_len = a.length (); - retval.resize (len, a_len); + retval.resize (len, a_len); for (int i = 0; i < len; i++) for (int j = 0; j < a_len; j++) @@ -794,43 +794,43 @@ boolMatrix FixedMatrix::all (int dim) const { - return do_mx_red_op (*this, dim, mx_inline_all); + return do_mx_red_op (*this, dim, mx_inline_all); } boolMatrix FixedMatrix::any (int dim) const { - return do_mx_red_op (*this, dim, mx_inline_any); + return do_mx_red_op (*this, dim, mx_inline_any); } FixedMatrix FixedMatrix::cumprod (int dim) const { - return do_mx_cum_op (*this, dim, mx_inline_cumprod); + return do_mx_cum_op (*this, dim, mx_inline_cumprod); } FixedMatrix FixedMatrix::cumsum (int dim) const { - return do_mx_cum_op (*this, dim, mx_inline_cumsum); + return do_mx_cum_op (*this, dim, mx_inline_cumsum); } FixedMatrix FixedMatrix::prod (int dim) const { - return do_mx_red_op (*this, dim, mx_inline_prod); + return do_mx_red_op (*this, dim, mx_inline_prod); } FixedMatrix FixedMatrix::sum (int dim) const { - return do_mx_red_op (*this, dim, mx_inline_sum); + return do_mx_red_op (*this, dim, mx_inline_sum); } FixedMatrix FixedMatrix::sumsq (int dim) const { - return do_mx_red_op (*this, dim, mx_inline_sumsq); + return do_mx_red_op (*this, dim, mx_inline_sumsq); } FixedMatrix @@ -912,7 +912,7 @@ if (nr > 0 && nc > 0) { result.resize (nr); - index.resize (nr); + index.resize (dim_vector (nr, 1)); for (int i = 0; i < nr; i++) { @@ -956,7 +956,7 @@ if (nr > 0 && nc > 0) { result.resize (nr); - index.resize (nr); + index.resize (dim_vector (nr, 1)); for (int i = 0; i < nr; i++) { @@ -1000,7 +1000,7 @@ if (nr > 0 && nc > 0) { result.resize (nc); - index.resize (nc); + index.resize (dim_vector (1, nc)); for (int j = 0; j < nc; j++) { @@ -1044,7 +1044,7 @@ if (nr > 0 && nc > 0) { result.resize (nc); - index.resize (nc); + index.resize (dim_vector (1, nc)); for (int j = 0; j < nc; j++) { @@ -1440,14 +1440,14 @@ return result; } -MS_CMP_OPS(FixedMatrix, , FixedPoint, ) -MS_BOOL_OPS(FixedMatrix, FixedPoint, FixedPoint()) +MS_CMP_OPS(FixedMatrix, FixedPoint) +MS_BOOL_OPS(FixedMatrix, FixedPoint) -SM_CMP_OPS(FixedPoint, , FixedMatrix, ) -SM_BOOL_OPS(FixedPoint, FixedMatrix, FixedPoint()) +SM_CMP_OPS(FixedPoint, FixedMatrix) +SM_BOOL_OPS(FixedPoint, FixedMatrix) -MM_CMP_OPS(FixedMatrix, , FixedMatrix, ) -MM_BOOL_OPS(FixedMatrix, FixedMatrix, FixedPoint()) +MM_CMP_OPS(FixedMatrix, FixedMatrix) +MM_BOOL_OPS(FixedMatrix, FixedMatrix) /* ;;; Local Variables: *** diff -r 954f2f00d782 -r d84d2fea3c90 main/fixed/src/fixedMatrix.h --- a/main/fixed/src/fixedMatrix.h Wed Feb 22 21:56:05 2012 +0000 +++ b/main/fixed/src/fixedMatrix.h Wed Feb 22 22:07:33 2012 +0000 @@ -26,7 +26,7 @@ #if !defined (octave_FixedMatrix_h) #define octave_FixedMatrix_h 1 -#include +#include #include #include @@ -50,32 +50,34 @@ class OCTAVE_FIXED_API -FixedMatrix : public MArray2 +FixedMatrix : public MArray { public: - FixedMatrix (void) : MArray2 () { } + FixedMatrix (void) : MArray () { } - FixedMatrix (const dim_vector& dv) : MArray2 (dv) { } + FixedMatrix (const dim_vector& dv) : MArray (dv) { } - FixedMatrix (int r, int c) : MArray2 (r, c) { } + FixedMatrix (int r, int c) + : MArray (dim_vector(r, c)) { } - FixedMatrix (int r, int c, const FixedPoint val) : MArray2 (r, c, val) { } + FixedMatrix (int r, int c, const FixedPoint val) + : MArray (dim_vector(r, c), val) { } - FixedMatrix (const MArray2 &is, const MArray2 &ds); + FixedMatrix (const MArray &is, const MArray &ds); FixedMatrix (const Matrix &is, const Matrix &ds); FixedMatrix (unsigned int is, unsigned int ds, const FixedMatrix& a); - FixedMatrix (const MArray2 &is, const MArray2 &ds, + FixedMatrix (const MArray &is, const MArray &ds, const FixedMatrix& a); FixedMatrix (const Matrix &is, const Matrix &ds, const FixedMatrix& a); FixedMatrix (unsigned int is, unsigned int ds, const Matrix& a); - FixedMatrix (const MArray2 &is, const MArray2 &ds, + FixedMatrix (const MArray &is, const MArray &ds, const Matrix& a); FixedMatrix (const Matrix &is, const Matrix &ds, const Matrix& a); @@ -83,19 +85,19 @@ FixedMatrix (unsigned int is, unsigned int ds, const Matrix& a, const Matrix& b); - FixedMatrix (const MArray2 &is, const MArray2 &ds, + FixedMatrix (const MArray &is, const MArray &ds, const Matrix& a, const Matrix& b); FixedMatrix (const Matrix &is, const Matrix &ds, const Matrix& a, const Matrix& b); - FixedMatrix (const MArray2 &a); + FixedMatrix (const MArray &a); FixedMatrix (const Matrix &a); - FixedMatrix (const FixedMatrix& a) : MArray2 (a) { } - FixedMatrix (const MArray2& a) : MArray2 (a) { } - FixedMatrix (const Array2 &a) : MArray2 (a) { } + FixedMatrix (const FixedMatrix& a) : MArray (a) { } + FixedMatrix (const MArray& a) : MArray (a) { } + FixedMatrix (const Array &a) : MArray (a) { } explicit FixedMatrix (const FixedRowVector& rv); @@ -120,7 +122,7 @@ FixedMatrix& operator = (const FixedMatrix& a) { - MArray2::operator = (a); + MArray::operator = (a); return *this; } @@ -151,7 +153,7 @@ FixedMatrix stack (const FixedColumnVector& a) const; FixedMatrix transpose (void) const - { return MArray2::transpose (); } + { return MArray::transpose (); } // resize is the destructive equivalent for this one @@ -167,6 +169,12 @@ FixedColumnVector column (int i) const; FixedColumnVector column (char *s) const; + void resize (octave_idx_type nr, octave_idx_type nc, + const FixedPoint& rfv = resize_fill_value ()) + { + MArray::resize (dim_vector (nr, nc), rfv); + } + // unary operations FixedMatrix operator ! (void) const; @@ -246,9 +254,6 @@ static FixedPoint resize_fill_value (void) { return FixedPoint(); } -private: - - FixedMatrix (FixedPoint *d, int r, int c) : MArray2 (d, r, c) { } }; OCTAVE_FIXED_API FixedMatrix operator * (const FixedColumnVector& a, const FixedRowVector& b); @@ -314,7 +319,7 @@ MM_CMP_OP_DECLS (FixedMatrix, FixedMatrix, ) MM_BOOL_OP_DECLS (FixedMatrix, FixedMatrix, ) -MARRAY_FORWARD_DEFS (MArray2, FixedMatrix, FixedPoint) +MARRAY_FORWARD_DEFS (MArray, FixedMatrix, FixedPoint) #endif diff -r 954f2f00d782 -r d84d2fea3c90 main/fixed/src/fixedNDArray.cc --- a/main/fixed/src/fixedNDArray.cc Wed Feb 22 21:56:05 2012 +0000 +++ b/main/fixed/src/fixedNDArray.cc Wed Feb 22 22:07:33 2012 +0000 @@ -45,8 +45,8 @@ // Fixed Point NDArray class. -FixedNDArray::FixedNDArray (const MArrayN &is, const MArrayN &ds) - : MArrayN (is.dims()) +FixedNDArray::FixedNDArray (const MArray &is, const MArray &ds) + : MArray (is.dims()) { if (dims () != ds.dims ()) { (*current_liboctave_error_handler) ("NDArray size mismatch"); @@ -59,7 +59,7 @@ FixedNDArray::FixedNDArray (const NDArray &is, const NDArray &ds) - : MArrayN (is.dims()) + : MArray (is.dims()) { if (dims () != ds.dims ()) { (*current_liboctave_error_handler) ("NDArray size mismatch"); @@ -70,9 +70,9 @@ elem (i) = FixedPoint((unsigned int)is(i), (unsigned int)ds(i)); } -FixedNDArray::FixedNDArray (const MArrayN &is, const MArrayN &ds, +FixedNDArray::FixedNDArray (const MArray &is, const MArray &ds, const FixedNDArray& a) - : MArrayN (a.dims()) + : MArray (a.dims()) { if ((dims () != is.dims ()) || (dims () != ds.dims ())) { (*current_liboctave_error_handler) ("NDArray size mismatch"); @@ -86,7 +86,7 @@ FixedNDArray::FixedNDArray (const NDArray &is, const NDArray &ds, const FixedNDArray& a) - : MArrayN (a.dims()) + : MArray (a.dims()) { if ((dims () != is.dims ()) || (dims () != ds.dims ())) { (*current_liboctave_error_handler) ("NDArray size mismatch"); @@ -100,16 +100,16 @@ FixedNDArray::FixedNDArray (unsigned int is, unsigned int ds, const FixedNDArray& a) - : MArrayN (a.dims()) + : MArray (a.dims()) { for (int i = 0; i < nelem (); i++) elem (i) = FixedPoint(is, ds, a.elem (i)); } -FixedNDArray::FixedNDArray (const MArrayN &is, - const MArrayN &ds, +FixedNDArray::FixedNDArray (const MArray &is, + const MArray &ds, const NDArray& a) - : MArrayN (a.dims()) + : MArray (a.dims()) { if ((dims () != is.dims ()) || (dims () != ds.dims ())) { (*current_liboctave_error_handler) ("NDArray size mismatch"); @@ -123,7 +123,7 @@ FixedNDArray::FixedNDArray (const NDArray &is, const NDArray &ds, const NDArray& a) - : MArrayN (a.dims()) + : MArray (a.dims()) { if ((dims () != is.dims ()) || (dims () != ds.dims ())) { (*current_liboctave_error_handler) ("NDArray size mismatch"); @@ -137,7 +137,7 @@ FixedNDArray::FixedNDArray (unsigned int is, unsigned int ds, const NDArray& a) - : MArrayN (a.dims()) + : MArray (a.dims()) { for (int i = 0; i < nelem (); i++) elem (i) = FixedPoint(is, ds, a.elem (i)); @@ -145,7 +145,7 @@ FixedNDArray::FixedNDArray (unsigned int is, unsigned int ds, const NDArray& a, const NDArray& b) - : MArrayN (a.dims()) + : MArray (a.dims()) { if (dims() != b.dims()) { (*current_liboctave_error_handler) ("NDArray size mismatch"); @@ -157,9 +157,9 @@ (unsigned int)b.elem (i)); } -FixedNDArray::FixedNDArray (const MArrayN &is, const MArrayN &ds, +FixedNDArray::FixedNDArray (const MArray &is, const MArray &ds, const NDArray& a, const NDArray& b) - : MArrayN (a.dims()) + : MArray (a.dims()) { if ((dims() != b.dims()) || (dims() != is.dims()) || (dims() != ds.dims())) { @@ -175,7 +175,7 @@ FixedNDArray::FixedNDArray (const NDArray &is, const NDArray &ds, const NDArray& a, const NDArray& b) - : MArrayN (a.dims()) + : MArray (a.dims()) { if ((dims() != b.dims()) || (dims() != is.dims()) || (dims() != ds.dims())) { @@ -189,15 +189,15 @@ (unsigned int)b.elem (i)); } -FixedNDArray::FixedNDArray (const MArrayN &a) - : MArrayN (a.dims()) +FixedNDArray::FixedNDArray (const MArray &a) + : MArray (a.dims()) { for (octave_idx_type i = 0; i < nelem (); i++) elem (i) = FixedPoint(a.elem (i)); } FixedNDArray::FixedNDArray (const NDArray &a) - : MArrayN (a.dims()) + : MArray (a.dims()) { for (octave_idx_type i = 0; i < nelem (); i++) elem (i) = FixedPoint(a.elem (i)); @@ -359,67 +359,67 @@ boolNDArray FixedNDArray::all (octave_idx_type dim) const { - return do_mx_red_op (*this, dim, mx_inline_all); + return do_mx_red_op (*this, dim, mx_inline_all); } boolNDArray FixedNDArray::any (octave_idx_type dim) const { - return do_mx_red_op (*this, dim, mx_inline_any); + return do_mx_red_op (*this, dim, mx_inline_any); } FixedNDArray FixedNDArray::cumprod (octave_idx_type dim) const { - return do_mx_cum_op (*this, dim, mx_inline_cumprod); + return do_mx_cum_op (*this, dim, mx_inline_cumprod); } FixedNDArray FixedNDArray::cumsum (octave_idx_type dim) const { - return do_mx_cum_op (*this, dim, mx_inline_cumsum); + return do_mx_cum_op (*this, dim, mx_inline_cumsum); } FixedNDArray FixedNDArray::prod (octave_idx_type dim) const { - return do_mx_red_op (*this, dim, mx_inline_prod); + return do_mx_red_op (*this, dim, mx_inline_prod); } FixedNDArray FixedNDArray::sum (octave_idx_type dim) const { - return do_mx_red_op (*this, dim, mx_inline_sum); + return do_mx_red_op (*this, dim, mx_inline_sum); } FixedNDArray FixedNDArray::sumsq (octave_idx_type dim) const { - return do_mx_red_op (*this, dim, mx_inline_sumsq); + return do_mx_red_op (*this, dim, mx_inline_sumsq); } FixedNDArray FixedNDArray::max (octave_idx_type dim) const { - return do_mx_minmax_op (*this, dim, mx_inline_max); + return do_mx_minmax_op (*this, dim, mx_inline_max); } FixedNDArray -FixedNDArray::max (ArrayN& idx_arg, octave_idx_type dim) const +FixedNDArray::max (Array& idx_arg, octave_idx_type dim) const { - return do_mx_minmax_op (*this, idx_arg, dim, mx_inline_max); + return do_mx_minmax_op (*this, idx_arg, dim, mx_inline_max); } FixedNDArray FixedNDArray::min (octave_idx_type dim) const { - return do_mx_minmax_op (*this, dim, mx_inline_min); + return do_mx_minmax_op (*this, dim, mx_inline_min); } FixedNDArray -FixedNDArray::min (ArrayN& idx_arg, octave_idx_type dim) const +FixedNDArray::min (Array& idx_arg, octave_idx_type dim) const { - return do_mx_minmax_op (*this, idx_arg, dim, mx_inline_min); + return do_mx_minmax_op (*this, idx_arg, dim, mx_inline_min); } FixedNDArray @@ -445,12 +445,12 @@ switch (nd) { case 1: - retval = FixedMatrix (Array2 (*this, dimensions(0), 1)); + retval = FixedMatrix (Array (*this, dim_vector (dimensions(0), 1))); break; case 2: - retval = FixedMatrix (Array2 (*this, dimensions(0), - dimensions(1))); + retval = FixedMatrix (Array (*this, dim_vector (dimensions(0), + dimensions(1)))); break; default: @@ -527,12 +527,12 @@ FixedNDArray elem_pow (const FixedNDArray &a, const FixedPoint &b) { - return elem_pow (a, FixedNDArray(dim_vector (1), b)); + return elem_pow (a, FixedNDArray(dim_vector (1, 1), b)); } FixedNDArray elem_pow (const FixedPoint &a, const FixedNDArray &b) { - return elem_pow (FixedNDArray(dim_vector (1), a), b); + return elem_pow (FixedNDArray(dim_vector (1, 1), a), b); } FixedNDArray atan2 (const FixedNDArray &x, const FixedNDArray &y) @@ -758,14 +758,14 @@ return result; } -NDS_CMP_OPS(FixedNDArray, , FixedPoint, ) -NDS_BOOL_OPS(FixedNDArray, FixedPoint, FixedPoint()) +NDS_CMP_OPS(FixedNDArray, FixedPoint) +NDS_BOOL_OPS(FixedNDArray, FixedPoint) -SND_CMP_OPS(FixedPoint, , FixedNDArray, ) -SND_BOOL_OPS(FixedPoint, FixedNDArray, FixedPoint()) +SND_CMP_OPS(FixedPoint, FixedNDArray) +SND_BOOL_OPS(FixedPoint, FixedNDArray) -NDND_CMP_OPS(FixedNDArray, , FixedNDArray, ) -NDND_BOOL_OPS(FixedNDArray, FixedNDArray, FixedPoint()) +NDND_CMP_OPS(FixedNDArray, FixedNDArray) +NDND_BOOL_OPS(FixedNDArray, FixedNDArray) /* ;;; Local Variables: *** diff -r 954f2f00d782 -r d84d2fea3c90 main/fixed/src/fixedNDArray.h --- a/main/fixed/src/fixedNDArray.h Wed Feb 22 21:56:05 2012 +0000 +++ b/main/fixed/src/fixedNDArray.h Wed Feb 22 22:07:33 2012 +0000 @@ -26,7 +26,7 @@ #if !defined (octave_FixedNDArray_h) #define octave_FixedNDArray_h 1 -#include +#include #include #include #include @@ -43,30 +43,30 @@ class FixedComplexNDArray; class -FixedNDArray : public MArrayN +FixedNDArray : public MArray { public: - FixedNDArray (void) : MArrayN () { } + FixedNDArray (void) : MArray () { } - FixedNDArray (const dim_vector& dv) : MArrayN (dv) { } + FixedNDArray (const dim_vector& dv) : MArray (dv) { } FixedNDArray (const dim_vector& dv, const FixedPoint val) - : MArrayN (dv, val) { } + : MArray (dv, val) { } - FixedNDArray (const MArrayN &is, const MArrayN &ds); + FixedNDArray (const MArray &is, const MArray &ds); FixedNDArray (const NDArray &is, const NDArray &ds); FixedNDArray (unsigned int is, unsigned int ds, const FixedNDArray& a); - FixedNDArray (const MArrayN &is, const MArrayN &ds, + FixedNDArray (const MArray &is, const MArray &ds, const FixedNDArray& a); FixedNDArray (const NDArray &is, const NDArray &ds, const FixedNDArray& a); FixedNDArray (unsigned int is, unsigned int ds, const NDArray& a); - FixedNDArray (const MArrayN &is, const MArrayN &ds, + FixedNDArray (const MArray &is, const MArray &ds, const NDArray& a); FixedNDArray (const NDArray &is, const NDArray &ds, const NDArray& a); @@ -74,19 +74,19 @@ FixedNDArray (unsigned int is, unsigned int ds, const NDArray& a, const NDArray& b); - FixedNDArray (const MArrayN &is, const MArrayN &ds, + FixedNDArray (const MArray &is, const MArray &ds, const NDArray& a, const NDArray& b); FixedNDArray (const NDArray &is, const NDArray &ds, const NDArray& a, const NDArray& b); - FixedNDArray (const MArrayN &a); + FixedNDArray (const MArray &a); FixedNDArray (const NDArray &a); - FixedNDArray (const FixedNDArray& a) : MArrayN (a) { } - FixedNDArray (const MArrayN& a) : MArrayN (a) { } - FixedNDArray (const ArrayN& a) : MArrayN (a) { } + FixedNDArray (const FixedNDArray& a) : MArray (a) { } + FixedNDArray (const MArray& a) : MArray (a) { } + FixedNDArray (const Array& a) : MArray (a) { } NDArray sign (void) const; NDArray signbit (void) const; @@ -107,7 +107,7 @@ FixedNDArray& operator = (const FixedNDArray& a) { - MArrayN::operator = (a); + MArray::operator = (a); return *this; } @@ -132,15 +132,15 @@ FixedNDArray sumsq (octave_idx_type dim = -1) const; FixedNDArray max (octave_idx_type dim = 0) const; - FixedNDArray max (ArrayN& index, octave_idx_type dim = 0) const; + FixedNDArray max (Array& index, octave_idx_type dim = 0) const; FixedNDArray min (octave_idx_type dim = 0) const; - FixedNDArray min (ArrayN& index, octave_idx_type dim = 0) const; + FixedNDArray min (Array& index, octave_idx_type dim = 0) const; FixedNDArray abs (void) const; FixedMatrix fixed_matrix_value (void) const; - FixedNDArray squeeze (void) const { return ArrayN::squeeze (); } + FixedNDArray squeeze (void) const { return Array::squeeze (); } static void increment_index (Array& ra_idx, const dim_vector& dimensions, @@ -186,11 +186,6 @@ friend std::istream& operator >> (std::istream& is, FixedNDArray& a); static FixedPoint resize_fill_value (void) { return FixedPoint(); } - -private: - - FixedNDArray (FixedPoint *d, const dim_vector& dv) : MArrayN (d, dv) { } - }; // FixedNDArray abs (const FixedNDArray &x); @@ -248,7 +243,7 @@ NDND_CMP_OP_DECLS (FixedNDArray, FixedNDArray, ) NDND_BOOL_OP_DECLS (FixedNDArray, FixedNDArray, ) -MARRAY_FORWARD_DEFS (MArrayN, FixedNDArray, FixedPoint) +MARRAY_FORWARD_DEFS (MArray, FixedNDArray, FixedPoint) #endif diff -r 954f2f00d782 -r d84d2fea3c90 main/fixed/src/fixedRowVector.cc --- a/main/fixed/src/fixedRowVector.cc Wed Feb 22 21:56:05 2012 +0000 +++ b/main/fixed/src/fixedRowVector.cc Wed Feb 22 22:07:33 2012 +0000 @@ -40,7 +40,7 @@ // Fixed Point Row Vector class FixedRowVector::FixedRowVector (const MArray &is, const MArray &ds) - : MArray (is.length()) + : MArray (dim_vector (1, is.length())) { if (length() != ds.length()) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -52,7 +52,7 @@ } FixedRowVector::FixedRowVector (const RowVector &is, const RowVector &ds) - : MArray (is.length()) + : MArray (dim_vector (1, is.length())) { if (length() != ds.length()) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -65,7 +65,7 @@ FixedRowVector::FixedRowVector (const MArray &is, const MArray &ds, const FixedRowVector& a) - : MArray (a.length()) + : MArray (dim_vector (1, a.length())) { if ((length() != is.length()) || (length() != ds.length())) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -79,7 +79,7 @@ FixedRowVector::FixedRowVector (const RowVector &is, const RowVector &ds, const FixedRowVector& a) - : MArray (a.length()) + : MArray (dim_vector (1, a.length())) { if ((length() != is.length()) || (length() != ds.length())) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -93,7 +93,7 @@ FixedRowVector::FixedRowVector (unsigned int is, unsigned int ds, const FixedRowVector& a) - : MArray (a.length()) + : MArray (dim_vector (1, a.length())) { for (int i = 0; i < length (); i++) elem (i) = FixedPoint(is, ds, a.elem (i)); @@ -101,7 +101,7 @@ FixedRowVector::FixedRowVector (const MArray &is, const MArray &ds, const RowVector& a) - : MArray (a.length()) + : MArray (dim_vector (1, a.length())) { if ((length() != is.length()) || (length() != ds.length())) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -115,7 +115,7 @@ FixedRowVector::FixedRowVector (const RowVector &is, const RowVector &ds, const RowVector& a) - : MArray (a.length()) + : MArray (dim_vector (1, a.length())) { if ((length() != is.length()) || (length() != ds.length())) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -129,7 +129,7 @@ FixedRowVector::FixedRowVector (unsigned int is, unsigned int ds, const RowVector& a) - : MArray (a.length()) + : MArray (dim_vector (1, a.length())) { for (int i = 0; i < length (); i++) elem (i) = FixedPoint(is, ds, a.elem (i)); @@ -137,7 +137,7 @@ FixedRowVector::FixedRowVector (const MArray &is, const MArray &ds, const RowVector& a, const RowVector& b) - : MArray (a.length()) + : MArray (dim_vector (1, a.length())) { if ((length() != b.length()) || (length() != is.length()) || (length() != ds.length())) { @@ -153,7 +153,7 @@ FixedRowVector::FixedRowVector (const RowVector &is, const RowVector &ds, const RowVector& a, const RowVector& b) - : MArray (a.length()) + : MArray (dim_vector (1, a.length())) { if ((length() != b.length()) || (length() != is.length()) || (length() != ds.length())) { @@ -169,7 +169,7 @@ FixedRowVector::FixedRowVector (unsigned int is, unsigned int ds, const RowVector& a, const RowVector& b) - : MArray (a.length()) + : MArray (dim_vector (1, a.length())) { if (length() != b.length()) { (*current_liboctave_error_handler) ("vector size mismatch"); @@ -462,21 +462,21 @@ if (a_len == 1) { - retval.resize(b_len); + retval.resize(b_len); FixedPoint ad = a(0); for (int i = 0; i < b_len; i++) retval(i) = pow(ad, b(i)); } else if (b_len == 1) { - retval.resize(a_len); + retval.resize(a_len); FixedPoint bd = b(0); for (int i = 0; i < a_len; i++) retval(i) = pow(a(i), bd); } else if (a_len == b_len) { - retval.resize(a_len); + retval.resize(a_len); for (int i = 0; i < a_len; i++) retval(i) = pow(a(i), b(i)); } @@ -515,7 +515,7 @@ int a_nr = a.rows (); int a_nc = a.cols (); - retval.resize (a_nc, FixedPoint()); + retval.resize (a_nc, FixedPoint()); if (len != 0) for (int i = 0; i < a_nc; i++) for (int j = 0; j < a_nr; j++) diff -r 954f2f00d782 -r d84d2fea3c90 main/fixed/src/fixedRowVector.h --- a/main/fixed/src/fixedRowVector.h Wed Feb 22 21:56:05 2012 +0000 +++ b/main/fixed/src/fixedRowVector.h Wed Feb 22 22:07:33 2012 +0000 @@ -50,7 +50,7 @@ FixedRowVector (void) : MArray () { } - explicit FixedRowVector (int n) : MArray (n) { } + explicit FixedRowVector (int n) : MArray (dim_vector (1,n)) { } FixedRowVector (const MArray &is, const MArray &ds); @@ -81,7 +81,8 @@ FixedRowVector (const RowVector &is, const RowVector &ds, const RowVector& a, const RowVector& b); - FixedRowVector (int n, FixedPoint val) : MArray (n, val) { } + FixedRowVector (int n, FixedPoint val) + : MArray (dim_vector(1, n), val) { } FixedRowVector (const FixedRowVector& a) : MArray (a) { } @@ -176,9 +177,11 @@ friend std::ostream& operator << (std::ostream& os, const FixedRowVector& a); friend std::istream& operator >> (std::istream& is, FixedRowVector& a); -private: - - FixedRowVector (FixedPoint *d, int l) : MArray (d, l) { } + void resize (octave_idx_type n, + const FixedPoint& rfv = Array::resize_fill_value ()) + { + Array::resize (dim_vector (1, n), rfv); + } }; FixedPoint operator * (const FixedRowVector& a, const FixedColumnVector& b); diff -r 954f2f00d782 -r d84d2fea3c90 main/fixed/src/int/fixed.cc --- a/main/fixed/src/int/fixed.cc Wed Feb 22 21:56:05 2012 +0000 +++ b/main/fixed/src/int/fixed.cc Wed Feb 22 22:07:33 2012 +0000 @@ -1178,7 +1178,7 @@ */ fp_uint i = num >> x.decsize; - fp_uint d = (num & ((x.filter >> x.intsize+1) & x.filter)); + fp_uint d = (num & ((x.filter >> (x.intsize+1)) & x.filter)); /* Print sign. diff -r 954f2f00d782 -r d84d2fea3c90 main/fixed/src/int/fixed.h --- a/main/fixed/src/int/fixed.h Wed Feb 22 21:56:05 2012 +0000 +++ b/main/fixed/src/int/fixed.h Wed Feb 22 22:07:33 2012 +0000 @@ -158,14 +158,14 @@ #ifdef _MSC_VER FixedPoint (const long double x) { *this = FixedPoint((const double)x); } - - operator double () const { return fixedpoint(); } #endif FixedPoint (const FixedPoint &x) : number(x.number), decsize(x.decsize), intsize(x.intsize), filter(x.filter), value(x.value) { } + operator double () const { return fixedpoint(); } + // Changing FixedPoint dynamic FixedPoint chintsize (const int n) { @@ -229,6 +229,23 @@ // FixedPoint operators + friend FixedPoint operator + (const FixedPoint &x, int y) { return x + FixedPoint (y); } + + friend FixedPoint operator - (const FixedPoint &x, int y) { return x - FixedPoint (y); } + + friend FixedPoint operator * (const FixedPoint &x, int y) { return x * FixedPoint (y); } + + friend FixedPoint operator / (const FixedPoint &x, int y) { return x / FixedPoint (y); } + + friend FixedPoint operator + (int x, const FixedPoint &y) { return FixedPoint (x) + y; } + + friend FixedPoint operator - (int x, const FixedPoint &y) { return FixedPoint (x) - y; } + + friend FixedPoint operator * (int x, const FixedPoint &y) { return FixedPoint (x) * y; } + + friend FixedPoint operator / (int x, const FixedPoint &y) { return FixedPoint (x) / y; } + + friend FixedPoint operator + (const FixedPoint &x, const FixedPoint &y); friend FixedPoint operator - (const FixedPoint &x, const FixedPoint &y); @@ -243,6 +260,30 @@ // FixedPoint comparators + friend OCTAVE_FIXED_API bool operator == (int x, const FixedPoint &y) { return FixedPoint (x) == y; } + + friend OCTAVE_FIXED_API bool operator != (int x, const FixedPoint &y) { return FixedPoint (x) != y; } + + friend OCTAVE_FIXED_API bool operator > (int x, const FixedPoint &y) { return FixedPoint (x) > y; } + + friend OCTAVE_FIXED_API bool operator >= (int x, const FixedPoint &y) { return FixedPoint (x) >= y; } + + friend OCTAVE_FIXED_API bool operator < (int x, const FixedPoint &y) { return FixedPoint (x) < y; } + + friend OCTAVE_FIXED_API bool operator <= (int x, const FixedPoint &y) { return FixedPoint (x) <= y; } + + friend OCTAVE_FIXED_API bool operator == (const FixedPoint& y, int x) { return x == FixedPoint (y); } + + friend OCTAVE_FIXED_API bool operator != (const FixedPoint& y, int x) { return x != FixedPoint (y); } + + friend OCTAVE_FIXED_API bool operator > (const FixedPoint& y, int x) { return x > FixedPoint (y); } + + friend OCTAVE_FIXED_API bool operator >= (const FixedPoint& y, int x) { return x >= FixedPoint (y); } + + friend OCTAVE_FIXED_API bool operator < (const FixedPoint& y, int x) { return x < FixedPoint (y); } + + friend OCTAVE_FIXED_API bool operator <= (const FixedPoint& y, int x) { return x <= FixedPoint (y); } + friend OCTAVE_FIXED_API bool operator == (const FixedPoint &x, const FixedPoint &y); friend OCTAVE_FIXED_API bool operator != (const FixedPoint &x, const FixedPoint &y); diff -r 954f2f00d782 -r d84d2fea3c90 main/fixed/src/ov-base-fixed-mat.cc --- a/main/fixed/src/ov-base-fixed-mat.cc Wed Feb 22 21:56:05 2012 +0000 +++ b/main/fixed/src/ov-base-fixed-mat.cc Wed Feb 22 22:07:33 2012 +0000 @@ -101,7 +101,7 @@ len); else { - Array ra_idx (len); + Array ra_idx (dim_vector (len, 1)); for (octave_idx_type i = 0; i < len; i++) ra_idx(i) = idx(i).index_vector (); diff -r 954f2f00d782 -r d84d2fea3c90 main/fixed/src/ov-fixed-complex.cc --- a/main/fixed/src/ov-fixed-complex.cc Wed Feb 22 21:56:05 2012 +0000 +++ b/main/fixed/src/ov-fixed-complex.cc Wed Feb 22 22:07:33 2012 +0000 @@ -228,9 +228,9 @@ } static void -restore_precision (void *p) +restore_precision (int *p) { - bind_internal_variable ("output_precision", *(static_cast (p))); + bind_internal_variable ("output_precision", *p); } void @@ -245,13 +245,15 @@ octave_value_list tmp = feval ("output_precision"); int prec = tmp(0).int_value (); - unwind_protect::add (restore_precision, &prec); + + unwind_protect frame; + + frame.add_fcn (restore_precision, &prec); + bind_internal_variable ("output_precision", new_prec); indent (os); octave_print_internal (os, complex_value(), pr_as_read_syntax); - - unwind_protect::run (); } bool diff -r 954f2f00d782 -r d84d2fea3c90 main/fixed/src/ov-fixed-cx-mat.cc --- a/main/fixed/src/ov-fixed-cx-mat.cc Wed Feb 22 21:56:05 2012 +0000 +++ b/main/fixed/src/ov-fixed-cx-mat.cc Wed Feb 22 22:07:33 2012 +0000 @@ -113,7 +113,7 @@ return octave_value (); } FixedComplexMatrix retval (matrix); - retval.resize (dv(0), dv(1)); + retval.resize (dv); return new octave_fixed_complex_matrix (retval); } @@ -296,8 +296,8 @@ { FixedPointComplex c = matrix (0, 0); - if (::imag (c) == 0.0) - retval = new octave_fixed (::real (c)); + if (imag (c) == 0) + retval = new octave_fixed (real (c)); else retval = new octave_fixed_complex (c); } @@ -403,9 +403,9 @@ } static void -restore_precision (void *p) +restore_precision (int *p) { - bind_internal_variable ("output_precision", *(static_cast (p))); + bind_internal_variable ("output_precision", *p); } void @@ -420,13 +420,15 @@ octave_value_list tmp = feval ("output_precision"); int prec = tmp(0).int_value (); - unwind_protect::add (restore_precision, &prec); + + unwind_protect frame; + + frame.add_fcn (restore_precision, &prec); + bind_internal_variable ("output_precision", new_prec); octave_print_internal (os, complex_matrix_value(), false, current_print_indent_level ()); - - unwind_protect::run (); } bool @@ -594,7 +596,7 @@ return false; // This is ugly, is there a better way? - matrix.resize (dv(0), dv(1)); + matrix.resize (dim_vector (dv(0), dv(1))); for (int i = 0; i < dv(0); i++) for (int j = 0; j < dv(1); j++) matrix (i, j) = @@ -936,7 +938,7 @@ return false; // This is ugly, is there a better way? - matrix.resize (dv(0), dv(1)); + matrix.resize (dim_vector (dv(0), dv(1))); unsigned int * ivec = intsize; unsigned int * dvec = decsize; unsigned int * nvec = number; diff -r 954f2f00d782 -r d84d2fea3c90 main/fixed/src/ov-fixed-mat.cc --- a/main/fixed/src/ov-fixed-mat.cc Wed Feb 22 21:56:05 2012 +0000 +++ b/main/fixed/src/ov-fixed-mat.cc Wed Feb 22 22:07:33 2012 +0000 @@ -354,7 +354,7 @@ } else { - charMatrix chm (nr, nc); + charMatrix chm (dim_vector (nr, nc)); bool warned = false; @@ -386,7 +386,7 @@ } } - retval = octave_value (chm, 1); + retval = octave_value (chm); } } @@ -394,9 +394,9 @@ } static void -restore_precision (void *p) +restore_precision (int *p) { - bind_internal_variable ("output_precision", *(static_cast (p))); + bind_internal_variable ("output_precision", *p); } void @@ -409,13 +409,15 @@ octave_value_list tmp = feval ("output_precision"); int prec = tmp(0).int_value (); - unwind_protect::add (restore_precision, &prec); + + unwind_protect frame; + + frame.add_fcn (restore_precision, &prec); + bind_internal_variable ("output_precision", new_prec); octave_print_internal (os, matrix_value(), false, current_print_indent_level ()); - - unwind_protect::run (); } bool diff -r 954f2f00d782 -r d84d2fea3c90 main/fixed/src/ov-fixed.cc --- a/main/fixed/src/ov-fixed.cc Wed Feb 22 21:56:05 2012 +0000 +++ b/main/fixed/src/ov-fixed.cc Wed Feb 22 22:07:33 2012 +0000 @@ -195,9 +195,9 @@ } static void -restore_precision (void *p) +restore_precision (int *p) { - bind_internal_variable ("output_precision", *(static_cast (p))); + bind_internal_variable ("output_precision", *p); } void @@ -209,13 +209,15 @@ octave_value_list tmp = feval ("output_precision"); int prec = tmp(0).int_value (); - unwind_protect::add (restore_precision, &prec); + + unwind_protect frame; + + frame.add_fcn (restore_precision, &prec); + bind_internal_variable ("output_precision", new_prec); indent (os); octave_print_internal (os, scalar_value(), pr_as_read_syntax); - - unwind_protect::run (); } bool