Skip to Main Content Skip to Search
Product Documentation

Function Summary

Functions That Support Sparse Matrices

Sparse matrix functions are located in the MATLAB sparfun directory. For a complete list, brief descriptions, and links to reference pages, type:

help sparfun

Sparse matrix functions fall into the following categories:

Elementary Sparse Matrices

Function

Description

speye

Sparse identity matrix

sprand

Sparse uniformly distributed random matrix

sprandn

Sparse normally distributed random matrix

sprandsym

Sparse random symmetric matrix

spdiags

Sparse matrix formed from diagonals

Full to Sparse Conversion

Function

Description

sparse

Create sparse matrix

full

Convert sparse matrix to full matrix

find

Find indices of nonzero elements

spconvert

Import from sparse matrix external format

Working with Sparse Matrices

Function

Description

nnz

Number of nonzero matrix elements

nonzeros

Nonzero matrix elements

nzmax

Amount of storage allocated for nonzero matrix elements

spones

Replace nonzero sparse matrix elements with ones

spalloc

Allocate space for sparse matrix

issparse

True for sparse matrix

spfun

Apply function to nonzero matrix elements

spy

Visualize sparsity pattern

Graph Theory

Function

Description

gplot

Plot graph, as in "graph theory"

etree

Elimination tree

etreeplot

Plot elimination tree

treelayout

Lay out tree or forest

treeplot

Plot picture of tree

Reordering Algorithms

Function

Description

colamd

Column approximate minimum degree permutation

symamd

Symmetric approximate minimum degree permutation

symrcm

Symmetric reverse Cuthill-McKee permutation

colperm

Column permutation

randperm

Random permutation

dmperm

Dulmage-Mendelsohn permutation

Linear Algebra

Function

Description

eigs

A few eigenvalues

svds

A few singular values

ilu

Incomplete LU factorization

ichol

Incomplete Cholesky factorization

normest

Estimate the matrix 2-norm

condest

1-norm condition number estimate

sprank

Structural rank

Linear Equations (Iterative Methods)

Function

Description

bicg

Biconjugate gradients method

bicgstab

Biconjugate gradients stabilized method

bicgstabl

Biconjugate gradients stabilized(l) method

cgs

Conjugate gradients squared method

gmres

Generalized minimum residual method

lsqnonneg

Solve nonnegative least-squares constraints problem

lsqr

LSQR method

minres

Minimum residual method

pcg

Preconditioned conjugate gradients method

qmr

Quasi-minimal residual method

tfqmr

Transpose-free quasi-minimal residual method

symmlq

Symmetric LQ method

Other Miscellaneous Functions

Function

Description

spaugment

Form least squares augmented system

spparms

Set parameters for sparse matrix routines

symbfact

Symbolic factorization analysis

Functions That Do Not Support Sparse Matrices

These built-in functions do not accept sparse matrices as input.

Elementary Matrices and Arrays

Function

Description

rand

Uniformly distributed pseudorandom numbers

Elementary Math Functions

Complex Functions.  

Function

Description

complex

Construct complex data from real and imaginary components

Real Array Exponential Functions.  

Function

Description

reallog

Natural logarithm for nonnegative real arrays

realpow

Array power for real-only output

realsqrt

Square root for nonnegative real arrays

Bit-Wise Functions

Function

Description

bitand

Bitwise AND

bitcmp

Bitwise complement

bitget

Bit at specified position

bitmax

Maximum double-precision floating-point integer

bitor

Bitwise OR

bitset

Set bit at specified position

bitshift

Shift bits specified number of places

bitxor

Bitwise XOR

Eigenvalue and Singular Value Functions

Function

Description

hess

Hessenberg form of matrix

ordeig

Eigenvalues of quasitriangular matrices

ordqz

Reorder eigenvalues in QZ factorization

ordschur

Reorder eigenvalues in Schur factorization

schur

Schur decomposition

svd

Singular value decomposition

Matrix Analysis Functions

Function

Description

cond

Condition number with respect to inversion

null

Null space

orth

Range space of matrix

rcond

Matrix reciprocal condition number estimate

Factorization Functions

Function

Description

cholupdate

Rank 1 update to Cholesky factorization

gsvd

Generalized singular value decomposition

qz

QZ factorization for generalized eigenvalues

Linear Equation Functions

Function

Description

linsolve

Solve linear system of equations

pinv

Moore-Penrose pseudoinverse of matrix

Special Functions

Function

Description

airy

Airy functions

besselh

Bessel function of third kind (Hankel function)

besseli

Modified Bessel function of first kind

besselj

Bessel function of first kind

besselk

Modified Bessel function of second kind

bessely

Bessel function of second kind

erfc

Error function

erf

Error function

erfcx

Error function

gamma

Gamma function

gammaln

Gamma function

psi

Psi (polygamma) function

Filtering and Convolution Functions

Function

Description

conv2

2-D convolution

convn

N-D convolution

filter

1-D digital filter

filter2

2-D digital filter

Fourier Transform Functions

Function

Description

fft

Discrete Fourier transform

fftn

N-D discrete Fourier transform

ifft

Inverse discrete Fourier transform

ifftn

N-D inverse discrete Fourier transform

Histogram Plotting Functions

Function

Description

histc

Histogram count

Functions with Sparse Alternatives

These functions do not accept sparse inputs, but you can use other functions in their place.

Function

Replacement Function Supporting Sparse Inputs

cond

Use condest instead.

eig

Syntax d = eig(S) accepts a sparse symmetric matrix S. Otherwise, use eigs in place of eig.

norm(S,2)

Use normest for the 2-norm of a sparse matrix S.

svd

Use svds instead.

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS