-
Notifications
You must be signed in to change notification settings - Fork 0
Home
The Matrix Library is a C library designed for advanced matrix calculations. It provides a range of functions for performing matrix operations, including basic arithmetic operations (addition, subtraction, multiplication) and more advanced calculations such as matrix transposition, inversion, and determinant calculation. This library is intended for use in numerical computing and scientific applications.
- Matrix Operations: Addition, Subtraction, Multiplication
- Advanced Operations: Transposition, Inversion, Determinant Calculation
- Matrix Norm Calculation
- Identity Matrix Creation
- Eigenvalue Computation (Placeholder)
-
Clone the Repository
git clone https://github.com/rubikproxy/matrix.h cd matrix.h
-
Build the Library
make
-
Install the Library
sudo make install
-
Update Library Cache
sudo ldconfig
-
Clone the Repository
git clone https://github.com/rubikproxy/matrix.h cd matrix.h
-
Build the Library
make
-
Install the Library
sudo cp libmatrix.a /usr/local/lib/ sudo cp include/matrix.h /usr/local/include/
-
Verify Installation
ls /usr/local/lib/libmatrix.a ls /usr/local/include/matrix.h
-
Clone the Repository
git clone https://github.com/rubikproxy/matrix.h cd matrix.h
-
Build the Library
Use a compatible build system or manually compile the source files using MinGW or Visual Studio.
-
Install the Library
Copy the library and header files to appropriate directories:
-
Library:
libmatrix.a
toC:\Program Files\MatrixLib\lib\
-
Header:
matrix.h
toC:\Program Files\MatrixLib\include\
-
Library:
Here is an example demonstrating how to use the library:
#include <stdio.h>
#include <matrix.h>
int main() {
// Create matrices
Matrix *a = create_matrix(2, 2);
Matrix *b = create_matrix(2, 2);
// Initialize matrices
a->data[0] = 1; a->data[1] = 2;
a->data[2] = 3; a->data[3] = 4;
b->data[0] = 5; b->data[1] = 6;
b->data[2] = 7; b->data[3] = 8;
// Matrix addition
Matrix *result_add = matrix_add(a, b);
printf("Matrix Addition:\n");
print_matrix(result_add);
// Matrix multiplication
Matrix *result_mul = matrix_mul(a, b);
printf("Matrix Multiplication:\n");
print_matrix(result_mul);
// Clean up
free_matrix(a);
free_matrix(b);
free_matrix(result_add);
free_matrix(result_mul);
return 0;
}
Matrix Addition:
6.000000 8.000000
10.000000 12.000000
Matrix Multiplication:
19.000000 22.000000
43.000000 50.000000
Allocates memory for a matrix with the specified number of rows and columns.
Frees the memory allocated for the matrix.
Prints the matrix to the standard output.
Adds two matrices. The matrices must have the same dimensions.
Subtracts matrix b
from matrix a
. The matrices must have the same dimensions.
Multiplies two matrices. The number of columns in matrix a
must equal the number of rows in matrix b
.
Transposes the matrix.
Calculates the inverse of a square matrix. Returns NULL
if the matrix is not invertible.
Calculates the determinant of a square matrix.
Creates an identity matrix of the given size.
Calculates the Frobenius norm of the matrix.
Computes the eigenvalues of a square matrix. The real and imaginary parts are stored in the provided arrays.
This library is licensed under the MIT License. See the LICENSE file for more details.