Created
February 16, 2015 12:00
-
-
Save tiborsimon/8beb75302f86c4962360 to your computer and use it in GitHub Desktop.
Access upper triangular matrix elements stored in a single row vector - testing in MATLAB implementation - http://tibor-simon.com/programming/access-upper-triangular-matrix-elements-stored-in-a-single-row-vector/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% Testing th ij2l function | |
%% Let the upper trinagle matrix be | |
% | |
% | 1 2 3 | | |
% A = | 4 5 | | |
% | 6 | | |
% | |
% We want to index the second row, last element: | |
% | |
% | 1 2 3 | | |
% A = | 4(5)| | |
% | 6 | | |
n = 3; | |
i = 2; | |
j = 3; | |
l = ij2l(i,j,n); | |
v = [1 2 3 4 5 6]; | |
v(l) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment