The Matrix to end all Matrix classes (Let's dream!)
Bill Baxter
dnewsgroup at billbaxter.com
Tue Nov 20 16:55:40 PST 2007
0ffh wrote:
>
> Hi, regarding the organisation of matrices maybe it'd pay to take a look
> at how Lush is doing them, as it's designed (and known) to do them quite
> well.
> I'll quote from the Lush tutorial:
>
> Matrices are really composed of two separate entities:
>
> * the storage or srg which contains the following fields: a pointer to the
> actual data , an element type identifier (and the size thereof) , and flags
> that indicate if the data is writable or not , if it is in RAM or
> memory-mapped from a file.
>
> * the index or idx points to a srg and contains the following fields:
> the number of dimensions of the tensor , the size in each dimension ,
> the address increment from one element to the next in each dimension
> (called modulo ) , and the offset of the first tensor element in the
> storage . This structure allows multiple idx to point to the same srg
> thereby allowing the data to be accessed in multiple ways without copying.
>
That sounds like the way NumPy in python does it too. And maybe Blitz++
as well?
--bb
More information about the Digitalmars-d
mailing list