image thumbnail

Linear Independent Rows and Columns Generator

version 20.12.2 (5.69 KB) by Gabriel Ponte
Algorithm that finds linear independent rows and columns of a matrix A. It can be found a nonsingular submatrix of A.

16 Downloads

Updated 30 Nov 2020

From GitHub

View license on GitHub

nsub nonsingular submatrix

Assuming that A is an m-by-n matrix and rank(A)>=r, [R] = nsub(A,r) returns a vector R with r elements in the range (1:m), such that the rows of A(R,:) are linear independent.

[R,C] = nsub(A,r) returns a vector R with r elements in the range (1:m) and a vector C with r elements in the range (1:n), such that A(R,C) is a nonsingular submatrix of A.

Note: If r>rank(A) nsub returns an error message.

%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Example:
%
% r = 3;
% A = [-1 -1 1 1 -5; -1 -1 1 0 -5; 0 0 0 1 0; 2 1 1 1 1];
%
% Note: row3 = row1 - row2
%
% [R,C] = nsub(A,r);
%
% Result:
% R = [2 4 1];
% C = [5 1 4];
% A(R,C) = [-5 1 0; 1 2 1; -5 -1 1];
% rank(A(R,C)) = 3;

Cite As

Gabriel Ponte (2021). Linear Independent Rows and Columns Generator (https://github.com/GabrielPonte/nsub/releases/tag/20.12.2), GitHub. Retrieved .

Marcia Fampa, Jon Lee, Gabriel Ponte, and Luze Xu. Experimental analysis of local search for sparse reflexive generalized inverses. https://https://arxiv.org/abs/2001.03732v1, 2019.

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

Community Treasure Hunt

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

Start Hunting!
To view or report issues in this GitHub add-on, visit the GitHub Repository.
To view or report issues in this GitHub add-on, visit the GitHub Repository.