matrix在c语⾔中需要什么头⽂件,矩阵运算库C语⾔
(Matrix_hub)
Matrix_hub
矩阵运算库--C语⾔
##The lib of Matrix operation for C language. (矩阵运算库--C语⾔)
Author: Amoiensis
Email: Amoiensis@outlook
Data:2020.02.12
具体代码和信息 见链接:
具体:
Folder_--_lib_.lib⽂件_+_.h⽂件
Folder_--_code_.c⽂件_+_.h⽂件
CONTENT
####(操作-函数)
操作
OPERATION
func_NAME
⽣成矩阵
generation
Matrix_gen
复制矩阵
copy
Matrix_copy
乘法
multiply
M_mul
加减法
add/sub
M_add_sub
矩阵显⽰
print
M_print
identity_matrix(gen)
M_I
矩阵基本变换
matrix_element_teransf
M_E_trans
基本变换矩阵
Element_trans2Matrix
Etrans_2_Matrix
基本变换矩阵的逆矩阵
inv_Element_trans2Matrix
Etrans_2_Inverse
上三⾓化
Upper_triangular_transformation
M_Uptri_
上三⾓化(求逆⽤)
Upper_triangular_transformation_for_Inverse M_Uptri_4inv
下三⾓化
Lower_triangular_transformation
M_Lowtri_
下三⾓化(求逆⽤)
Lower_triangular_transformation_for_Inverse M_Lowtri_4inv
对⾓矩阵求逆
c语言struct头文件Matrix_Inv_for_Dia_matrix
M_Dia_Inv
对⾓化
Diagonalization
M_Diatri_
求逆
Matrix_Inverse
M_Inverse
矩阵⾏(列)调换
M_Swap
转置
Transpose
M_T
切取部分矩阵
Cut_out_part_of_Matrix M_Cut
释放内存
free_mempry_of_Matrix M_free
trace
M_tr
⾏列式
Determinant
M_det
填充
Full
M_full
范数
Norm
M_norm
矩阵数乘
Number Multiplication
M_numul
(使⽤矩阵)填充矩阵
Full with matrix
M_matFull
⽣成(全)零矩阵Generation Zeros Matrix M_Zeros
⽣成(全)⼀矩阵Generation Ones Matrix
寻矩阵对应值位置(列优先)
Find position with the value in Matrix
M_find
矩阵按列求和/向量元素和
Matrix column sum / Vector element sum
M_sum
矩阵按列最⼩⾏位置/向量最⼩元素位置
Matrix minimum row position / Vector minimum element position M_min
矩阵按列最⼤⾏位置/向量最⼤元素位置
Matrix maximum row position / Vector maximum element position M_max
矩阵各列指定⾏位置的值
The value of the specified row position
of each column of the matrix
M_minax_val
矩阵各位置与给定值⽐较(返回矩阵,取值0/1)
Compare each position of the matrix with the given value
(return the matrix, the value is 0/1)
M_logic_equal
两矩阵对应位置逻辑运算
Logical operation of corresponding positions of two matrices
M_logic
矩阵对应元素乘/除
Multiply / divide corresponding elements of matrix
M_pmuldiv
矩阵批量赋值(使⽤矩阵传递)
Matrix batch assignment (using matrix transfer)
M_setval
code:Demo (Matrix_hub)
/*
%% IMFORMATION
%% MATRIX_HUB
% Email:Amoiensis@outlook
% Data: 2020.02.12
% Case: Matrix Operation
% Dtailed: the code_file of Matrix_hub
*/
#include #include #include "matrix.h"
int main(int argc, char *argv[]) {
// Matrix
//Mat_1
MATRIX_TYPE _mat_1[3][5] = { 2,2,1,1,1,4,1,1,1,1,1,5,1,1,1 };
int row = sizeof(_mat_1) / sizeof(_mat_1[0]);
int column = sizeof(_mat_1[0]) / sizeof(_mat_1[0][0]);
Matirx* mat_1 = Matrix_gen(row,column,_mat_1);
M_print(mat_1);
//Mat_2
MATRIX_TYPE _mat_2[5][3] = { 1,2,3,4,5,6,7,8,7,10,11,12,11,14,15 };
//MATRIX_TYPE _mat_2[5][2] = { 1,2,3,4,5,6,7,8,9,10};
row = sizeof(_mat_2) / sizeof(_mat_2[0]);
column = sizeof(_mat_2[0]) / sizeof(_mat_2[0][0]);
Matirx* mat_2 = Matrix_gen(row,column,_mat_2);
M_print(mat_2);
/
/ Mat_A
MATRIX_TYPE _mat_A[5][5] = { 1,0,7,0,9,0,7,0,9,0,0,0,-5,0,4,2,0,0,2,0,0,3,8,0,1}; row = sizeof(_mat_A) / sizeof(_mat_A[0]);
column = sizeof(_mat_A[0]) / sizeof(_mat_A[0][0]);
Matirx* mat_A = Matrix_gen(row,column,_mat_A);
M_print(mat_A);
//Mat_21
MATRIX_TYPE _mat_21[3][3] = { 1,2,3,2,2,2,4,1,3};
row = sizeof(_mat_21) / sizeof(_mat_21[0]);
column = sizeof(_mat_21[0]) / sizeof(_mat_21[0][0]);
Matirx* mat_21 = Matrix_gen(row,column,_mat_21);
M_print(mat_21);

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。