?? sample4_14.java
字號:
/*
* 示例程序Sample4_14: LEquations類的求解線性最小二乘問題的豪斯荷爾德變換法
*/
package javaalgorithm.sample;
import javaalgorithm.algorithm.Matrix;
import javaalgorithm.algorithm.LEquations;
public class Sample4_14
{
public 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))
{
System.out.println(mtxResult13);
}
else
{
System.out.println("失敗");
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -