sample3_11.cs
来自「C#的数值计算的几乎所有算法」· CS 代码 · 共 42 行
CS
42 行
/*
* 示例程序Sample3_11: Matrix类的一般实矩阵的QR分解
*/
using System;
using CSharpAlgorithm.Algorithm;
namespace CSharpAlgorithm.Sample
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
// 矩阵数据
double[] mtxData12 = {
1.0,1.0,-1.0,
2.0,1.0,0.0,
1.0,-1.0,0.0,
-1.0,2.0,1.0};
// 构造矩阵
Matrix mtx12 = new Matrix(4, 3, mtxData12);
// 一般实矩阵的QR分解
Matrix mtxQ = new Matrix();
if (mtx12.SplitQR(mtxQ))
{
Console.WriteLine("分解后的Q矩阵=");
Console.WriteLine(mtxQ);
Console.WriteLine("-------------------------------");
Console.WriteLine("分解后的R矩阵=");
Console.WriteLine(mtx12);
}
else
{
Console.WriteLine("失败");
}
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?