📄 linearalgebra.h
字号:
// file: $isip/class/numeric/LinearAlgebra/LinearAlgebra.h// version: $Id: LinearAlgebra.h,v 1.7 2002/07/11 03:35:33 picone Exp $//// make sure definitions are only made once//#ifndef ISIP_LINEAR_ALGEBRA#define ISIP_LINEAR_ALGEBRA// isip include files//#ifndef ISIP_MATRIX_FLOAT#include <MatrixFloat.h>#endif#ifndef ISIP_VECTOR_FLOAT#include <VectorFloat.h>#endif#ifndef ISIP_MATRIX_DOUBLE#include <MatrixDouble.h>#endif#ifndef ISIP_VECTOR_DOUBLE#include <VectorDouble.h>#endif#ifndef ISIP_MEMORY_MANAGER#include <MemoryManager.h>#endif// LinearAlgebra: a storehouse for linear algebra operations that don't need// to be generalized to the math/matrix library//class LinearAlgebra { //--------------------------------------------------------------------------- // // public constants // //---------------------------------------------------------------------------public: // define the class name // static const String CLASS_NAME; //---------------------------------------- // // other important constants // //---------------------------------------- static const double SVD_SINGULAR_THRESH = 10e-6; //---------------------------------------- // // i/o related constants // //---------------------------------------- static const String DEF_PARAM; //---------------------------------------- // // default values and arguments // //---------------------------------------- //---------------------------------------- // // error codes // //---------------------------------------- static const long ERR = 35100; static const long ERR_LSOLVE_SINGULAR = 35101; //--------------------------------------------------------------------------- // // protected data // //---------------------------------------------------------------------------protected: // a static debug level // static Integral::DEBUG debug_level_d; // a static memory manager // static MemoryManager mgr_d; //--------------------------------------------------------------------------- // // required public methods // //---------------------------------------------------------------------------public: // method: name // static const String& name() { return CLASS_NAME; } // other static methods // static boolean diagnose(Integral::DEBUG debug_level); // method: setDebug // static boolean setDebug(Integral::DEBUG debug_level) { debug_level_d = debug_level; return true; } // method: debug // boolean debug(const unichar* msg) const { String output; output.debugStr(name(), msg, L""); Console::put(output); return true; } // method: destructor // ~LinearAlgebra() {} // method: default constructor // LinearAlgebra() {} // method: copy constructor // LinearAlgebra(const LinearAlgebra& arg) { assign(arg); } // method: assign // boolean assign(const LinearAlgebra& arg) { return true; } // method: operator= // LinearAlgebra& operator= (const LinearAlgebra& arg) { assign(arg); return *this; } // method: sofSize // long sofSize() const { return 0; } // method: read // boolean read(Sof& sof, long tag, const String& name = CLASS_NAME) { return true; } // method: write // boolean write(Sof& sof, long tag, const String& name = CLASS_NAME) const { return true; } // method: readData // boolean readData(Sof& sof, const String& pname = DEF_PARAM, long size = SofParser::FULL_OBJECT, boolean param = true, boolean nested = false) { return true; } // method: writeData // boolean writeData(Sof& sof, const String& name = DEF_PARAM) const { return true; } // method: eq // boolean eq(const LinearAlgebra& arg) const { return true; } // method: new // static void* operator new(size_t size) { return mgr_d.get(); } // method: new[] // static void* operator new[](size_t size) { return mgr_d.getBlock(size); } // method: delete // static void operator delete(void* ptr) { mgr_d.release(ptr); } // method: delete[] // static void operator delete[](void* ptr) { mgr_d.releaseBlock(ptr); } // method: setGrowSize // static boolean setGrowSize(long grow_size) { return mgr_d.setGrow(grow_size); } // method: clear // boolean clear(Integral::CMODE cmode = Integral::DEF_CMODE) { return true; } //--------------------------------------------------------------------------- // // class-specific public methods: // equation solvers // //--------------------------------------------------------------------------- // method: linearSolve // solves functions of the form A*x = b, for the unknown 'x' using // LU decomposition // static boolean linearSolve(VectorFloat& x, const MatrixFloat& A, const VectorFloat& b) { return linearSolveTemplate<MatrixFloat, VectorFloat>(x, A, b); } // method: linearSolve // solves functions of the form A*x = b, for the unknown 'x' using // LU decomposition // static boolean linearSolve(VectorDouble& x, const MatrixDouble& A, const VectorDouble& b) { return linearSolveTemplate<MatrixDouble, VectorDouble>(x, A, b); } //--------------------------------------------------------------------------- // // private methods // //---------------------------------------------------------------------------private: // templatized linear solver methods // template <class TMatrix, class TVector> static boolean linearSolveTemplate(TVector& x, const TMatrix& A, const TVector& b);};// end of include file// #endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -