40 lines
1.2 KiB
C
40 lines
1.2 KiB
C
#ifndef MATRIX_LIB
|
|
#define MATRIX_LIB
|
|
/**
|
|
* Author: ONUR CAYAN
|
|
* Created: 27.10.2023
|
|
*
|
|
* (c) Copyright by ANKASYS
|
|
**/
|
|
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
struct mat_type {
|
|
int rows;
|
|
int columns;
|
|
char* name;
|
|
double** matrix;
|
|
};
|
|
|
|
typedef struct mat_type mat_type;
|
|
|
|
mat_type* create_matrix(int row, int column, char* name);
|
|
void set_matrix_name(mat_type* mat, char* name);
|
|
void print_mat(mat_type* m_matrix);
|
|
mat_type* matrix_multiply(mat_type* matrix1, mat_type* matrix2);
|
|
mat_type* transpose_matrix(mat_type* m_matrix);
|
|
void free_matrix(mat_type* m_matrix);
|
|
void initialize_vec(const double* var, mat_type* vector); // initialize all elements via an array
|
|
void initialize_all(double var, mat_type* mat); // initialize all elements to same variable
|
|
unsigned int number_of_nonzero_rows(mat_type* m);
|
|
int matrix_rank(mat_type* mat);
|
|
double calculate_determinant_4x4(mat_type* matrix);
|
|
double calculate_determinant_3x3(mat_type* matrix);
|
|
mat_type* calculate_matrix_inverse(mat_type* matrix);
|
|
double trace(mat_type* m); // finds diagolan elements sum in a matrix
|
|
double absolute(double d);
|
|
|
|
#endif
|