Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Create a random sparse symmetric positive definite matrix using the Python package ProbNum
ResourceFunction["RandomSparseSPDMatrixProbNum"][n] creates an n⨯n random sparse symmetric positive definite matrix. | |
ResourceFunction["RandomSparseSPDMatrixProbNum"][session,…] uses the specified running ExternalSessionObject. |
"CholeskyFactorDensity" | 0.1 | density of the off-diagonal entries of the Cholesky factor |
“CholeskyFactorRange" | {0.1,1.} | the min and max values of the off-diagonal elements of the Cholesky factor |
RandomSeeding | Automatic | seeding of the pseudorandom generator |
Construct a random symmetric positive definite matrix:
In[1]:= |
Out[1]= |
Show the matrix:
In[2]:= |
Out[2]= |
Verify that the matrix is symmetric and positive definite:
In[3]:= |
Out[3]= |
Construct a matrix:
In[4]:= |
Out[4]= |
Use a the specified Python session:
In[5]:= |
Out[5]= |
In[6]:= |
Out[6]= |
Close the session:
In[7]:= |
Use the option "CholeskyFactorDensity" to construct a dense matrix:
In[8]:= |
Out[8]= |
In[9]:= |
Out[9]= |
Create a matrix with larger numerical values using the "CholeskyFactorRange" option:
In[10]:= |
Out[10]= |
In[11]:= |
Out[11]= |
Ensure reproducibility of the results:
In[12]:= |
Out[12]= |
In[13]:= |
Out[13]= |
In[14]:= |
Out[14]= |
Use the specified random number generator from the Python package numpy for seeding:
In[15]:= |
Out[15]= |
In[16]:= |
Out[16]= |
In[17]:= |
Out[17]= |
In[18]:= |
A random sparse symmetric positive definite matrix can be constructed with the resource function ProbNumObject:
In[19]:= |
Out[19]= |
In[20]:= |
Out[20]= |
In[21]:= |
Out[21]= |
In[22]:= |
Out[22]= |
Construct the same matrix with RandomSparseSPDMatrixProbNum:
In[23]:= |
Out[23]= |
In[24]:= |
Out[24]= |
This work is licensed under a Creative Commons Attribution 4.0 International License