You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 261 Reporter: administrator Status: closed Resolution: fixed Priority: normal Severity: minor Category: ~DO NOT USE (was: OCaml general)
Bug description
Hello,
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
this to:
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,
of course).
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.
Original bug ID: 261
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
Hello,
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
this to:
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,
of course).
Best regards,
Markus Mottl
--
Markus Mottl, mottl@miss.wu-wien.ac.at, http://miss.wu-wien.ac.at/~mottl
The text was updated successfully, but these errors were encountered: