?? sample4_14.cs
字號:
/*
* 示例程序Sample4_14: LEquations類的求解線性最小二乘問題的豪斯荷爾德變換法
*/
using System;
using CSharpAlgorithm.Algorithm;
namespace CSharpAlgorithm.Sample
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
// 系數矩陣數據
double[] mtxDataCoef13 = {
1.0,1.0,-1.0,
2.0,1.0,0.0,
1.0,-1.0,0.0,
-1.0,2.0,1.0};
// 常數矩陣數據
double[] mtxDataConst13 = {
2.0,
-3.0,
1.0,
4.0};
// 構造系數矩陣
Matrix mtxCoef13 = new Matrix(4, 3, mtxDataCoef13);
// 構造常數矩陣
Matrix mtxConst13 = new Matrix(4, 1, mtxDataConst13);
// 構造線性方程組
LEquations leqs13 = new LEquations(mtxCoef13, mtxConst13);
// 求解線性最小二乘問題的豪斯荷爾德變換法
Matrix mtxResult13 = new Matrix();
Matrix mtxResultQ = new Matrix();
Matrix mtxResultR = new Matrix();
if (leqs13.GetRootsetMqr(mtxResult13, mtxResultQ, mtxResultR))
{
Console.WriteLine(mtxResult13);
}
else
{
Console.WriteLine("失敗");
}
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -