Page 1 of 1

Ewise

Posted: Thu Jan 06, 2011 5:38 am
by user_123
Dear users,

Im not sure about the last part [j-(j>i)] of this code:

ewise a(i,j)=%if(i==j,1.0,ap(i,j-(j>i)))

does this mean the following?:

if the elements of matrix (ap) are= a11 a12
a21 a22
a31 a32

and the elements of the matrix (a) are= b11 b12 b13
b21 b22 b23
b31 b32 b33

the b11=b22=b33=1
and b12= a11, b13=a12, b21=a21, b23=a22, b31=a31, b32=a32

Thank you in advance.

Re: Ewise

Posted: Thu Jan 06, 2011 6:26 am
by TomDoan
Suppose that you have a 3x3 matrix of parameters, but that the diagonal elements are fixed at 1 while the others are free. In effect, you have a 3 x 2 matrix of free parameters which needs to get expanded for use. That's what the EWISE does. From a 3x2 matrix, it creates a 3x3 matrix, inserting the 1's in the diagonal positions. It's probably easier to think about the reverse mapping; the matrix

1 a12 a13
a21 1 a23
a31 a32 1

is parameterized using

a12 a13
a21 a23
a31 a32

Re: Ewise

Posted: Thu Jan 06, 2011 10:13 am
by user_123
Thank you very much Tom!