Filter löschen
Filter löschen

Algorithm for an elimination matrix

7 Ansichten (letzte 30 Tage)
Luciano Campos
Luciano Campos am 18 Mär. 2016
Kommentiert: Luciano Campos am 18 Mär. 2016
Hi everybody, Can anybody help me to design a Matlab code function that creates an elimination matrix L of size (.5m(m+1),m^2) such that, for a (m,m) square matrix A:
vech(A)=L vec(A)
where the vech and vec operators are such that, for example, if:
Thanks for your help,
best,

Akzeptierte Antwort

James Tursa
James Tursa am 18 Mär. 2016
Bearbeitet: James Tursa am 18 Mär. 2016
m = size(A,1); % Size of A
T = tril(ones(m)); % Lower triangle of 1's
f = find(T(:)); % Get linear indexes of 1's
k = m*(m+1)/2; % Row size of L
m2 = m*m; % Colunm size of L
L = zeros(m2,k); % Start with L'
x = f + m2*(0:k-1)'; % Linear indexes of the 1's within L'
L(x) = 1; % Put the 1's in place
L = L'; % Now transpose to actual L
  1 Kommentar
Luciano Campos
Luciano Campos am 18 Mär. 2016
Thanks James! It works perfectly!
really appreciate your help.
best,

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by