📄 banded_matmat.cc
字号:
#include <iostream>using namespace std;#include <mtl/mtl.h>#include <mtl/matrix.h>#include <mtl/dense1D.h>#include <mtl/utils.h>intmain(){ typedef mtl::matrix<double, mtl::diagonal<>, mtl::banded<mtl::external>, mtl::column_major>::type DiagMatE; typedef mtl::matrix<double, mtl::rectangle<>, mtl::dense<mtl::external>, mtl::column_major>::type MatrixE; typedef mtl::matrix<double, mtl::rectangle<>, mtl::dense<mtl::internal>, mtl::column_major>::type MatrixI; int N = 3; double da [] = { 1, 3, 2, 2, 1, 2, 2, 2, 1 }; double dc [] = { 1, 3, 2}; MatrixE A(da, N, N); DiagMatE C(dc, N, N, 0, 0); MatrixI AxC(N,N); cout << "Full A:" << endl; mtl::print_all_matrix(A); cout << "Diag C:" << endl; mtl::print_all_banded(C,0,0); cout << "Output AxC:" << endl; //put C as the first parameter in mult //since C is a banded matrix mtl::mult(C,A,AxC); mtl::print_all_matrix(AxC); return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -