Mercurial > hg > octave-lojdl
changeset 2386:4fc9fd1424a9
[project @ 1996-10-12 18:31:34 by jwe]
author | jwe |
---|---|
date | Sat, 12 Oct 1996 18:38:10 +0000 |
parents | 170053c0f75e |
children | be4616e36133 |
files | Makeconf.in configure.in doc/Makefile.in libcruft/Makerules.in liboctave/CColVector.cc liboctave/CColVector.h liboctave/CDiagMatrix.cc liboctave/CDiagMatrix.h liboctave/CRowVector.cc liboctave/CRowVector.h liboctave/MArray-misc.cc liboctave/Makefile.in liboctave/dColVector.cc liboctave/dColVector.h liboctave/dRowVector.cc liboctave/dRowVector.h liboctave/idx-vector.cc liboctave/idx-vector.h liboctave/mx-inlines.cc |
diffstat | 19 files changed, 360 insertions(+), 197 deletions(-) [+] |
line wrap: on
line diff
--- a/Makeconf.in +++ b/Makeconf.in @@ -57,8 +57,6 @@ DLFCN_INCFLAGS = @DLFCN_INCFLAGS@ -UCB_INCFLAGS = @UCB_INCFLAGS@ - # Clean up INCFLAGS a bit if we are not compiling in a separate # directory. ifeq ($(srcdir),.) @@ -74,7 +72,7 @@ -I$(TOPDIR)/glob -I$(top_srcdir) -I$(top_srcdir)/liboctave \ -I$(top_srcdir)/src -I$(top_srcdir)/glob endif -INCFLAGS = $(TMP_IF_1) $(TMP_IF_2) $(DLFCN_INCFLAGS) $(UCB_INCFLAGS) +INCFLAGS = $(TMP_IF_1) $(TMP_IF_2) $(DLFCN_INCFLAGS) LIBFLAGS = -L$(TOPDIR)
--- a/configure.in +++ b/configure.in @@ -20,7 +20,7 @@ ### along with Octave; see the file COPYING. If not, write to the Free ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -AC_REVISION($Revision: 1.215 $) +AC_REVISION($Revision: 1.216 $) AC_PREREQ(2.9) AC_INIT(src/octave.cc) AC_CONFIG_HEADER(config.h) @@ -887,23 +887,7 @@ esac AC_SUBST(VOID_SIGHANDLER) -### Try to make it possible to find getrusage on Solaris systems. - -XCFLAGS="$CFLAGS" -case "$canonical_host_type" in - *-*-solaris2*) - UCBLIB=/usr/ucblib/libucb.a - UCB_INCFLAGS=-I/usr/ucbinclude - if test -f $UCBLIB; then - LIBS="-lc $UCBLIB $LIBS" - AC_MSG_RESULT([adding $UCBLIB to LIBS]) - AC_MSG_RESULT([defining UCB_INCFLAGS to be $UCB_INCFLAGS]) - fi - ;; -esac -AC_SUBST(UCB_INCFLAGS) AC_CHECK_FUNCS(getrusage times) -CFLAGS="$XCFLAGS" ### Checks for other programs used for building, testing, installing, ### and running Octave.
--- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -56,8 +56,8 @@ distclean:: rm -f Makefile -maintainer-clean:: distclean - rm -f tags TAGS +maintainer-clean:: + rm -f tags TAGS Makefile local-dist: ln $(DISTFILES) ../`cat ../.fname`/doc
--- a/libcruft/Makerules.in +++ b/libcruft/Makerules.in @@ -68,8 +68,8 @@ -rmdir pic .PHONY: distclean -maintainer-clean:: distclean - rm -f tags TAGS stamp-picdir +maintainer-clean:: + rm -f tags TAGS stamp-picdir Makefile -rmdir pic .PHONY: maintainer-clean
--- a/liboctave/CColVector.cc +++ b/liboctave/CColVector.cc @@ -57,7 +57,7 @@ elem (i) = a.elem (i); } -int +bool ComplexColumnVector::operator == (const ComplexColumnVector& a) const { int len = length (); @@ -66,7 +66,7 @@ return equal (data (), a.data (), len); } -int +bool ComplexColumnVector::operator != (const ComplexColumnVector& a) const { return !(*this == a); @@ -230,10 +230,12 @@ ComplexColumnVector::operator += (const ColumnVector& a) { int len = length (); - if (len != a.length ()) + + int a_len = a.length (); + + if (len != a_len) { - (*current_liboctave_error_handler) - ("nonconformant vector += operation attempted"); + gripe_nonconformant ("operator +=", len, a_len); return *this; } @@ -250,10 +252,12 @@ ComplexColumnVector::operator -= (const ColumnVector& a) { int len = length (); - if (len != a.length ()) + + int a_len = a.length (); + + if (len != a_len) { - (*current_liboctave_error_handler) - ("nonconformant vector -= operation attempted"); + gripe_nonconformant ("operator -=", len, a_len); return *this; } @@ -271,10 +275,11 @@ { int len = length (); - if (len != a.length ()) + int a_len = a.length (); + + if (len != a_len) { - (*current_liboctave_error_handler) - ("nonconformant vector += operation attempted"); + gripe_nonconformant ("operator +=", len, a_len); return *this; } @@ -291,10 +296,12 @@ ComplexColumnVector::operator -= (const ComplexColumnVector& a) { int len = length (); - if (len != a.length ()) + + int a_len = a.length (); + + if (len != a_len) { - (*current_liboctave_error_handler) - ("nonconformant vector -= operation attempted"); + gripe_nonconformant ("operator -=", len, a_len); return *this; } @@ -440,9 +447,10 @@ int nr = m.rows (); int nc = m.cols (); - if (nc != a.length ()) - (*current_liboctave_error_handler) - ("nonconformant matrix multiplication attempted"); + int a_len = a.length (); + + if (nc != a_len) + gripe_nonconformant ("operator *", nr, nc, a_len, 1); else { if (nc == 0 || nr == 0) @@ -472,10 +480,12 @@ operator + (const ComplexColumnVector& v, const ColumnVector& a) { int len = v.length (); - if (len != a.length ()) + + int a_len = a.length (); + + if (len != a_len) { - (*current_liboctave_error_handler) - ("nonconformant vector addition attempted"); + gripe_nonconformant ("operator +", len, a_len); return ComplexColumnVector (); } @@ -489,10 +499,12 @@ operator - (const ComplexColumnVector& v, const ColumnVector& a) { int len = v.length (); - if (len != a.length ()) + + int a_len = a.length (); + + if (len != a_len) { - (*current_liboctave_error_handler) - ("nonconformant vector subtraction attempted"); + gripe_nonconformant ("operator -", len, a_len); return ComplexColumnVector (); } @@ -506,10 +518,12 @@ operator + (const ColumnVector& v, const ComplexColumnVector& a) { int len = v.length (); - if (len != a.length ()) + + int a_len = a.length (); + + if (len != a_len) { - (*current_liboctave_error_handler) - ("nonconformant vector subtraction attempted"); + gripe_nonconformant ("operator +", len, a_len); return ComplexColumnVector (); } @@ -523,10 +537,12 @@ operator - (const ColumnVector& v, const ComplexColumnVector& a) { int len = v.length (); - if (len != a.length ()) + + int a_len = a.length (); + + if (len != a_len) { - (*current_liboctave_error_handler) - ("nonconformant vector subtraction attempted"); + gripe_nonconformant ("operator -", len, a_len); return ComplexColumnVector (); } @@ -540,10 +556,12 @@ product (const ComplexColumnVector& v, const ColumnVector& a) { int len = v.length (); - if (len != a.length ()) + + int a_len = a.length (); + + if (len != a_len) { - (*current_liboctave_error_handler) - ("nonconformant vector product attempted"); + gripe_nonconformant ("product", len, a_len); return ComplexColumnVector (); } @@ -557,10 +575,12 @@ quotient (const ComplexColumnVector& v, const ColumnVector& a) { int len = v.length (); - if (len != a.length ()) + + int a_len = a.length (); + + if (len != a_len) { - (*current_liboctave_error_handler) - ("nonconformant vector quotient attempted"); + gripe_nonconformant ("quotient", len, a_len); return ComplexColumnVector (); } @@ -574,10 +594,12 @@ product (const ColumnVector& v, const ComplexColumnVector& a) { int len = v.length (); - if (len != a.length ()) + + int a_len = a.length (); + + if (len != a_len) { - (*current_liboctave_error_handler) - ("nonconformant vector product attempted"); + gripe_nonconformant ("product", len, a_len); return ColumnVector (); } @@ -591,10 +613,12 @@ quotient (const ColumnVector& v, const ComplexColumnVector& a) { int len = v.length (); - if (len != a.length ()) + + int a_len = a.length (); + + if (len != a_len) { - (*current_liboctave_error_handler) - ("nonconformant vector quotient attempted"); + gripe_nonconformant ("quotient", len, a_len); return ColumnVector (); } @@ -620,11 +644,12 @@ { int nr = m.rows (); int nc = m.cols (); + int a_len = a.length (); + if (nc != a_len) { - (*current_liboctave_error_handler) - ("nonconformant matrix multiplication attempted"); + gripe_nonconformant ("operator *", nr, nc, a_len, 1); return ColumnVector (); } @@ -647,11 +672,12 @@ { int nr = m.rows (); int nc = m.cols (); + int a_len = a.length (); + if (nc != a_len) { - (*current_liboctave_error_handler) - ("nonconformant matrix muliplication attempted"); + gripe_nonconformant ("operator *", nr, nc, a_len, 1); return ComplexColumnVector (); } @@ -674,11 +700,12 @@ { int nr = m.rows (); int nc = m.cols (); + int a_len = a.length (); + if (nc != a_len) { - (*current_liboctave_error_handler) - ("nonconformant matrix muliplication attempted"); + gripe_nonconformant ("operator *", nr, nc, a_len, 1); return ComplexColumnVector (); }
--- a/liboctave/CColVector.h +++ b/liboctave/CColVector.h @@ -51,8 +51,8 @@ return *this; } - int operator == (const ComplexColumnVector& a) const; - int operator != (const ComplexColumnVector& a) const; + bool operator == (const ComplexColumnVector& a) const; + bool operator != (const ComplexColumnVector& a) const; // destructive insert/delete/reorder operations
--- a/liboctave/CDiagMatrix.cc +++ b/liboctave/CDiagMatrix.cc @@ -45,7 +45,7 @@ elem (i, i) = a.elem (i, i); } -int +bool ComplexDiagMatrix::operator == (const ComplexDiagMatrix& a) const { if (rows () != a.rows () || cols () != a.cols ()) @@ -54,7 +54,7 @@ return equal (data (), a.data (), length ()); } -int +bool ComplexDiagMatrix::operator != (const ComplexDiagMatrix& a) const { return !(*this == a); @@ -399,10 +399,13 @@ { int nr = rows (); int nc = cols (); - if (nr != a.rows () || nc != a.cols ()) + + int a_nr = a.rows (); + int a_nc = a.cols (); + + if (nr != a_nr || nc != a_nc) { - (*current_liboctave_error_handler) - ("nonconformant matrix += operation attempted"); + gripe_nonconformant ("operator +=", nr, nc, a_nr, a_nc); return *this; } @@ -420,10 +423,13 @@ { int nr = rows (); int nc = cols (); - if (nr != a.rows () || nc != a.cols ()) + + int a_nr = a.rows (); + int a_nc = a.cols (); + + if (nr != a_nr || nc != a_nc) { - (*current_liboctave_error_handler) - ("nonconformant matrix -= operation attempted"); + gripe_nonconformant ("operator -=", nr, nc, a_nr, a_nc); return *this; } @@ -441,10 +447,13 @@ { int nr = rows (); int nc = cols (); - if (nr != a.rows () || nc != a.cols ()) + + int a_nr = a.rows (); + int a_nc = a.cols (); + + if (nr != a_nr || nc != a_nc) { - (*current_liboctave_error_handler) - ("nonconformant matrix += operation attempted"); + gripe_nonconformant ("operator +=", nr, nc, a_nr, a_nc); return *this; } @@ -462,10 +471,13 @@ { int nr = rows (); int nc = cols (); - if (nr != a.rows () || nc != a.cols ()) + + int a_nr = a.rows (); + int a_nc = a.cols (); + + if (nr != a_nr || nc != a_nc) { - (*current_liboctave_error_handler) - ("nonconformant matrix -= operation attempted"); + gripe_nonconformant ("operator -=", nr, nc, a_nr, a_nc); return *this; } @@ -531,12 +543,13 @@ { int nr_a = a.rows (); int nc_a = a.cols (); + int nr_b = b.rows (); int nc_b = b.cols (); + if (nc_a != nr_b) { - (*current_liboctave_error_handler) - ("nonconformant matrix multiplication attempted"); + gripe_nonconformant ("operator *", nr_a, nc_a, nr_b, nc_b); return ComplexDiagMatrix (); } @@ -570,10 +583,13 @@ { int nr = m.rows (); int nc = m.cols (); - if (nr != a.rows () || nc != a.cols ()) + + int a_nr = a.rows (); + int a_nc = a.cols (); + + if (nr != a_nr || nc != a_nc) { - (*current_liboctave_error_handler) - ("nonconformant matrix addition attempted"); + gripe_nonconformant ("operator +", nr, nc, a_nr, a_nc); return ComplexDiagMatrix (); } @@ -588,10 +604,13 @@ { int nr = m.rows (); int nc = m.cols (); - if (nr != a.rows () || nc != a.cols ()) + + int a_nr = a.rows (); + int a_nc = a.cols (); + + if (nr != a_nr || nc != a_nc) { - (*current_liboctave_error_handler) - ("nonconformant matrix subtraction attempted"); + gripe_nonconformant ("operator -", nr, nc, a_nr, a_nc); return ComplexDiagMatrix (); } @@ -607,12 +626,13 @@ { int nr_a = a.rows (); int nc_a = a.cols (); + int nr_b = b.rows (); int nc_b = b.cols (); + if (nc_a != nr_b) { - (*current_liboctave_error_handler) - ("nonconformant matrix multiplication attempted"); + gripe_nonconformant ("operator *", nr_a, nc_a, nr_b, nc_b); return ComplexDiagMatrix (); } @@ -646,10 +666,13 @@ { int nr = m.rows (); int nc = m.cols (); - if (nr != a.rows () || nc != a.cols ()) + + int a_nr = a.rows (); + int a_nc = a.cols (); + + if (nr != a_nr || nc != a_nc) { - (*current_liboctave_error_handler) - ("nonconformant matrix addition attempted"); + gripe_nonconformant ("operator +", nr, nc, a_nr, a_nc); return ComplexDiagMatrix (); } @@ -664,10 +687,13 @@ { int nr = m.rows (); int nc = m.cols (); - if (nr != a.rows () || nc != a.cols ()) + + int a_nr = a.rows (); + int a_nc = a.cols (); + + if (nr != a_nr || nc != a_nc) { - (*current_liboctave_error_handler) - ("nonconformant matrix subtraction attempted"); + gripe_nonconformant ("operator -", nr, nc, a_nr, a_nc); return ComplexDiagMatrix (); } @@ -683,12 +709,13 @@ { int nr_a = a.rows (); int nc_a = a.cols (); + int nr_b = b.rows (); int nc_b = b.cols (); + if (nc_a != nr_b) { - (*current_liboctave_error_handler) - ("nonconformant matrix multiplication attempted"); + gripe_nonconformant ("operator *", nr_a, nc_a, nr_b, nc_b); return ComplexDiagMatrix (); } @@ -722,10 +749,13 @@ { int nr = m.rows (); int nc = m.cols (); - if (nr != a.rows () || nc != a.cols ()) + + int a_nr = a.rows (); + int a_nc = a.cols (); + + if (nr != a_nr || nc != a_nc) { - (*current_liboctave_error_handler) - ("nonconformant matrix product attempted"); + gripe_nonconformant ("product", nr, nc, a_nr, a_nc); return ComplexDiagMatrix (); } @@ -741,10 +771,13 @@ { int nr = m.rows (); int nc = m.cols (); - if (nr != a.rows () || nc != a.cols ()) + + int a_nr = a.rows (); + int a_nc = a.cols (); + + if (nr != a_nr || nc != a_nc) { - (*current_liboctave_error_handler) - ("nonconformant matrix product attempted"); + gripe_nonconformant ("product", nr, nc, a_nr, a_nc); return ComplexDiagMatrix (); }
--- a/liboctave/CDiagMatrix.h +++ b/liboctave/CDiagMatrix.h @@ -62,8 +62,8 @@ return *this; } - int operator == (const ComplexDiagMatrix& a) const; - int operator != (const ComplexDiagMatrix& a) const; + bool operator == (const ComplexDiagMatrix& a) const; + bool operator != (const ComplexDiagMatrix& a) const; ComplexDiagMatrix& fill (double val); ComplexDiagMatrix& fill (const Complex& val);
--- a/liboctave/CRowVector.cc +++ b/liboctave/CRowVector.cc @@ -57,7 +57,7 @@ elem (i) = a.elem (i); } -int +bool ComplexRowVector::operator == (const ComplexRowVector& a) const { int len = length (); @@ -66,7 +66,7 @@ return equal (data (), a.data (), len); } -int +bool ComplexRowVector::operator != (const ComplexRowVector& a) const { return !(*this == a); @@ -230,10 +230,12 @@ ComplexRowVector::operator += (const RowVector& a) { int len = length (); - if (len != a.length ()) + + int a_len = a.length (); + + if (len != a_len) { - (*current_liboctave_error_handler) - ("nonconformant vector += operation attempted"); + gripe_nonconformant ("operator +=", len, a_len); return *this; } @@ -250,10 +252,12 @@ ComplexRowVector::operator -= (const RowVector& a) { int len = length (); - if (len != a.length ()) + + int a_len = a.length (); + + if (len != a_len) { - (*current_liboctave_error_handler) - ("nonconformant vector -= operation attempted"); + gripe_nonconformant ("operator -=", len, a_len); return *this; } @@ -270,10 +274,12 @@ ComplexRowVector::operator += (const ComplexRowVector& a) { int len = length (); - if (len != a.length ()) + + int a_len = a.length (); + + if (len != a_len) { - (*current_liboctave_error_handler) - ("nonconformant vector += operation attempted"); + gripe_nonconformant ("operator +=", len, a_len); return *this; } @@ -290,10 +296,12 @@ ComplexRowVector::operator -= (const ComplexRowVector& a) { int len = length (); - if (len != a.length ()) + + int a_len = a.length (); + + if (len != a_len) { - (*current_liboctave_error_handler) - ("nonconformant vector -= operation attempted"); + gripe_nonconformant ("operator -=", len, a_len); return *this; } @@ -431,9 +439,11 @@ int len = v.length (); - if (a.rows () != len) - (*current_liboctave_error_handler) - ("nonconformant vector multiplication attempted"); + int a_nr = a.rows (); + int a_nc = a.cols (); + + if (a_nr != len) + gripe_nonconformant ("operator *", 1, len, a_nr, a_nc); else { int a_nr = a.rows (); @@ -475,10 +485,12 @@ operator + (const ComplexRowVector& v, const RowVector& a) { int len = v.length (); - if (len != a.length ()) + + int a_len = a.length (); + + if (len != a_len) { - (*current_liboctave_error_handler) - ("nonconformant vector addition attempted"); + gripe_nonconformant ("operator +", len, a_len); return ComplexRowVector (); } @@ -492,10 +504,12 @@ operator - (const ComplexRowVector& v, const RowVector& a) { int len = v.length (); - if (len != a.length ()) + + int a_len = a.length (); + + if (len != a_len) { - (*current_liboctave_error_handler) - ("nonconformant vector subtraction attempted"); + gripe_nonconformant ("operator -", len, a_len); return ComplexRowVector (); } @@ -509,10 +523,12 @@ operator + (const RowVector& v, const ComplexRowVector& a) { int len = v.length (); - if (len != a.length ()) + + int a_len = a.length (); + + if (len != a_len) { - (*current_liboctave_error_handler) - ("nonconformant vector addition attempted"); + gripe_nonconformant ("operator +", len, a_len); return ComplexRowVector (); } @@ -526,10 +542,12 @@ operator - (const RowVector& v, const ComplexRowVector& a) { int len = v.length (); - if (len != a.length ()) + + int a_len = a.length (); + + if (len != a_len) { - (*current_liboctave_error_handler) - ("nonconformant vector subtraction attempted"); + gripe_nonconformant ("operator -", len, a_len); return ComplexRowVector (); } @@ -543,10 +561,12 @@ product (const ComplexRowVector& v, const RowVector& a) { int len = v.length (); - if (len != a.length ()) + + int a_len = a.length (); + + if (len != a_len) { - (*current_liboctave_error_handler) - ("nonconformant vector product attempted"); + gripe_nonconformant ("product", len, a_len); return ComplexRowVector (); } @@ -560,10 +580,12 @@ quotient (const ComplexRowVector& v, const RowVector& a) { int len = v.length (); - if (len != a.length ()) + + int a_len = a.length (); + + if (len != a_len) { - (*current_liboctave_error_handler) - ("nonconformant vector quotient attempted"); + gripe_nonconformant ("quotient", len, a_len); return ComplexRowVector (); } @@ -577,10 +599,12 @@ product (const RowVector& v, const ComplexRowVector& a) { int len = v.length (); - if (len != a.length ()) + + int a_len = a.length (); + + if (len != a_len) { - (*current_liboctave_error_handler) - ("nonconformant vector product attempted"); + gripe_nonconformant ("product", len, a_len); return ComplexRowVector (); } @@ -594,10 +618,12 @@ quotient (const RowVector& v, const ComplexRowVector& a) { int len = v.length (); - if (len != a.length ()) + + int a_len = a.length (); + + if (len != a_len) { - (*current_liboctave_error_handler) - ("nonconformant vector quotient attempted"); + gripe_nonconformant ("quotient", len, a_len); return ComplexRowVector (); } @@ -712,10 +738,12 @@ operator * (const ComplexRowVector& v, const ComplexColumnVector& a) { int len = v.length (); - if (len != a.length ()) + + int a_len = a.length (); + + if (len != a_len) { - (*current_liboctave_error_handler) - ("nonconformant vector multiplication attempted"); + gripe_nonconformant ("operator *", len, a_len); return 0.0; }
--- a/liboctave/CRowVector.h +++ b/liboctave/CRowVector.h @@ -50,8 +50,8 @@ return *this; } - int operator == (const ComplexRowVector& a) const; - int operator != (const ComplexRowVector& a) const; + bool operator == (const ComplexRowVector& a) const; + bool operator != (const ComplexRowVector& a) const; // destructive insert/delete/reorder operations
new file mode 100644 --- /dev/null +++ b/liboctave/MArray-misc.cc @@ -0,0 +1,52 @@ +/* + +Copyright (C) 1996 John W. Eaton + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, or (at your option) any +later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "MArray.h" +#include "MArray2.h" +#include "lo-error.h" + +void +gripe_nonconformant (const char *op, int op1_len, int op2_len) +{ + (*current_liboctave_error_handler) + ("%s: nonconformant arguments (op1 len: %d, op2 len: %d)", + op, op1_len, op2_len); +} + +void +gripe_nonconformant (const char *op, int op1_nr, int op1_nc, + int op2_nr, int op2_nc) +{ + (*current_liboctave_error_handler) + ("%s: nonconformant arguments (op1 is %dx%d, op2 is %dx%d)", + op, op1_nr, op1_nc, op2_nr, op2_nc); +} + +/* +;;; Local Variables: *** +;;; mode: C++ *** +;;; End: *** +*/
--- a/liboctave/Makefile.in +++ b/liboctave/Makefile.in @@ -54,10 +54,10 @@ MATRIX_SRC := Array-flags.cc CColVector.cc CDiagMatrix.cc CMatrix.cc \ CRowVector.cc CmplxAEPBAL.cc CmplxCHOL.cc CmplxDET.cc \ CmplxHESS.cc CmplxLU.cc CmplxQR.cc CmplxQRP.cc CmplxSCHUR.cc \ - CmplxSVD.cc EIG.cc chMatrix.cc dColVector.cc dDiagMatrix.cc \ - dMatrix.cc dRowVector.cc dbleAEPBAL.cc dbleCHOL.cc \ - dbleDET.cc dbleGEPBAL.cc dbleHESS.cc dbleLU.cc dbleQR.cc \ - dbleQRP.cc dbleSCHUR.cc dbleSVD.cc + CmplxSVD.cc EIG.cc MArray-misc.cc chMatrix.cc dColVector.cc \ + dDiagMatrix.cc dMatrix.cc dRowVector.cc dbleAEPBAL.cc \ + dbleCHOL.cc dbleDET.cc dbleGEPBAL.cc dbleHESS.cc dbleLU.cc \ + dbleQR.cc dbleQRP.cc dbleSCHUR.cc dbleSVD.cc SOURCES := Bounds.cc CollocWt.cc DAE.cc DASSL.cc FEGrid.cc FSQP.cc \ LinConst.cc LPsolve.cc LSODE.cc NLEqn.cc NPSOL.cc QPSOL.cc \
--- a/liboctave/dColVector.cc +++ b/liboctave/dColVector.cc @@ -50,7 +50,7 @@ // Column Vector class. -int +bool ColumnVector::operator == (const ColumnVector& a) const { int len = length (); @@ -59,7 +59,7 @@ return equal (data (), a.data (), len); } -int +bool ColumnVector::operator != (const ColumnVector& a) const { return !(*this == a); @@ -169,10 +169,12 @@ ColumnVector::operator += (const ColumnVector& a) { int len = length (); - if (len != a.length ()) + + int a_len = a.length (); + + if (len != a_len) { - (*current_liboctave_error_handler) - ("nonconformant vector += operation attempted"); + gripe_nonconformant ("operator +=", len, a_len); return *this; } @@ -189,10 +191,12 @@ ColumnVector::operator -= (const ColumnVector& a) { int len = length (); - if (len != a.length ()) + + int a_len = a.length (); + + if (len != a_len) { - (*current_liboctave_error_handler) - ("nonconformant vector -= operation attempted"); + gripe_nonconformant ("operator -=", len, a_len); return *this; } @@ -215,9 +219,10 @@ int nr = m.rows (); int nc = m.cols (); - if (nc != a.length ()) - (*current_liboctave_error_handler) - ("nonconformant matrix multiplication attempted"); + int a_len = a.length (); + + if (nc != a_len) + gripe_nonconformant ("operator *", nr, nc, a_len, 1); else { if (nr == 0 || nc == 0) @@ -254,8 +259,7 @@ int a_len = a.length (); if (nc != a_len) - (*current_liboctave_error_handler) - ("nonconformant matrix multiplication attempted"); + gripe_nonconformant ("operator *", nr, nc, a_len, 1); else { if (nr == 0 || nc == 0)
--- a/liboctave/dColVector.h +++ b/liboctave/dColVector.h @@ -50,8 +50,8 @@ return *this; } - int operator == (const ColumnVector& a) const; - int operator != (const ColumnVector& a) const; + bool operator == (const ColumnVector& a) const; + bool operator != (const ColumnVector& a) const; // destructive insert/delete/reorder operations
--- a/liboctave/dRowVector.cc +++ b/liboctave/dRowVector.cc @@ -53,7 +53,7 @@ // Row Vector class. -int +bool RowVector::operator == (const RowVector& a) const { int len = length (); @@ -62,7 +62,7 @@ return equal (data (), a.data (), len); } -int +bool RowVector::operator != (const RowVector& a) const { return !(*this == a); @@ -170,10 +170,12 @@ RowVector::operator += (const RowVector& a) { int len = length (); - if (len != a.length ()) + + int a_len = a.length (); + + if (len != a_len) { - (*current_liboctave_error_handler) - ("nonconformant vector += operation attempted"); + gripe_nonconformant ("operator +=", len, a_len); return *this; } @@ -190,10 +192,12 @@ RowVector::operator -= (const RowVector& a) { int len = length (); - if (len != a.length ()) + + int a_len = a.length (); + + if (len != a_len) { - (*current_liboctave_error_handler) - ("nonconformant vector -= operation attempted"); + gripe_nonconformant ("operator -=", len, a_len); return *this; } @@ -215,9 +219,11 @@ int len = v.length (); - if (a.rows () != len) - (*current_liboctave_error_handler) - ("nonconformant vector multiplication attempted"); + int a_nr = a.rows (); + int a_nc = a.cols (); + + if (a_nr != len) + gripe_nonconformant ("operator *", 1, len, a_nr, a_nc); else { int a_nr = a.rows (); @@ -366,9 +372,10 @@ int len = v.length (); - if (len != a.length ()) - (*current_liboctave_error_handler) - ("nonconformant vector multiplication attempted"); + int a_len = a.length (); + + if (len != a_len) + gripe_nonconformant ("operator *", len, a_len); else if (len != 0) retval = F77_FCN (ddot, DDOT) (len, v.data (), 1, a.data (), 1);
--- a/liboctave/dRowVector.h +++ b/liboctave/dRowVector.h @@ -49,8 +49,8 @@ return *this; } - int operator == (const RowVector& a) const; - int operator != (const RowVector& a) const; + bool operator == (const RowVector& a) const; + bool operator != (const RowVector& a) const; // destructive insert/delete/reorder operations
--- a/liboctave/idx-vector.cc +++ b/liboctave/idx-vector.cc @@ -149,6 +149,27 @@ init_state (); } +IDX_VEC_REP::idx_vector_rep (double d) +{ + data = 0; + initialized = 0; + frozen = 0; + colon_equiv_checked = 0; + colon_equiv = 0; + colon = 0; + + len = 1; + + orig_nr = 1; + orig_nc = 1; + + data = new int [len]; + + data[0] = tree_to_mat_idx (d); + + init_state (); +} + IDX_VEC_REP::idx_vector_rep (const Range& r) { data = 0;
--- a/liboctave/idx-vector.h +++ b/liboctave/idx-vector.h @@ -64,6 +64,8 @@ idx_vector_rep (const Range& r); + idx_vector_rep (double d); + idx_vector_rep (char c); idx_vector_rep (const idx_vector_rep& a); @@ -155,6 +157,12 @@ rep->count = 1; } + idx_vector (double d) + { + rep = new idx_vector_rep (d); + rep->count = 1; + } + idx_vector (char c) { rep = new idx_vector_rep (c);
--- a/liboctave/mx-inlines.cc +++ b/liboctave/mx-inlines.cc @@ -27,13 +27,14 @@ // XXX FIXME XXX -- these need to be done with templates... -static inline int +static inline bool equal (const char *x, const char *y, int len) { for (int i = 0; i < len; i++) if (x[i] != y[i]) - return 0; - return 1; + return false; + + return true; } static inline double *