1.程序源码
#include <iostream>
#include <ginac/ginac.h>
using namespace std;
using namespace GiNaC;
int main()
{
matrix A = matrix(2,2,lst(1,2,3,4));
//输出矩阵元素
cout << A[3] << endl;
//修改矩阵元素
A[3] = 5;
cout << A << endl;
return 0;
}
2.编译源码
$ g++ -o example example.c -lginac -lcln -I/usr/local/include -L/usr/local/lib64
3.运行结果
./example
4
[[1,2],[3,5]]
网友评论