|Anonymous | Login | Signup for a new account||2013-12-10 02:40 CET|
|Main | My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0000261||OCaml||OCaml general||public||2001-01-16 17:00||2001-01-23 10:50|
|Target Version||Fixed in Version|
|Summary||0000261: Feature wish for bigarrays|
since I am currently interfacing LAPACK with bigarrays, I ran into a
problem that could be easily fixed by adding a new function to "Array2":
Linear least-squares problems (or equations) usually look like this:
A * x = b
where A is a matrix and x and b are vectors. LAPACK, however, generalizes
A * X = B
where all variables stand for matrices. This allows one to handle several
right hand side vectors (b) and solution vectors (x) in one call.
This is a bit annoying when somebody really wants to use one vector
(Array1.t) only: he'd have to copy it into a matrix (Array2.t) for this,
which may require a significant amount of time.
It would be great if there were some kind of inverse function for
"slice_right", which makes an Array2.t out of an Array1.t without copying.
(For completeness, you might want to add a similar inverse function for
"slice_left" for C-layout, which operates on rows instead of columns,
Markus Mottl, firstname.lastname@example.org, http://miss.wu-wien.ac.at/~mottl [^]
|Tags||No tags attached.|
> It would be great if there were some kind of inverse function for
> "slice_right", which makes an Array2.t out of an Array1.t without copying.
> (For completeness, you might want to add a similar inverse function for
> "slice_left" for C-layout, which operates on rows instead of columns,
> of course).
Other users have expressed similar needs (e.g. "flattening" an Array2
into an Array1), so I've added a general "reshape" feature to the
Bigarray module. Basically, it lets you view a big array with a new
number of dimensions and new dimensions, the only constraint being
that the new view has the same number of elements as the original
array. So, in your example, you could "reshape" an 1d array of
dimension N into a 2d array of dimensions (N, 1) or (1, N), depending
on the desired layout.
- Xavier Leroy
The new Bigarray.reshape function answers this need. XL, 2001-01-23
|2005-11-18 10:13||administrator||New Issue|
|Copyright © 2000 - 2011 MantisBT Group|