资源简介
处理间接平差
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.Text;
namespace NameMatrix
{
class Matrix
{
/// 矩阵的乘
public static void MatrixMultiply(double[] a double[] b double[] c)
{
if (a.GetLength(1) != b.GetLength(0))
return;
if (a.GetLength(0) != c.GetLength(0) || b.GetLength(1) != c.GetLength(1))
return;
for (int i = 0; i < a.GetLength(0); i++)
{
for (int j = 0; j < b.GetLength(1); j++)
{
c[i j] = 0;
for (int k = 0; k < b.GetLength(0); k++)
{
c[i j] += a[i k] * b[k j];
}
}
}
}
/// 矩阵的加
public static void MatrixAdd(double[] a double[] bdouble[] c)
{
if (a.GetLength(0) != b.GetLength(0) || a.GetLength(1) != b.GetLength(1)
|| a.GetLength(0) != c.GetLength(0) || a.GetLength(1) != c.GetLength(1))
return;
for (int i = 0; i < a.GetLength(0); i++)
{
for (int j = 0; j < a.GetLength(1); j++)
{
c[i j] = a[i j] + b[i j];
}
}
return;
}
/// 矩阵的减
public static void MatrixSubtration(double[] a double[] b double[] c)
{
if (a.GetLength(0) != b.GetLength(0) || a.GetLength(1) != b.GetLength(1)
|| a.GetLength(0) != c.GetLength(0) || a.GetLength(1) != c.GetLength(1))
return;
for (int i = 0; i < a.GetLength(0); i++)
{
for (int j = 0; j < a.GetLength(1); j++)
{
c[i j] = a[i j] - b[i j];
}
}
return;
}
/// 矩阵的行列式的值
public static double MatrixSurplus(double[] a)
{
int i j k p r m n;
m = a.GetLength(0);
n = a.GetLength(1);
double X temp = 1 temp1 = 1 s = 0 s1 = 0;
if (n == 2)
{
for (i = 0; i < m; i++)
for (j = 0; j < n; j++)
if ((i + j) % 2 > 0) temp1 *= a[i j];
else temp *= a[i j];
X = temp - temp1;
}
else
{
for (k = 0; k < n; k+
评论
共有 条评论