Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

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)

Example:
; 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)

Result:
Content of object v
[1,]        2
[2,]        3
[3,]        7
[4,]        1
[5,]        8
[6,]        5



Author: L. Cizkova, P. Cizek, 20030124 license MD*Tech
(C) MD*TECH Method and Data Technologies, 05.02.2006