File Exchange

image thumbnail

spok: checks if a MATLAB sparse matrix is OK

version 1.1 (6.59 KB) by Tim Davis
Useful for mexFunction authors only

0 Downloads

Updated 20 Nov 2014

View License

This function is very helpful for authors of mexFunctions that return sparse matrices to MATLAB. It is of no use at all to those who work purely with M-files (if you do not write C mexFunctions, please don't bother downloading or rating this file).
A MATLAB sparse matrix is stored in a compressed-column form that can be difficult to generate in a C or Fortran mexFunction. This function, spok, will determine if your matrix is valid. You can also call the C spok function from inside your mexFunction.

Cite As

Tim Davis (2019). spok: checks if a MATLAB sparse matrix is OK (https://www.mathworks.com/matlabcentral/fileexchange/20186-spok-checks-if-a-matlab-sparse-matrix-is-ok), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (3)

Very good work. This helped me solve a problem in my own code that I would not have found without it.

Thank you so much!

Great work. The option '-largeArrayDims' can be added to the mex commands in spok_install.m and spok_test.m to avoid errors such as 'LINK : fatal error LNK1181: cannot open input file "kernel32.lib"' and 'Function "mxGetJc_700" is obsolete.
(64-bit mex files using sparse matrices must be rebuilt with the "-largeArrayDims" option. See the
R2006b release notes for more details.).'

Qun HAN

Great work. But the submmited file is in c. I want to know if a MATLAB sparse matrix is passed into a FORTRAN mex file how to indexing it?

Updates

1.1

Converted to a toolbox. Updated so that it works in a 64-bit MATLAB.

1.0.0.0

Removed POSIX standard function "snprintf" which Microsoft doesn't comprehend. Should now work on Windows.

MATLAB Release Compatibility
Created with R2008a
Compatible with any release
Platform Compatibility
Windows macOS Linux