上传者: dododododoooo
|
上传时间: 2022-07-16 17:30:21
|
文件大小: 9KB
|
文件类型: DLL
包含矩阵定义,矩阵输出,矩阵格式化输出,矩阵转置,矩阵相加,矩阵相乘,N阶方阵行列式求值,求逆,求伴随矩阵,求上三角形
命名空间:matrix
定义类:Matrix
方法:
public Matrix(int mm, int nn)
定义矩阵A:
Matrix A=new Matrix(int mm, int nn);
public double read(int i, int j)
获取Aij:
A.read(i,j);
public int write(int i, int j, double val)
将数据b写入Aij:
A.read(i,j,b);
释放矩阵:
public void freeMatrix()
A.freeMatrix();
方法:
//C = A + B
//成功返回1,失败返回-1
public int add(ref Matrix A, ref Matrix B, ref Matrix C)
//C = A - B
//成功返回1,失败返回-1
public int subtract(ref Matrix A, ref Matrix B, ref Matrix C)
//C = A * B
//成功返回1,失败返回-1
public int multiply(ref Matrix A, ref Matrix B, ref Matrix C)
//行列式的值,只能计算2 * 2,3 * 3
//失败返回-31415,成功返回值
public double det(ref Matrix A)
//求转置矩阵,B = AT
//成功返回1,失败返回-1
public int transpos(ref Matrix A, ref Matrix B)
//求逆矩阵,B = A^(-1)
//成功返回1,失败返回-1
public int inverse(ref Matrix A, ref Matrix B)
//矩阵输出//
public string Out(ref Matrix A)
//矩阵格式化输出//
public string Outt(ref Matrix A, string format)
//矩阵一维数组赋值//
public void Fuzhi( ref Matrix A , double[] arr)
//方阵行列式值//
public double Det(ref Matrix A)
//矩阵的伴随矩阵//
public void Accompany(ref Matrix A, ref Matrix B)
//伴随矩阵法求矩阵的逆//
public void Inverse(ref Matrix A, ref Matrix B)
//矩阵相等//
public void Equal(ref Matrix A, ref Matrix B)
//C = A + B
//成功返回1,失败返回-1
A.add(ref Matrix A, ref Matrix B, ref Matrix C);
//C = A - B
//成功返回1,失败返回-1
A.subtract(ref Matrix A, ref Matrix B, ref Matrix C)
//C = A * B
//成功返回1,失败返回-1
A.multiply(ref Matrix A, ref Matrix B, ref Matrix C)
//行列式的值,只能计算2 * 2,3 * 3
//失败返回-31415,成功返回值
A.det(ref Matrix A)
//求转置矩阵,B = AT
//成功返回1,失败返回-1
A.transpos(ref Matrix A, ref Matrix B)
//求逆矩阵,B = A^(-1)
//成功返回1,失败返回-1
A.inverse(ref Matrix A, ref Matrix B)
//矩阵输出//
A.Out(ref Matrix A)
//矩阵6位小数输出//
A.Outt(ref Matrix A)
//矩阵一维数组赋值//
A.Fuzhi( ref Matrix A , double[] arr)
//方阵行列式值//
A.Det(ref Matrix A)
//矩阵格式化输出//
public string Outt(ref Matrix A, string format)
A.Outt(ref Matrix A, string format);
//矩阵的伴随矩阵//
public void Accompany(ref Matrix A, ref Matrix B)
A.Accompany(ref Matrix A, ref Matrix B);
//伴随矩阵法求矩阵的逆//
public void Inverse(ref Matrix A, ref Matrix B)
A.Inverse(ref Matrix A, ref Matrix B);
//矩阵相等//
public void Equal(ref Matrix A, ref Matrix B)
A.Equal(ref Matrix A, ref Matrix B);
格式说明符说明 示例 输出
C 货币 2.5.ToString("C") ¥2.50
D 十进制数 25.ToString("D5") 00025
E 科学型 25000.ToString("E") 2.500000E+005
F 固定点 25.ToString("F2") 25.00
G 常规 2.5.ToString("G") 2.5
N 数字 2500000.ToString("N") 2,500,000.00
X 十六进制 255.ToString("X") FF