Skip to content

Latest commit

 

History

History
57 lines (53 loc) · 1.23 KB

README.md

File metadata and controls

57 lines (53 loc) · 1.23 KB

matrix

中文

All class and methods is included in namespace la (the acronym of Linear Algebra).

A cpp template class to calculate matrix.

Only work well in Visual Studio.

Usage

auto a = la::matrix<3, 3>({ 1,2,3,4,5,6,7,8,9 });
auto b = la::matrix<3, 3>({ 6,5,7,6,1,3,5,9,4 });
//init two matrix using vector
std::cout << a; //out put matrix to consale
print(hdc, a); //out put matrix to Windows framework
//paint in gray degree
a = -a; //negative
a = ~a; //transposition
b += a; //add a to b
auto c = b + a; //calculate sum of two matrix
b -= a;
auto c = b - a;
a *= 5;
auto c = a * 5; //5*a is also legal and equal
//if you want to calculate product of two matrix, olease use operator%
a /= 10;
auto c = a/10; // 10/a is illegal
auto c = a % b; //calculate product of two matrix
a %= b; //only available when both a & b is square matrix
//usage of iterator is similar to std::vector
for (auto iter = a.begin(); iter != a.end(); ++iter) {
    std::cout << *i << "\t";
}
//there are const_iterator, reverse_iterator, const_reverse_iterator available
//pay attention to use --iter when using reverse_iterator