- 6
- 0
- 约4.01千字
- 约 16页
- 2017-10-06 发布于河南
- 举报
矩阵求逆及相关运算(Inverse matrix and related operations)
矩阵求逆及相关运算(Inverse matrix and related operations)
使用系统;
使用system.collections.generic;
使用系统文本;
命名空间bytetest
{
摘要
/ / /算法的大致思想是通过行列式初等变换来求。
//
matrixcomputer公共类
{
摘要
/ / /求逆矩阵
//
/ / / 参数名=“dMatrix” /参数
// 返回 返回
公共静态双[,]逆矩阵(双[,] dMatrix)
{
/ /获取矩阵的行数
智力水平= dMatrix长度(1);
/ / / /求矩阵的行列式的值
/ /双dmatrixvalue = matrixvalue(dMatrix);
//如果(dmatrixvalue = = 0)
/ {
/返回null;
/ }
双[,] dreversematrix =新的双[ 2 ] *级水平;
/ /初始化矩阵水平×(2级)
对于(int = i 0;i 水平;i + +)
{
用于(int = 0;j 2 *级;j + +)
{
如果(j)
{
dreversematrix [我] = dMatrix [我];
}
其他的
{
如果(j水平= i)
{
dreversematrix [我] = 1;
}
其他的
{
dreversematrix [我] = 0;
}
}
}
}
对于(int = i 0,j = 0;i 水平和 ;+,+,+,+)
{
如果(dreversematrix [我] = = 0)
{
如果(i =水平- 1)
{
返回null;
}
int m=i + 1;
为(;dMatrix [ M ] = = 0;M + +)
{
如果(m==- 1)
{
返回null;
}
}
如果(m = level)
{
返回null;
}
其他的
{
/ /把我行和M行相加
为(int=j;n<2;
{
dreversematrix [我] + = dreversematrix [ M ];
}
}
}
双温= dreversematrix [我];
如果(临时)!= 1)
{
/ /把我行数据,变成以1开始的一行数据
为(int=j;n<2;
{
如果(dreversematrix [我]!= 0)
{
dreversematrix [我] / =温度;
}
}
}
All / / I line after the j to 0
For (int s = Level - 1; s I; s--)
{
Temp = dReverseMatrix[s, j];
For (int t = J; T 2*Level; t++)
{
DReverseMatrix[s, t] = (dReverseMatrix[i, t]*temp);
}
}
}
The matrix Level * / / (2*Level) Level * Level into matrix unit
For (int i = Level - 2; I = 0; i--)
{
For (int j = I + 1; J Level; j++)
{
If (dReverseMatrix[i, j] = = 0)
{
Double TMP = dReverseMatrix[i, j];
For (int n = J; n 2*Level; n++)
{
DReverseMatrix[i, n] = (tmp*dReverseMatrix[j, n]);
}
}
}
}
/ / returns the inverse matrix
Double[, [dReturn = new, double[Level, Level];
For (int i = 0; I Level; i++)
{
For (int j = 0; J Level; j++)
{
DReturn[i, j] = dReverseMatrix[i, j + Level];
}
}
Return dReturn;
}
/ / / summary
The corresponding matrix determinant value x
/ / / /summary
Name= MatrixList /param / / / param
/ / / returns/returns
Public, static, double, MatrixValue (double[, [MatrixList])
{
Int Level = MatrixList.GetLength (1);
Double[, [dMatrix = new, double[Level, Level];
Fo
您可能关注的文档
- 江苏自考28888工程经济学大纲(Jiangsu self taught 28888 project economics outline).doc
- 江西师大附中2010届高三理科物理10月月考试卷(Jiangxi Normal University attached 2010 senior high school physics 10 monthly exam paper).doc
- 汪国真诗集全集(The complete works of Wang Guozhen).doc
- 汽摩(Auto).doc
- 汽机专业名词解释(Explanation of turbine terminology).doc
- 汽车c1理论知识(Automotive C1 theory knowledge).doc
- 汽车修理中电路图的识别与设置(Identification and setting of circuit diagram in automobile repair).doc
- 汽车保险理赔(Automobile insurance claim settlement).doc
- 汽车尾部字母含义(Car tail letter meaning).doc
- 汽车名词解释(Automobile noun explanation).doc
原创力文档

文档评论(0)