matinverseverify.c

来自「C语言实现复数型矩阵求逆」· C语言 代码 · 共 31 行

C
31
字号
#include "MatrixInverse.h"

int main()
{
	floatComplexMatrix *mat;
	floatComplexMatrix *matInverse;
	floatComplexMatrix *I;

	mat=floatComplexMatrixAlloc(3,3);
	mat->a[0][0]=floatComplexSet(1.0,1.0);
	mat->a[0][1]=floatComplexSet(2.0,1.0);
	mat->a[0][2]=floatComplexSet(3.0,2.0);
	mat->a[1][0]=floatComplexSet(4.0,2.0);
	mat->a[1][1]=floatComplexSet(5.0,1.0);
	mat->a[1][2]=floatComplexSet(2.0,7.0);
	mat->a[2][0]=floatComplexSet(3.0,8.0);
	mat->a[2][1]=floatComplexSet(9.0,1.0);
	mat->a[2][2]=floatComplexSet(3.0,2.0);
	printf("The original Matrix A:\n");
	floatPrintComplexMatrix(mat);
	matInverse=floatComplexMatrixInverse(mat);
	printf("The Inverse of matrix A:\n");
	floatPrintComplexMatrix(matInverse);
	I=floatComplexMatrixMpy(mat,matInverse);
	printf("A*A^(-1):\n");
	floatPrintComplexMatrix(I);
	floatComplexMatrixFree(mat);
	floatComplexMatrixFree(matInverse);
	
	return 0;
}

⌨️ 快捷键说明

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