Skip to content
/ matrix Public

A cpp template class for matrix | C++矩阵模板类

License

Notifications You must be signed in to change notification settings

shizuku/matrix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A cpp template class for matrix | C++矩阵模板类

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages