Function Repository Resource:

# RandomSparseSPDMatrix

Create a random sparse symmetric positive definite matrix

Contributed by: Jan Mangaldan
 ResourceFunction["RandomSparseSPDMatrix"][n] creates an n×n random sparse symmetric positive definite matrix.

## Details and Options

ResourceFunction["RandomSparseSPDMatrix"] constructs a random matrix from its Cholesky factor in which the diagonal is set to one and all other nonzero entries of the lower triangle are sampled from a uniform distribution with bounds {min,max}.
ResourceFunction["RandomSparseSPDMatrix"] returns a SparseArray object.
The following options can be given:
 "CholeskyFactorDensity" density of the off-diagonal entries of the Cholesky factor “CholeskyFactorRange" {,1} the min and max values of the off-diagonal entries of the Cholesky factor WorkingPrecision MachinePrecision the precision to use in internal computations
The value of "CholeskyFactorDensity" must be between 0 and 1 where 1 represents a dense matrix.

## Examples

### Basic Examples (3)

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]=

### Options (4)

#### CholeskyFactorDensity (1)

Use the option "CholeskyFactorDensity"to construct a dense matrix:

 In[4]:=
 Out[4]=
 In[5]:=
 Out[5]=

#### CholeskyFactorRange (1)

Create a matrix with larger numerical values using the "CholeskyFactorRange" option:

 In[6]:=
 Out[6]=
 In[7]:=
 Out[7]=

#### WorkingPrecision (2)

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]=

## Version History

• 1.0.0 – 28 March 2022