yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #03636
Re: Matrix3
Hi Jan,
I fixed that in r2389, thanks for pointing it out:
Yade [1]: a,b=Matrix3.Zero,Matrix3.Zero
Yade [2]: a[1,1]=11
Yade [3]: a,b
-> [3]: (Matrix3(0,0,0, 0,11,0, 0,0,0), Matrix3(0,0,0, 0,0,0, 0,0,0))
Note: the first line is NOT the same as "a=b=Matrix3.Zero", which really
does something like a=Matrix3.Zero;b=a (or vice versa? ;-) not sure).
Python then makes a only a reference to b.
> One possibility I found is not to use .Zero function:
>
> Yade [1]: a = Matrix3()
> Yade [2]: a
> -> [2]: Matrix3(-1.49871e-63,-1.49737e-63,-1.49856e-63, -1.49841e-63,-1.49871e-63,-1.49852e-63, -1.49826e-63,-1.49826e-63,-1.49826e-63)
> Yade [3]:
> Yade [4]: for i in range(3):
> ...: for j in range(3):
> ...: a[i,j] = 0.
a=Matrix3(0,0,0,0,0,0,0,0,0) would be shorter.
Cheers, Václav
References
-
Matrix3
From: Honza Stránský, 2010-07-27