Created
February 16, 2015 11:59
-
-
Save tiborsimon/ba174f57d62071f26aa1 to your computer and use it in GitHub Desktop.
Access upper triangular matrix elements stored in a single row vector - 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
%First create a small function that | |
function [ l ] = ij2l( i, j, n ) | |
%IJ2L Upper Triangle Matrix Coordinates to Single Row Index | |
l = j; | |
for k=1:(i-1) | |
l = l + (n-k); | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment