Vector allocation in a symmetric matrix {Rfast}R Documentation

Vector allocation in a symmetric matrix

Description

Vector allocation in a symmetric matrix.

Usage

squareform(x)

Arguments

x

An numverical vector whose size must be the one that matches the dimensions of the final matrix. See examples.

Details

The functions is written in C++ in order to be as fast as possible.

Value

A symmetric matrix. The vector is allocated in the upper and in the lower part of the matrix. The diagonal is filled with zeros.

Author(s)

R implementation and documentation: Manos Papadakis <papadakm95@gmail.com>.

See Also

colShuffle, colVars, colmeans

Examples

x <- rnorm(1)
res<-squareform(x)  ## OK
x <- rnorm(3)
res<-squareform(x)  ## OK
x <- rnorm(4)
res<-squareform(x)  ## not OK

[Package Rfast version 2.1.0 Index]