?? p53_54test.cpp
字號(hào):
template <class Type> class SparseMatrix {
//對(duì)象: 是一個(gè)三元組<row, column, value>的集合。其中, row和column是整數(shù), 記憶矩陣
//元素所在的行號(hào)和列號(hào),而value是矩陣元素的值。
public:
SparseMatrix ( int MaxRow, int Maxcol ); //構(gòu)造函數(shù)
//建立一個(gè)MaxRow行, Maxcol列的稀疏矩陣。
SparseMatrix<Type> Transpose ( );
//對(duì)*this指示的三元組數(shù)組中各個(gè)三元組交換其行、列的值, 得到其轉(zhuǎn)置矩陣。
SparseMatrix<Type> Add ( SparseMatrix<Type> b );
//當(dāng)矩陣a(*this指示)與矩陣b的行、列數(shù)相同時(shí), 將這兩個(gè)矩陣的對(duì)應(yīng)項(xiàng)相加。
SparseMatrix<Type> Multiply ( SparseMatrix<Type> b );
//按公式 c[i][j]=∑(a[i][k]*b[k][j]) 實(shí)現(xiàn)矩陣a與b相乘。k=0, 1, …, a的列數(shù)-1。
private:
int Rows, Cols, Terms;
Trituple<Type> smArray[MaxTerms];
}
template <class Type> class SparseMatrix; //稀疏矩陣的類聲明
template <class Type> class Trituple { //三元組類Trituple
friend class SparseMatrix
private:
int row, col; //非零元素的行號(hào)、列號(hào)
Type value; //非零元素的值
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -