Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

cholesky decomposition in python

A = np.array([[1,-2j],[2j,5]])
>>> A
array([[ 1.+0.j, -0.-2.j],
       [ 0.+2.j,  5.+0.j]])
>>> L = np.linalg.cholesky(A)
>>> L
array([[1.+0.j, 0.+0.j],
       [0.+2.j, 1.+0.j]])
>>> np.dot(L, L.T.conj()) # verify that L * L.H = A
array([[1.+0.j, 0.-2.j],
       [0.+2.j, 5.+0.j]])
>>> A = [[1,-2j],[2j,5]] # what happens if A is only array_like?
>>> np.linalg.cholesky(A) # an ndarray object is returned
array([[1.+0.j, 0.+0.j],
       [0.+2.j, 1.+0.j]])
>>> # But a matrix object is returned if A is a matrix object
>>> np.linalg.cholesky(np.matrix(A))
matrix([[ 1.+0.j,  0.+0.j],
        [ 0.+2.j,  1.+0.j]])
Comment

PREVIOUS NEXT
Code Example
Python :: python internship 
Python :: python set 
Python :: while not command in python 
Python :: codechef solution 
Python :: turn False to nan pandas 
Python :: python3 call parent constructor 
Python :: how to add zeros in front of numbers in pandas 
Python :: save and load model during training pytorch 
Python :: how to add elements to a dictionary 
Python :: get request in django 
Python :: remove common rows in two dataframes pandas 
Python :: create new dataframe from existing data frame python 
Python :: python random uuid 
Python :: python check if string or list 
Python :: django loginview 
Python :: Python NumPy asarray Function Syntax 
Python :: validate longitude and latitude in python 
Python :: adding two strings together in python 
Python :: python counter 
Python :: python iterate over string 
Python :: python string replace letters with numbers 
Python :: how to replace a string in python 
Python :: how to speed up python code 
Python :: [<matplotlib.lines.Line2D object at 0x7fee51155a90] 
Python :: python destructure object 
Python :: python data type conversion 
Python :: change date format to yyyy mm dd in django template datepicker 
Python :: sklean tfidf 
Python :: how to make code to do something for curtain number of seconds python 
Python :: selenium delete cookies python 
ADD CONTENT
Topic
Content
Source link
Name
5+5 =