Mercurial > hg > octave-lyh
changeset 2049:468a96dd03fc
[project @ 1996-03-29 20:09:05 by jwe]
author | jwe |
---|---|
date | Fri, 29 Mar 1996 20:09:50 +0000 |
parents | 88960d151be5 |
children | 038b9f6bb1dc |
files | liboctave/Array.cc liboctave/Array.h liboctave/CmplxLU.cc liboctave/CmplxLU.h liboctave/NPSOL.h liboctave/base-lu.cc liboctave/base-lu.h liboctave/dbleLU.cc liboctave/dbleLU.h |
diffstat | 9 files changed, 51 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/Array.cc +++ b/liboctave/Array.cc @@ -170,6 +170,23 @@ return rep->data; } +template <class T> +T +Array<T>::range_error (void) const +{ + (*current_liboctave_error_handler) ("range error"); + return T (); +} + +template <class T> +T& +Array<T>::range_error (void) +{ + (*current_liboctave_error_handler) ("range error"); + static T foo; + return foo; +} + /* ;;; Local Variables: *** ;;; mode: C++ ***
--- a/liboctave/Array.h +++ b/liboctave/Array.h @@ -197,13 +197,9 @@ T Array<T>::checkelem (int n) const { if (n < 0 || n >= rep->length ()) - { - (*current_liboctave_error_handler) ("range error"); - T foo; - static T *bar = &foo; - return foo; - } - return elem (n); + return range_error (); + else + return elem (n); } #if defined (NO_BOUNDS_CHECKING) @@ -237,6 +233,9 @@ return *this; } + T range_error (void) const; + T& range_error (void); + #ifdef HEAVYWEIGHT_INDEXING void set_max_indices (int mi) { max_indices = mi; }
--- a/liboctave/CmplxLU.cc +++ b/liboctave/CmplxLU.cc @@ -38,7 +38,7 @@ #include <base-lu.h> #include <base-lu.cc> -template class base_lu <ComplexMatrix, Matrix>; +template class base_lu <ComplexMatrix, Complex, Matrix, double>; // Define the constructor for this particular derivation.
--- a/liboctave/CmplxLU.h +++ b/liboctave/CmplxLU.h @@ -32,20 +32,22 @@ #include "CMatrix.h" class -ComplexLU : public base_lu <ComplexMatrix, Matrix> +ComplexLU : public base_lu <ComplexMatrix, Complex, Matrix, double> { public: - ComplexLU (void) : base_lu <ComplexMatrix, Matrix> () { } + ComplexLU (void) + : base_lu <ComplexMatrix, Complex, Matrix, double> () { } ComplexLU (const ComplexMatrix& a); - ComplexLU (const ComplexLU& a) : base_lu <ComplexMatrix, Matrix> (a) { } + ComplexLU (const ComplexLU& a) + : base_lu <ComplexMatrix, Complex, Matrix, double> (a) { } ComplexLU& operator = (const ComplexLU& a) { if (this != &a) - base_lu <ComplexMatrix, Matrix> :: operator = (a); + base_lu <ComplexMatrix, Complex, Matrix, double> :: operator = (a); return *this; }
--- a/liboctave/NPSOL.h +++ b/liboctave/NPSOL.h @@ -203,6 +203,12 @@ void set_option (const string& key, int opt); void set_option (const string& key, double opt); + void set_option (const char *key, int opt) + { set_option (string (key), opt); } + + void set_option (const char *key, double opt) + { set_option (string (key), opt); } + private: double x_central_difference_interval;
--- a/liboctave/base-lu.cc +++ b/liboctave/base-lu.cc @@ -30,13 +30,13 @@ #include "base-lu.h" -template <class lu_type, class p_type> +template <class lu_type, class lu_elt_type, class p_type, class p_elt_type> lu_type -base_lu <lu_type, p_type> :: L (void) const +base_lu <lu_type, lu_elt_type, p_type, p_elt_type> :: L (void) const { int n = ipvt.length (); - lu_type l (n, n, 0.0); + lu_type l (n, n, lu_elt_type (0.0)); for (int i = 0; i < n; i++) { @@ -48,13 +48,13 @@ return l; } -template <class lu_type, class p_type> +template <class lu_type, class lu_elt_type, class p_type, class p_elt_type> lu_type -base_lu <lu_type, p_type> :: U (void) const +base_lu <lu_type, lu_elt_type, p_type, p_elt_type> :: U (void) const { int n = ipvt.length (); - lu_type u (n, n, 0.0); + lu_type u (n, n, lu_elt_type (0.0)); for (int i = 0; i < n; i++) { @@ -65,9 +65,9 @@ return u; } -template <class lu_type, class p_type> +template <class lu_type, class lu_elt_type, class p_type, class p_elt_type> p_type -base_lu <lu_type, p_type> :: P (void) const +base_lu <lu_type, lu_elt_type, p_type, p_elt_type> :: P (void) const { int n = ipvt.length (); @@ -88,7 +88,7 @@ } } - p_type p (n, n, 0.0); + p_type p (n, n, p_elt_type (0.0)); for (int i = 0; i < n; i++) p.xelem (i, pvt.xelem (i)) = 1.0;
--- a/liboctave/base-lu.h +++ b/liboctave/base-lu.h @@ -29,7 +29,7 @@ #include "MArray.h" -template <class lu_type, class p_type> +template <class lu_type, class lu_elt_type, class p_type, class p_elt_type> class base_lu { public:
--- a/liboctave/dbleLU.cc +++ b/liboctave/dbleLU.cc @@ -38,7 +38,7 @@ #include <base-lu.h> #include <base-lu.cc> -template class base_lu <Matrix, Matrix>; +template class base_lu <Matrix, double, Matrix, double>; // Define the constructor for this particular derivation.
--- a/liboctave/dbleLU.h +++ b/liboctave/dbleLU.h @@ -31,20 +31,20 @@ #include "dMatrix.h" class -LU : public base_lu <Matrix, Matrix> +LU : public base_lu <Matrix, double, Matrix, double> { public: - LU (void) : base_lu <Matrix, Matrix> () { } + LU (void) : base_lu <Matrix, double, Matrix, double> () { } LU (const Matrix& a); - LU (const LU& a) : base_lu <Matrix, Matrix> (a) { } + LU (const LU& a) : base_lu <Matrix, double, Matrix, double> (a) { } LU& operator = (const LU& a) { if (this != &a) - base_lu <Matrix, Matrix> :: operator = (a); + base_lu <Matrix, double, Matrix, double> :: operator = (a); return *this; }