Algorithm for an elimination matrix

조회 수: 10 (최근 30일)
Luciano Campos
Luciano Campos 2016년 3월 18일
댓글: Luciano Campos 2016년 3월 18일
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,

채택된 답변

James Tursa
James Tursa 2016년 3월 18일
편집: James Tursa 2016년 3월 18일
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
Luciano Campos
Luciano Campos 2016년 3월 18일
Thanks James! It works perfectly!
really appreciate your help.
best,

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by