Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Create a random sparse symmetric positive definite matrix
ResourceFunction["RandomSparseSPDMatrix"][n] creates an n×n random sparse symmetric positive definite matrix. |
| "CholeskyFactorDensity" | density of the off-diagonal entries of the Cholesky factor | |
| “CholeskyFactorRange" | { | the min and max values of the off-diagonal entries of the Cholesky factor |
| WorkingPrecision | MachinePrecision | the precision to use in internal computations |
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]= |
Use the option "CholeskyFactorDensity"to construct a dense matrix:
| In[4]:= |
| Out[4]= |
| In[5]:= |
| Out[5]= | ![]() |
Create a matrix with larger numerical values using the "CholeskyFactorRange" option:
| In[6]:= |
| Out[6]= |
| In[7]:= |
| Out[7]= | ![]() |
A random symmetric positive definite matrix with machine-number entries:
| In[8]:= |
| Out[8]= |
| In[9]:= |
| Out[9]= | ![]() |
A random symmetric positive definite matrix with 24-digit precision entries:
| In[10]:= |
| Out[10]= |
| In[11]:= |
| Out[11]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License