-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMatrixIterator.h
52 lines (41 loc) · 1.12 KB
/
MatrixIterator.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <iostream>
using namespace std;
/*
求两个矩阵运算
*/
double* MatrixMutl(double *a, double *b, int n);
double** MatrixMutl(double **a, double **b, int n);
double* MatrixMutl(double **a, double *b, int n);
double* MatrixMutl(double *a, int n, double t);
double* MatrixAdd(double *a, double *b, int n);
double** MatrixAdd(double **a, double **b, int n);
double* MatrixMinus(double *a,double *b,int n);
double** MatrixMinus(double **a, double **b, int n);
double** MatrixTranspose(double **a, int n);
double* MatrixTranspose(double *a, int n);
/*
求两个向量的范数
*/
double Norm(double *a, int n);
//a-b的范数
double Norm(double *a, double *b, int n);
/*
Jacobi迭代法,实现求AX=b
*/
double* Jacobi(int n, double *x0,double **a, int N, double TOL);
void testJacobi();
/*
Gauss-Seidel迭代法,实现求AX=b
*/
double* Gauss_Seidel(int n, double *x0,double **a, int N, double TOL);
void testGauss_Seidel();
/*
SOR算法
*/
double* SOR(double w,int n, double *x0,double **a, int N, double TOL);
void testSOR();
/*
预处理共轭梯度法
*/
double *Gradient(int n,double *x0,double **a,double *b,double *c,int N,double TOL);
void testGradient();