FUNCTION REFERENCE

spfun

Apply a function to sparse stored values.

Apply a function to sparse stored values.

Syntax

R = spfun(fun, S)

Calls fun once with a column vector of S's nonzeros. R is sparse with the same pattern, except output zeros are omitted.

Example

full(spfun(@exp, sparse([0 1; -1 0])))

Differences from MATLAB: fun must return a real vector with the same length as the stored values.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.