sample3_9.cs

来自「用于矩阵的各种运算」· CS 代码 · 共 40 行

CS
40
字号
/*
 * 示例程序Sample3_9: Matrix类的对称正定矩阵的乔里斯基分解与行列式的求值
 */

using System;
using CSharpAlgorithm.Algorithm;

namespace CSharpAlgorithm.Sample
{
	class Class1
	{
		[STAThread]
		static void Main(string[] args)
		{
            // 矩阵数据
            double[] mtxData10 = {
                                     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};

            // 构造矩阵
            Matrix mtx10 = new Matrix(4, mtxData10);

            // 对称正定矩阵的乔里斯基分解与行列式的求值
            double detValue = 0.0;
            if (mtx10.ComputeDetCholesky(ref detValue))
            {
                Console.WriteLine("行列式=" + detValue); 
                Console.WriteLine("分解后的下三角矩阵="); 
                Console.WriteLine(mtx10); 
            }
            else
            {
                Console.WriteLine("失败");
            }		
        }
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?