mexSparseLogical0Di​ag

Version 1.0.0.0 (2.01 KB) by Guy
Change all the elements on the main diagonal of a logical sparse matrix to 0.
301 Downloads
Updated 27 Aug 2009

View License

Because of memory constraints, it is often impossible to change by subscript all the elements of a large sparse matrix to zero. This leads to changing the elements in a loop, which is horrendously slow.
This mex solves that problem.
Usage: B = mexSparseLogical0Diag(A).

This problem is very common when dealing with adjacency matrices used in clustering - an adjacency matrix is a logical matrix, where the main diagonal is all zeros (no element is a neighbour of itself).

Cite As

Guy (2024). mexSparseLogical0Diag (https://www.mathworks.com/matlabcentral/fileexchange/25147-mexsparselogical0diag), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2009a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Sparse Matrices in Help Center and MATLAB Answers
Tags Add Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0.0