项目作者: shizuku

项目描述 :
A cpp template class for matrix | C++矩阵模板类
高级语言: C++
项目地址: git://github.com/shizuku/matrix.git
创建时间: 2019-11-16T05:32:56Z
项目社区:https://github.com/shizuku/matrix

开源协议:Apache License 2.0

下载


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

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