Sample3_9.cs
Upload User: wen_feilan
Upload Date: 2014-09-01
Package Size: 246k
Code Size: 1k
Development Platform:

Others

  1. /*
  2.  * 示例程序Sample3_9: Matrix类的对称正定矩阵的乔里斯基分解与行列式的求值
  3.  */
  4. using System;
  5. using CSharpAlgorithm.Algorithm;
  6. namespace CSharpAlgorithm.Sample
  7. {
  8. class Class1
  9. {
  10. [STAThread]
  11. static void Main(string[] args)
  12. {
  13.             // 矩阵数据
  14.             double[] mtxData10 = {
  15.                                      5.0,7.0,6.0,5.0,
  16.                                      7.0,10.0,8.0,7.0,
  17.                                      6.0,8.0,10.0,9.0,
  18.                                      5.0,7.0,9.0,10.0};
  19.             // 构造矩阵
  20.             Matrix mtx10 = new Matrix(4, mtxData10);
  21.             // 对称正定矩阵的乔里斯基分解与行列式的求值
  22.             double detValue = 0.0;
  23.             if (mtx10.ComputeDetCholesky(ref detValue))
  24.             {
  25.                 Console.WriteLine("行列式=" + detValue); 
  26.                 Console.WriteLine("分解后的下三角矩阵="); 
  27.                 Console.WriteLine(mtx10); 
  28.             }
  29.             else
  30.             {
  31.                 Console.WriteLine("失败");
  32.             }
  33.         }
  34. }
  35. }