Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Compute the Cholesky decomposition of an array in Python using the NumPy linear algebra package
ResourceFunction["NumPyCholeskyDecomposition"][array] computes the Cholesky decomposition of an array in Python using the package NumPy. | |
ResourceFunction["NumPyCholeskyDecomposition"][array,session] uses the specified running ExternalSessionObject session. |
Compute the Cholesky decomposition of a symmetric positive-definite matrix in NumPy:
| In[1]:= |
|
| In[2]:= |
|
| Out[2]= |
|
| In[3]:= |
|
| Out[3]= |
|
The original matrix:
| In[4]:= |
|
| Out[4]= |
|
In contrast, CholeskyDecomposition always returns an upper-triangular matrix:
| In[5]:= |
|
| Out[5]= |
|
| In[6]:= |
|
| Out[6]= |
|
Compute the Cholesky decomposition of a real-valued matrix:
| In[7]:= |
|
| Out[7]= |
|
| In[8]:= |
|
| Out[8]= |
|
| In[9]:= |
|
| Out[9]= |
|
| In[10]:= |
|
| Out[10]= |
|
Complex matrix:
| In[11]:= |
|
| Out[11]= |
|
| In[12]:= |
|
| Out[12]= |
|
| In[13]:= |
|
| Out[13]= |
|
| In[14]:= |
|
| Out[14]= |
|
Sparse array:
| In[15]:= |
|
| Out[15]= |
|
| In[16]:= |
|
| Out[16]= |
|
| In[17]:= |
|
| Out[17]= |
|
NumericArray object:
| In[18]:= |
|
| Out[18]= |
|
A tensor representing a list of matrices:
| In[19]:= |
|
| Out[19]= |
|
| In[20]:= |
|
| Out[20]= |
|
| In[21]:= |
|
| Out[21]= |
|
Make several calls to NumPyCholeskyDecomposition in the same external session:
| In[22]:= |
|
| Out[22]= |
|
| In[23]:= |
|
| Out[23]= |
|
| In[24]:= |
|
| Out[24]= |
|
End the session:
| In[25]:= |
|
NumPyCholeskyDecomposition returns a Failure object if the input matrix is not positive definite:
| In[26]:= |
|
| Out[26]= |
|
| In[27]:= |
|
| Out[27]= |
|
This work is licensed under a Creative Commons Attribution 4.0 International License