📄 sample4_9.cs
字号:
/*
* 示例程序Sample4_9: LEquations类的求解对称正定方程组的平方根法
*/
using System;
using CSharpAlgorithm.Algorithm;
namespace CSharpAlgorithm.Sample
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
// 系数矩阵数据
double[] mtxDataCoef8 = {
5.0,7.0,6.0,5.0,
7.0,10.0,8.0,7.0,
6.0,8.0,10.0,9.0,
5.0,7.0,9.0,10.0};
// 常数矩阵数据
double[] mtxDataConst8 = {
23.0,92.0,
32.0,128.0,
33.0,132.0,
31.0,124.0};
// 构造系数矩阵
Matrix mtxCoef8 = new Matrix(4, mtxDataCoef8);
// 构造常数矩阵
Matrix mtxConst8 = new Matrix(4, 2, mtxDataConst8);
// 构造线性方程组
LEquations leqs8 = new LEquations(mtxCoef8, mtxConst8);
// 求解对称正定方程组的平方根法
Matrix mtxResult8 = new Matrix();
if (leqs8.GetRootsetCholesky(mtxResult8))
{
Console.WriteLine(mtxResult8);
}
else
{
Console.WriteLine("失败");
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -