📄 mmatrixmethods.h
字号:
// file: $isip/class/math/matrix/MMatrix/MMatrixMethods.h// version: $Id: MMatrixMethods.h,v 1.54 2002/02/21 16:44:36 hamaker Exp $//// make sure definitions are only made once//#ifndef ISIP_MMATRIX_METHODS#define ISIP_MMATRIX_METHODS// isip include files//#ifndef ISIP_MVECTOR#include <MVector.h>#endif#ifndef ISIP_MSCALAR#include <MScalar.h>#endif#ifndef ISIP_LONG#include <Long.h>#endif#ifndef ISIP_CHAR#include <Char.h>#endif// forward class definitions//template<class TScalar, class TIntegral> class MMatrix;class VectorLong;// MMatrixMethods: a friend class to the MMatrix template.// its purpose is mainly to provide a mechanism to get source code// out of the header file and into implementation files.//class MMatrixMethods { //--------------------------------------------------------------------------- // // required public methods // //---------------------------------------------------------------------------public: // static methods // template <class TMatrix, class TScalar, class TIntegral> static boolean diagnose(Integral::DEBUG debug_level); // assign methods // template <class TScalar, class TIntegral, class TAScalar, class TAIntegral> static boolean assign(MMatrix<TScalar, TIntegral>& obj, const MMatrix<TAScalar, TAIntegral>& arg); // i/o methods // template <class TScalar, class TIntegral> static long sofSize(const MMatrix<TScalar, TIntegral>& obj); template <class TScalar, class TIntegral> static boolean read(MMatrix<TScalar, TIntegral>& obj, Sof& sof, long tag, const String& name); template <class TScalar, class TIntegral> static boolean write(const MMatrix<TScalar, TIntegral>& obj, Sof& sof, long tag, const String& name); template <class TScalar, class TIntegral> static boolean readData(MMatrix<TScalar, TIntegral>& obj, Sof& sof, const String& pname, long size = SofParser::FULL_OBJECT, boolean param = true, boolean nested = false); template <class TScalar, class TIntegral> static boolean writeData(const MMatrix<TScalar, TIntegral>& obj, Sof& sof, const String& name); //--------------------------------------------------------------------------- // // class-specific public methods: // extensions to required methods // //--------------------------------------------------------------------------- // method: eq // template <class TScalar, class TIntegral> static boolean eq(const MMatrix<TScalar, TIntegral>& obj, TIntegral value); // array conversion methods // template <class TScalar, class TIntegral, class TAIntegral> static boolean assign(MMatrix<TScalar, TIntegral>& obj, long nrows, long ncols, const TAIntegral* arg, Integral::MTYPE type); template <class TScalar, class TIntegral> static boolean assignComplexDiagnose(MMatrix<TScalar, TIntegral>& obj, long nrows, long ncols, const double* arg, Integral::MTYPE type); // conversion from string methods // template <class TScalar, class TIntegral> static boolean assign(MMatrix<TScalar, TIntegral>& obj, long nrows, long ncols, const String* arg, Integral::MTYPE type); template <class TScalar, class TIntegral> static boolean assign(MMatrix<TScalar, TIntegral>& obj, long nrows, long ncols, const String& arg, Integral::MTYPE type, const Char delim); // copy methods // template <class TScalar, class TIntegral, class TAScalar, class TAIntegral> static boolean copy(MMatrix<TScalar, TIntegral>& obj, const MMatrix<TAScalar, TAIntegral>& arg); // swap methods // template <class TScalar, class TIntegral> static boolean swap(MMatrix<TScalar, TIntegral>& obj, MMatrix<TScalar, TIntegral>& matrix); //--------------------------------------------------------------------------- // // class-specific public methods: // operator overloads, get, find, and set methods // //--------------------------------------------------------------------------- // methods to get values from a matrix // template <class TScalar, class TIntegral> static TIntegral getValue(const MMatrix<TScalar, TIntegral>& obj, long row_index, long col_index); template <class TScalar, class TIntegral> static boolean getValue(const MMatrix<TScalar, TIntegral>& obj, TScalar& value, long row_index, long col_index); template <class TScalar, class TIntegral> static boolean getRow(const MMatrix<TScalar, TIntegral>& obj, MVector<TScalar, TIntegral>& vector, long row_index); template <class TScalar, class TIntegral> static boolean getColumn(const MMatrix<TScalar, TIntegral>& obj, MVector<TScalar, TIntegral>& vector, long col_index); template <class TScalar, class TIntegral> static boolean getDiagonal(const MMatrix<TScalar, TIntegral>& obj, MVector<TScalar, TIntegral>& vector); template <class TScalar, class TIntegral> static boolean getLower(const MMatrix<TScalar, TIntegral>& obj, MMatrix<TScalar, TIntegral>& arg); template <class TScalar, class TIntegral> static boolean getUpper(const MMatrix<TScalar, TIntegral>& obj, MMatrix<TScalar, TIntegral>& arg); template <class TScalar, class TIntegral> static boolean getMinor(const MMatrix<TScalar, TIntegral>& obj, MMatrix<TScalar, TIntegral>& arg, long row_index, long col_index); // methods to set values // template <class TScalar, class TIntegral> static boolean setValue(MMatrix<TScalar, TIntegral>& obj, long row_index, long col_index, TIntegral value); template <class TScalar, class TIntegral> static boolean setRow(MMatrix<TScalar, TIntegral>& obj, long row_index, const MVector<TScalar, TIntegral>& vector); template <class TScalar, class TIntegral> static boolean setColumn(MMatrix<TScalar, TIntegral>& obj, long col_index, const MVector<TScalar, TIntegral>& vector); template <class TScalar, class TIntegral> static boolean setDiagonal(MMatrix<TScalar, TIntegral>& obj, const MVector<TScalar, TIntegral>& values); template <class TScalar, class TIntegral> static boolean setLower(MMatrix<TScalar, TIntegral>& obj, const MMatrix<TScalar, TIntegral>& source); template <class TScalar, class TIntegral> static boolean setUpper(MMatrix<TScalar, TIntegral>& obj, const MMatrix<TScalar, TIntegral>& source); template <class TScalar, class TIntegral> static boolean setBlock(MMatrix<TScalar, TIntegral>& obj, long start_row, long start_col, long num_rows, long num_cols, TIntegral value); // methods to make matrices // template <class TScalar, class TIntegral> static boolean makeDiagonal(MMatrix<TScalar, TIntegral>& obj, const MVector<TScalar, TIntegral>& values, Integral::MTYPE type); template <class TScalar, class TIntegral> static boolean makeLower(MMatrix<TScalar, TIntegral>& obj, const MMatrix<TScalar, TIntegral>& source, Integral::MTYPE type); template <class TScalar, class TIntegral> static boolean makeUpper(MMatrix<TScalar, TIntegral>& obj, const MMatrix<TScalar, TIntegral>& source, Integral::MTYPE type); // methods to find values // template <class TScalar, class TIntegral> static boolean nextZero(const MMatrix<TScalar, TIntegral>& obj, long& row_index, long& col_index, long row_start, long col_start); template <class TScalar, class TIntegral> static boolean nextNonZero(const MMatrix<TScalar, TIntegral>& obj, TIntegral& value, long& row_index, long& col_index, long row_start, long col_start); template <class TScalar, class TIntegral> static long findRow(const MMatrix<TScalar, TIntegral>& obj, const MVector<TScalar, TIntegral>& vector); //--------------------------------------------------------------------------- // // class-specific public methods: // property checking methods // //--------------------------------------------------------------------------- // change/get type methods // template <class TScalar, class TIntegral> static boolean isTypePossible(const MMatrix<TScalar, TIntegral>& obj, Integral::MTYPE type); template <class TScalar, class TIntegral> static boolean isSquare(const MMatrix<TScalar, TIntegral>& obj, const MMatrix<TScalar, TIntegral>& matrix); template <class TScalar, class TIntegral> static boolean isOrthogonal(const MMatrix<TScalar, TIntegral>& obj); template <class TScalar, class TIntegral> static boolean isIdentity(const MMatrix<TScalar, TIntegral>& obj); //--------------------------------------------------------------------------- // // class-specific public methods: // relational and logical methods // //--------------------------------------------------------------------------- // relational and boolean methods // template <class TScalar, class TIntegral> static boolean gt(const MMatrix<TScalar, TIntegral>& obj, TIntegral value); template <class TScalar, class TIntegral> static boolean lt(const MMatrix<TScalar, TIntegral>& obj, TIntegral value); template <class TScalar, class TIntegral> static boolean ge(const MMatrix<TScalar, TIntegral>& obj, TIntegral value); template <class TScalar, class TIntegral> static boolean le(const MMatrix<TScalar, TIntegral>& obj, TIntegral value); template <class TScalar, class TIntegral> static long numEqual(const MMatrix<TScalar, TIntegral>& obj, TIntegral value); //--------------------------------------------------------------------------- // // class-specific public methods: // concatenation methods // //-------------------------------------------------------------------------- // concatenation methods // template <class TScalar, class TIntegral> static boolean concatByRow(MMatrix<TScalar, TIntegral>& obj, const MMatrix<TScalar, TIntegral>& additional_rows); template <class TScalar, class TIntegral> static boolean concatByColumn(MMatrix<TScalar, TIntegral>& obj, const MMatrix<TScalar, TIntegral>& additional_cols); //--------------------------------------------------------------------------- // // class-specific public methods: // ordering methods // //-------------------------------------------------------------------------- // ordering methods // template <class TScalar, class TIntegral> static boolean reorderRows(MMatrix<TScalar, TIntegral>& obj, const MVector<Long, long>& indexes); template <class TScalar, class TIntegral> static boolean reorderColumns(MMatrix<TScalar, TIntegral>& obj, const MVector<Long, long>& indexes); template <class TScalar, class TIntegral> static boolean swapRows(MMatrix<TScalar, TIntegral>& obj, const MMatrix<TScalar, TIntegral>& arg, long row1, long row2); template <class TScalar, class TIntegral> static boolean swapColumns(MMatrix<TScalar, TIntegral>& obj, const MMatrix<TScalar, TIntegral>& arg, long col1, long col2); //--------------------------------------------------------------------------- // // class-specific public methods: // basic mathematical methods // //--------------------------------------------------------------------------- template <class TScalar, class TIntegral> static boolean add(MMatrix<TScalar, TIntegral>& obj,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -