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

📄 sample4_13.cs

📁 使用C#编辑的一些矩阵运算的源程序
💻 CS
字号:
/*
 * 示例程序Sample4_13: LEquations类的求解对称正定方程组的共轭梯度法
 */

using System;
using CSharpAlgorithm.Algorithm;

namespace CSharpAlgorithm.Sample
{
	class Class1
	{
		[STAThread]
		static void Main(string[] args)
		{
            // 系数矩阵数据
            double[] mtxDataCoef12 = {
                                         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};
            // 常数矩阵数据
            double[] mtxDataConst12 = {
                                          23.0,
                                          32.0,
                                          33.0,
                                          31.0};
		
            // 构造系数矩阵
            Matrix mtxCoef12 = new Matrix(4, mtxDataCoef12);
            // 构造常数矩阵
            Matrix mtxConst12 = new Matrix(4, 1, mtxDataConst12);

            // 构造线性方程组
            LEquations leqs12 = new LEquations(mtxCoef12, mtxConst12);
		
            // 求解对称正定方程组的共轭梯度法
            Matrix mtxResult12 = new Matrix();
            leqs12.GetRootsetGrad(mtxResult12, 0.0001);
            Console.WriteLine(mtxResult12);
        }
	}
}

⌨️ 快捷键说明

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