Closed afossa closed 2 years ago
It is LAPACK convention that the only UPLO parts contains the factorization and the other half is untouched.
Thank you for the answer. And there exist any way (excluding loops over matrix elements) to achieve one of the followings in smile?
I tried different combinations of UPLO
and Matrix.mm()
, Matrix.mv()
and Matrix.mt()
so far, but without success.
Thank you for your advice,
I checked out BLAS documentation, and what I am looking for is trmv()
to perform matrix-vector multiplication when the matrix is considered triangular and only one UPLO part is considered during computation.
However, for Matrix
objects, even if declared triangular (uplo
and diag
not null
), trmv()
is used only in one specific case, namely Matrix.mv(Transpose trans, double alpha, double[] x, double beta, double[] y)
with alpha
equal to 1, beta
equal to 0 and x == y
(lines 1479-1493
in Matrix.java
).
Is there any specific reason behind this choice? I would expect trmv()
being called with any alpha
, beta
and x != y
, so as to correctly perform multiplications with triangular matrices.
I thought about calling BLAS.engine.trmv(...)
directly in my code, but this is not convenient because there is no direct public access to the matrix storage A
.
Thanks!
It is the only use case that trmv supports.
The matrix-matrix product and matrix-vector product with triangular matrix obtained via Cholesky decomposition does not return the expected result due to the upper triangular part not being set equal to zero.
Considering a positive definite square matrix A and its Cholesky decomposition
A = S*S'
, I expect the following snippet to returnA2
equal toA
:But in fact what I get back is a different matrix, presumably due to the fact that the upper triangular part of
S
is not zero. The same unexpected behaviour happens with matrix-vector multiplication:does not return the expected value for
y
.Up to now, I came out with the solution of manually setting equal to zero all coefficients in the upper triangular part of
S
, so that ifA
is 3x3 the following works:and
A3
is equal toA
. Of course, this is not convenient, and I wonder if I am misunderstanding the usage ofUPLO
or if it is a bug in the implementation.Thank you!