12 Jan
2025
12 Jan
'25
10:02 a.m.
Hi! On 11.01.25 10:40, Bastian Abt via GiNaC-list wrote:
1: Am I correct, that if i want to compute the Subtraction of two vectors I should use the indexed variant?
Use evalm().
2: How do I access elements of an expression?
You could use numeric indices: #include <ginac/ginac.h> #include <iostream> int main(int argc, char **argv) { using namespace GiNaC; matrix m0 = matrix({{1, 2, 3}}), m1 = matrix({{6, 5, 4}}); std::cout << (m1 - m0).evalm() << std::endl; // -> [[5,3,1]] idx i1(1, 3); std::cout << indexed((m1 - m0).evalm(), i1) << std::endl; // -> 3 } Bye, Christian -- / Physics is an algorithm \/ www.cebix.net