24 Aug 18:20
Re: where is Math.Matrix->`/ ?
From: Mirar @ Pike importmöte för mailinglistan <6341 <at> lyskom.lysator.liu.se>
Subject: Re: where is Math.Matrix->`/ ?
Newsgroups: gmane.comp.lang.pike.user
Date: 2008-08-24 16:20:04 GMT
Subject: Re: where is Math.Matrix->`/ ?
Newsgroups: gmane.comp.lang.pike.user
Date: 2008-08-24 16:20:04 GMT
Something like this, maybe?
Feel free to patch your Pike and test it out. I'm not checking this in
for the current 7.8.
/Mirar
| > Math.Matrix m=Math.Matrix(3,4);
| (2) Result: Math.Matrix( ({ ({ 1, 0, 0}),
| ({ 0, 1, 0}),
| ({ 0, 0, 1}),
| ({ 0, 0, 0}) }) )
| > for (int i=0; i<3; i++) for (int j=0; j<4; j++) m->poke(i,j,i*10+j); m;
| Ok.
| (3) Result: Math.Matrix( ({ ({ 0, 10, 20}),
| ({ 1, 11, 21}),
| ({ 2, 12, 22}),
| ({ 3, 13, 23}) }) )
| > m->peek(1,1);
| (4) Result: 11.0
| > m->peek(2,1);
| (5) Result: 21.0
| > object m=Math.Matrix(({1,2,3,4})/2);
| > object m2=Math.Matrix(m);
| > m2->poke(0,1,17);
| (1) Result: Math.Matrix( ({ ({ 1, 2}),
| ({ 17, 4}) }) )
| > m;
| (2) Result: Math.Matrix( ({ ({ 1, 2}),
(Continue reading)
RSS Feed