/* Example programs from the book Scientific and Engineering Programming in C++: An Introduction with Advanced Techniques and Examples, Addison-Wesley, 1994. (c) COPYRIGHT INTERNATIONAL BUSINESS MACHINES CORPORATION 1994. ALL RIGHTS RESERVED. See README file for further details. */ #ifndef LapackArithmeticH #define LapackArithmeticH #include "LapackWrap/Lapack.h" #include "Algebra/MetricSpaceCategory.h" #include "Algebra/SemiGroupCategory.h" #include "Vector/MatrixCategory.h" template class ConstLapackVector : public ConstArrayProjection1d, public MetricSpaceCategory,Measure> { public: ConstLapackVector(const ConstArray2d& a, Subscript i) : ConstArrayProjection1d(a,i,1) {} Measure dot(const ConstLapackVector& rhs) const; }; template class LapackVector : public virtual Array1d, public ConstLapackVector { public: LapackVector(Array2d& a, Subscript i) : ConstLapackVector(a,i) {} LapackVector& operator=(const Array1d& a){ doAssign(a); return *this; } LapackVector& operator=(const T& a){ doAssign(a); return *this; } }; #include "Vector/DistributingAbelianGroup.h" template class LapackArithmetic : public LapackUnfactored, public DistributingAbelianGroup, LapackUnfactored::EltT>, public SemiGroupCategory< LapackArithmetic >, public MetricSpaceCategory< LapackArithmetic, Measure > { public: LapackArithmetic(Subscript nrows, Subscript ncols) : LapackUnfactored(nrows,ncols){} LapackArithmetic(const ConstArray2d& rhs) : LapackUnfactored(rhs) {} LapackArithmetic& operator=(const ConstArray2d& rhs) { LapackUnfactored::operator=(rhs); return *this; } LapackArithmetic& operator=(const EltT& rhs) { LapackUnfactored::operator=(rhs); return *this; } LapackArithmetic& operator*=(const LapackArithmetic& a){ rep() *= a.rep(); return *this; } ConstLapackVector operator[](Subscript i) const { return ConstLapackVector(*this,i); } LapackVector operator[](Subscript i) { return LapackVector(*this,i); } Measure dot(const LapackArithmetic& rhs) const; }; #ifdef XLC_QNOTEMPINC #include "AutoDeriv/LapackArithmetic.c" #endif #endif