Issue
I'm using Cholesky decomposition for Ax=b
to find x
, by doing L*LT=A
then y=L*b
and in the end x=LT*b
.When I check though I don't seem to get the same results as doing the classic Ax=b
.
Here's my code :
import numpy as np
import scipy.linalg as sla
myL=np.linalg.cholesky(A)
#check_x = np.dot(A, b)
#check_x = np.dot(A,b)
check_x = sla.solve(A, b)
#check if the composition was done right
myLT=myL.T.conj() #transpose matrix
Ac=np.dot(myL,myLT) #should give the original matrix A
#y=np.dot(myL,b)
y = sla.solve_triangular(myL, b)
#x=np.dot(myL.T.conj(),y)
x = sla.solve_triangular(myLT, b)
Solution
I was sleepless and tired , I got the last line wrong it actually is
x=np.linalg.solve(myLT, y)
Answered By - KevinWendellCrumb
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.