Felip Alàez Nadal | 24 Aug 12:30

Re: where is Math.Matrix->`/ ?



2008/8/17 Mirar <at> Pike importmöte för mailinglistan <6341 <at> lyskom.lysator.liu.se>
It would be great it it was also implemented in Math.Matrix. :p



I'll try to do that. I guess that I must implement all the methods in matrix_code.h. I'll report you any problem I could have.

There's an important issue with Math.Matrix. We should add the possibility to do something like myMatrix[i][j]. Actually you can't access the elements in the matrix, and that's a problem. You can work with the matrix and cast It to an array to use It like a C array, but It's a nonsense that a high-level language like Pike make that more difficult than C. Pike needs that in order to work well with matrices.

--
Felip Alàez Nadal

Re: where is Math.Matrix->`/ ?

It does? I'm not sure when you want to use it.

It should be easy to do with an intermediate object that remembers the
first indexing. Like

 class MatrixRow
 { 
    Matrix thematrix;
    int row;
    float ´[](int column) { thematrix->peek(row,column); }
    float ´[]=(int column,float value) { thematrix->poke(row,column,value); }
 }

 class MatrixColumn
 { 
    Matrix thematrix;
    int column;
    float ´[](int row) { thematrix->peek(row,column); }
    float ´[]=(int row,float value) { thematrix->poke(row,column,value); }
 }

 class Matrix
 {
     IndexedMatrix ´[](int r) { return row(r); }
     IndexedMatrix row(int r) { return MatrixRow(this,r); }
     IndexedMatrix column(int c) { return MatrixColumn(this,c); }
     float peek(int row,int column) { ... }
     float poke(int row,int column,float value) { ... }
 }

or so. Add functionality as you feel.

(But for 7.9, probably.)


Gmane