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

📄 sample4_10.cs

📁 用于矩阵的各种运算
💻 CS
字号:
/*
 * 示例程序Sample4_10: LEquations类的求解大型稀疏方程组的全选主元高斯-约去消去法
 */

using System;
using CSharpAlgorithm.Algorithm;

namespace CSharpAlgorithm.Sample
{
	class Class1
	{
		[STAThread]
		static void Main(string[] args)
		{
            // 系数矩阵数据
            double[] mtxDataCoef9 = {
                                        0.0,0.0,-1.0,0.0,0.0,0.0,2.0,0.0,
                                        0.0,6.0,0.0,0.0,0.0,-6.0,0.0,0.0,
                                        0.0,0.0,0.0,2.0,0.0,0.0,0.0,-4.0,
                                        3.0,0.0,0.0,0.0,-2.0,0.0,1.0,0.0,
                                        0.0,0.0,6.0,0.0,0.0,0.0,5.0,0.0,
                                        1.0,0.0,0.0,0.0,-3.0,0.0,0.0,2.0,
                                        0.0,4.0,0.0,-1.0,0.0,0.0,0.0,0.0,
                                        0.0,0.0,1.0,0.0,-1.0,0.0,0.0,-2.0};
            // 常数矩阵数据
            double[] mtxDataConst9 = {
                                         4.0,
                                         6.0,
                                         -8.0,
                                         -2.0,
                                         27.0,
                                         -9.0,
                                         2.0,
                                         -4.0};
		
            // 构造系数矩阵
            Matrix mtxCoef9 = new Matrix(8, mtxDataCoef9);
            // 构造常数矩阵
            Matrix mtxConst9 = new Matrix(8, 1, mtxDataConst9);

            // 构造线性方程组
            LEquations leqs9 = new LEquations(mtxCoef9, mtxConst9);
		
            // 求解大型稀疏方程组的全选主元高斯-约去消去法
            Matrix mtxResult9 = new Matrix();
            if (leqs9.GetRootsetGgje(mtxResult9))
            {
                Console.WriteLine(mtxResult9);
            }
            else
            {
                Console.WriteLine("失败");
            }
        }
	}
}

⌨️ 快捷键说明

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