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

📄 sample4_3.cs

📁 使用C#编辑的一些矩阵运算的源程序
💻 CS
字号:
/*
 * 示例程序Sample4_3: LEquations类的全选主元高斯-约当消去法
 */

using System;
using CSharpAlgorithm.Algorithm;

namespace CSharpAlgorithm.Sample
{
	class Class1
	{
		[STAThread]
		static void Main(string[] args)
		{
            // 系数矩阵数据
            double[] mtxDataCoef2 = {
                                        1.0,3.0,2.0,13.0,
                                        7.0,2.0,1.0,-2.0,
                                        9.0,15.0,3.0,-2.0,
                                        -2.0,-2.0,11.0,5.0};
            // 常数矩阵数据
            double[] mtxDataConst2 = {
                                         9.0,0.0,
                                         6.0,4.0,
                                         11.0,7.0,
                                         -2.0,-1.0};
		
            // 构造系数矩阵
            Matrix mtxCoef2 = new Matrix(4, mtxDataCoef2);
            // 构造常数矩阵
            Matrix mtxConst2 = new Matrix(4, 2, mtxDataConst2);

            // 构造线性方程组
            LEquations leqs2 = new LEquations(mtxCoef2, mtxConst2);
		
            // 全选主元高斯-约当消去法
            Matrix mtxResult2 = new Matrix();
            if (leqs2.GetRootsetGaussJordan(mtxResult2))
            {
                Console.WriteLine(mtxResult2);
            }
            else
            {
                Console.WriteLine("失败");
            }
        }
	}
}

⌨️ 快捷键说明

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