Library: | xclust |
See also: | vec2mat distance lpdist agglom cor2dist |
Quantlet: | mat2vec | |
Description: | stores the upper triangle of a symmetric matrix into a vector regarding the sequence described in agglom |
Usage: | v = mat2vec(d) | |
Input: | ||
d | n x n matrix (for example a correlation matrix or a distance matrix) | |
Output: | ||
v | n(n-1)/2 x 1 vector containing the values of the upper triangle of d (for instance, the vector v can be used as the input parameter of the function "agglom" if d contains distances) |
; load the library xclust library("xclust") ; generate a symmetric matrix d = #(0, 2, 3, 7)~#(2, 0, 1, 8)~#(3, 1, 0, 5)~#(7, 8, 5, 0) ; extract upper triangle mat2vec(d)
Content of object v [1,] 2 [2,] 3 [3,] 7 [4,] 1 [5,] 8 [6,] 5