Skip to content

AndrewBuryachok/matrix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Matrix Class C++

Create matrix

Matrix<float> A(3), B(3, 3);
Matrix<double> C(2, 1);
Matrix<bool> E = elementary_matrix<bool>(3);

Read from console

std::cin >> A;

Write to console

std::cout << A;

Read from file

std::ifstream fin("input.txt");
fin >> A;
fin.close();

Write to file

std::ofstream fout("output.txt");
fout << A;
fout.close();

Get/Set element by row and column

int value = A(2, 2);

Compare matrices

if (A == B) //do something
if (A != B) //do something

Binary operations

Matrix<float> result = A + B;
Matrix<float> result = A - B;
Matrix<float> result = A * B;
Matrix<float> result = A / B;

Elementary operations

// Operation_Type: Row or Column
first_elementary(number1, number2, type);
second_elementary(number, value, type);
third_elementary(number1, number2, value, type);

Transposition

Matrix<float> A_T = A.transposed();

Determinant

float result = A.det();

Invertion

matrix<float> A_inv = A.inverted();

Rank

int rank = A.rank();

Triangular and Diagonal forms

A.to_triangular();
A.to_diagonal();

Decompompositions

Matrix<float> L = A.LU_L(), U = LU_U();
A.Cholesky();
A.Frobenius();

About

Matrix Class on C++

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages