Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LDLT decomposition returns diagonal matrix D non-optimally #119

Open
yuvpg opened this issue Sep 20, 2023 · 1 comment
Open

LDLT decomposition returns diagonal matrix D non-optimally #119

yuvpg opened this issue Sep 20, 2023 · 1 comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@yuvpg
Copy link

yuvpg commented Sep 20, 2023

LDL^t decomposition function arm_mat_ldlt_f32 return diagonal matrix D as n×n matrix, but it real application you will probably never need it as a matrix, just n-vector with diagonal values will be sufficient.

For example, when solving system of linear equations with the help of LDLt, in intermediate calculations one should solve equation D.z=y, which is trivial element-by-element vector division z=y/diag(D).

Maybe it is worth considering return D as an vector instead of matrix?

Additionally, the description of permutation vector P in documentation is not complete. It is impossible to understand how to use returned vector pp from documentation. Hopefully in examples there is a piece of python code which describe the intent:

print("LDLT")

def swaprow(m,k,j):
    tmp = np.copy(m[j,:])
    m[j,:] = np.copy(m[k,:])
    m[k,:] = tmp 
    return(m)

# F32 test
status,resl,resd,resperm=dsp.arm_mat_ldlt_f32(a)
n=3
p=np.identity(n)
for k in range(0,n):
    p = swaprow(p,k,resperm[k])

res=resl.dot(resd).dot(resl.T)

permutedSrc=p.dot(a).dot(p.T)
@christophe0606 christophe0606 added documentation Improvements or additions to documentation enhancement New feature or request review Under review labels Sep 20, 2023
@christophe0606
Copy link
Contributor

@yuvpg Thank for good feedback. I'll look at the implementation to understand why D is not returned as vector.

@christophe0606 christophe0606 removed the review Under review label Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants