[GiNaC-list] (no subject) has to be: avoid expansion in matrix operations

Javier Ros Ganuza jros at unavarra.es
Tue Mar 7 19:49:21 CET 2006


Sorry, I fogot the subjet

I found that performing programing the matrix  product myself I get the
desired result (Sum_k A(i,k)*B(k,i)). But is there a more elegant way?

Javier Ros

On Tue, 2006-03-07 at 19:31 +0100, Javier Ros Ganuza wrote:
> Hello! :)
> 
> When performing matrix multiplications expressions get expanded like in
> the following Example.
> 
> Is there a way to avoid expansion, that is to leave the parenthesis
> 
> Thanks
> 
> Javier Ros
> 
> 
> Example:
> -----------------
> matrix aux1
> 
> [[-d331*sin(q3)*dq3-d332*cos(q3)*dq3],[d331*cos(q3)*dq3-d332*sin(q3)*dq3],[0]]
> 
> matrix R23
> 
> [[cos(q3),-sin(q3),0],[sin(q3),cos(q3),0],[0,0,1]]
> 
> matrix R12.mul(aux1)
> 
> [[d332*sin(q2)*sin(q3)*dq3-d331*cos(q2)*sin(q3)*dq3-d332*cos(q3)*cos(q2)*dq3-d331*sin(q2)*cos(q3)*dq3],[-d332*cos(q2)*sin(q3)*dq3-d331*sin(q2)*sin(q3)*dq3+d331*cos(q3)*cos(q2)*dq3-d332*sin(q2)*cos(q3)*dq3],[0]]
> -----------------
> 
> What I want is to obtain something like
> 
> cos(q3)*(-d331*sin(q3)*dq3-d332*cos(q3)*dq3)+.... and so on for the
> first (0,0) matrix element.
> 
> 
> 
> 
> _______________________________________________
> GiNaC-list mailing list
> GiNaC-list at ginac.de
> https://www.cebix.net/mailman/listinfo/ginac-list
> 



More information about the GiNaC-list mailing list