getLinearIndependen​t(A,ignore_constant​_shift)

Identifies groups of linearly independent columns in a matrix A
316 Downloads
Aktualisiert 24. Aug 2017

Lizenz anzeigen

[Abasis, Abasisi, Asub]= getLinearIndependent(A,ignore_constant_shift)

Purpose: Takes in a matrix of column vectors and identifies
the subset of columns that forms a linear independent basis (Abasis).

It also clusters columns in the original matrix into groups of those that
share linear dependence (Asub). (e.g. If col2 = 2*col1, then col1 and
col2 would be grouped together).

Usage:
[Abasis, Abasisi, Asub]= getLinearIndependent(A)
[Abasis, Abasisi, Asub]= getLinearIndependent(A,ignore_constant_shift)

Inputs:
A: Input matrix of numerics

Inputs (Optional):
ignore_constant_shift: Flag (true/false [default]) for ignoring constant term
in determining independence (e.g. if col2 = 10-col1, col1 and col2 will
be grouped together if true; otherwise separately if false).

Outputs:
Abasis: The subset of linearly independent vectors in A that form a
basis of A.

Abasisi: Index locations of original basis vectors in A, such
that Abasis = A(:,Abasisi).

Asub: Cell array with one element for each basis vector in A. Each cell
in Asub identifies clusters of columns in the original matrix A that
share linear dependence.

Examples:

% -----------------------
% % % % Example 1: % % %
% -----------------------

A = [1, 9, 2, 3, 2; 2, 8, 2, 3, 4; 3, 7, 3, 4 6; 4, 6, 4, 5, 8 ; 5, 5, 5, 6, 10];

% A =
% 1 9 2 3 2
% 2 8 2 3 4
% 3 7 3 4 6
% 4 6 4 5 8
% 5 5 5 6 10
%
% Note that: col2 = 10 - col1
% col4 = col3 + 1
% col5 = col1*2

[Abasis, Abasisi, Asub]= getLinearIndependent(A, true)

% -----------------------
% % % % Result 1: % % %
% -----------------------
% Abasis = % Subset of basis vectors
% 1 2
% 2 2
% 3 3
% 4 4
% 5 5
% Abasisi = % Indices of basis vectors
% 1 3
% Asub =
% 1x2 cell array
% [1x3 double] [1x2 double]
% Asub{1} : [1, 2, 5] % Subset of columns described by 1st basis vector
% Asub{2} : [3, 4] % Subset of columns described by 2nd basis vector
%
% -----------------------
% % % % Example 2: % % %
% -----------------------

A2 = [ [2,2,2,2,2]', A]

% A2 =
% 2 1 9 2 3 2
% 2 2 8 2 3 4
% 2 3 7 3 4 6
% 2 4 6 4 5 8
% 2 5 5 5 6 10
%

[Abasis, Abasisi, Asub]= getLinearIndependent(A2, false)

% -----------------------
% % % % Result 2: % % %
% -----------------------
% Abasis =
% 1 2 2
% 2 2 2
% 3 3 2
% 4 4 2
% 5 5 2
% Abasisi =
% 1 2 4
% Asub =
% 1x3 cell array
% [1x3 double] [1x2 double] [4]
% Asub{1} : [1, 3, 5]
% Asub{2} : [2, 6]
% Asub{3} : [4]

Author: David Stanley, Boston University, 2017

See also: getLinearIndependentCell, rref

Zitieren als

Dave Stanley (2024). getLinearIndependent(A,ignore_constant_shift) (https://www.mathworks.com/matlabcentral/fileexchange/64221-getlinearindependent-a-ignore_constant_shift), MATLAB Central File Exchange. Abgerufen.

Kompatibilität der MATLAB-Version
Erstellt mit R2013a
Kompatibel mit allen Versionen
Plattform-Kompatibilität
Windows macOS Linux
Kategorien
Mehr zu Linear Algebra finden Sie in Help Center und MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Veröffentlicht Versionshinweise
1.4.0.0

Updated file description again due to spacing issues

1.3.0.0

Updated file, description

1.2.0.0

Updated description again

1.1.0.0

Fixed documentation spacing

1.0.0.0