|
|
 |
 |
 |
 |
Scheme Programming Language
|
 |
 |
 |
 |
 |
 |
 |
 |
reshaping arrays, etc
Hi, Some tensor (or multivariate array) computations are very easy to organize by "reshaping" arrays. [1] Eg if one has a 2 x 3 x 4 x 5 array (stored in colum-major format), it can be reshaped into a 6 x 20 matrix (the underlying elements remain the same, only the mapping from the indices to the flat vector changes. Then one can multiply this matrix by another one, reshape the array again, etc. Transpose/ reshape combinations are also powerful. I would like to find out if Scheme would allow me to do this (I don't mind if it is specific to a particular implementation). I have already seen that some scheme compilers (eg Chicken) have BLAS/LAPACK bindings, so the matrix part is not a problem. I would like to know if "boxed" arrays (say, of doubles) stored in column-major format are available in Scheme, and whether those arrays can be reshaped (as outlined above) with little cost (no problem if that happens destructively). Thanks, Tamas [1] For example, I use this one a lot: Paul E. Buis and Wayne R. Dyksen. Efficient Vector and Parallel Manipulation of Tensor Products. ACM Transactions on Mathematical Software, Vol. 22, No. 1, March 1996, Pages 18--23.
In article <1176093205.826454.39@l77g2000hsb.googlegroups.com>,
"Tamas" <tkp @gmail.com> wrote: > Hi, > Some tensor (or multivariate array) computations are very easy to > organize by "reshaping" arrays. [1] Eg if one has a 2 x 3 x 4 x 5 > array (stored in colum-major format), it can be reshaped into a 6 x 20 > matrix (the underlying elements remain the same, only the mapping from > the indices to the flat vector changes. Then one can multiply this > matrix by another one, reshape the array again, etc. Transpose/ > reshape combinations are also powerful. > I would like to find out if Scheme would allow me to do this (I don't > mind if it is specific to a particular implementation). I have > already seen that some scheme compilers (eg Chicken) have BLAS/LAPACK > bindings, so the matrix part is not a problem. I would like to know > if "boxed" arrays (say, of doubles) stored in column-major format are > available in Scheme, and whether those arrays can be reshaped (as > outlined above) with little cost (no problem if that happens > destructively).
The array-lib egg for Chicken is row-major. However, it can perform the re-shape operation you want - in row-major. I wrote array-lib & column-major support is low on my list at the moment. Since many Scheme impls get their array type from SLIB or SRFI-25/47/63 I suspect they are all row-major. CommonLISP is also row-major. SRFI-4 has vectors of doubles - f64vector - which can be used with the Chicken BLAS egg. But manipulation of a column-major array type - I doubt you will find one.
> Thanks, > Tamas > [1] For example, I use this one a lot: > Paul E. Buis and Wayne R. Dyksen. Efficient Vector and Parallel > Manipulation of Tensor Products. ACM Transactions on Mathematical > Software, Vol. 22, No. 1, March 1996, Pages 18--23.
|
 |
 |
 |
 |
|