⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sample3_12.cs

📁 使用C#编辑的一些矩阵运算的源程序
💻 CS
字号:
/*
 * 示例程序Sample3_12: Matrix类的一般实矩阵的奇异值分解
 */

using System;
using CSharpAlgorithm.Algorithm;

namespace CSharpAlgorithm.Sample
{
	class Class1
	{
		[STAThread]
		static void Main(string[] args)
		{
            // 矩阵数据
            double[] mtxData13 = {
                                     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 mtx13 = new Matrix(4, 3, mtxData13);

            // 一般实矩阵的奇异值分解
            Matrix mtxU1 = new Matrix();
            Matrix mtxV = new Matrix();
            if (mtx13.SplitUV(mtxU1, mtxV, 0.0001))
            {
                Console.WriteLine("分解后的U矩阵=");
                Console.WriteLine(mtxU1);
                Console.WriteLine("-------------------------------"); 
                Console.WriteLine("分解后的V矩阵=");
                Console.WriteLine(mtxV);
                Console.WriteLine("-------------------------------"); 
                Console.WriteLine("分解后的A矩阵=");
                Console.WriteLine(mtx13);
            }
            else
            {
                Console.WriteLine("失败");
            }
        }
	}
}

⌨️ 快捷键说明

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