Hello,
thanks, good comments!
On 09/27/2009 07:34 PM, James Bergstra wrote:
Firstly, the ndarray untyped. The data is in a void * pointer or a
char * pointer or something, and there is an extra enum-valued field
that indicates what sort of elements make up the data. For example, 0
might mean int8, 1 might mean uint8, 2 might mean int32, 10 might mean
float32, 11 float64, 12 complex64, and so on. There is support for
This implies that GSL should support other elementary types than double.
What do people think about this?
I rather like the notion. Maybe we can't provide all GSL functionality
to all those data types, but it would certainly be nice to have this
option on the background, even if double precision would be the only one
fully supported.
Secondly, there is no notion of a 'layout' in the ndarray, so I wonder
if it is necessary here? When you explicitly store the strides for
traversing the tensor in each dimension... what is left for the
'layout' to specify?
The fact whether e.g. matrix data is stored in row or column major
format. For example, if m is 2*2 matrix stored in d, and if d[0] is the
(1,1) cell in matrix, then d[1] might be (2,1) (=column rajor storage, I
think) or (1,2) (=row major storage), depending on your programming
language/library.
Thirdly, the dimensions are logical things, not physical ones. So
perhaps they belong in the view rather than the base block? I think
the simple { size_t n_allocated; char * buf } structure is sufficient
for the base block.
I was thinking that the actual dimensions would be stored in the block,
and the view would define an allowed subspace. For example, a view for a
matrix could be a matrix or a vector. So, the geometry of block level
would be frozen, and the views would provide alternative ways to access
the data in it in different geometries. Is this too restrictive?
The biggest advantage of moving the dimensions from the base_block to
the view that it allows in-place reshaping and transposing of views,
which would be awkward otherwise.
I did not get this, could you please give an example? If there is a
problem, then dimensions can go to the view as you suggest.
--
[email protected]
http://iki.fi/tuomo.keskitalo