📄 vector_and_matrix.cpp
字号:
#include <itpp/itbase.h>using namespace itpp;//These lines are needed for use of cout and endlusing std::cout;using std::endl;int main(){ //Declare vectors and matricies: vec a, b, c; mat A, B; //Use the function linspace to define a vector: a = linspace(1.0,2.0,10); //Use a string of values to define a vector: b = "0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0"; //Add two vectors: c = a + b; //Print results: cout << "a = " << a << endl; cout << "b = " << b << endl; cout << "c = " << c << endl; //Use a string to define a matrix: A = "1.0 2.0;3.0 4.0"; //Calculate the inverse of matrix A: B = inv(A); //Print results: cout << "A = " << A << endl; cout << "B = " << B << endl; //Exit program: return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -