Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

squareform

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

Examples

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

Rfast

A Collection of Efficient and Extremely Fast R Functions

v2.0.1
GPL (>= 2.0)
Authors
Manos Papadakis, Michail Tsagris, Marios Dimitriadis, Stefanos Fafalios, Ioannis Tsamardinos, Matteo Fasiolo, Giorgos Borboudakis, John Burkardt, Changliang Zou, Kleanthi Lakiotaki and Christina Chatzipantsiou.
Initial release
2020-09-13

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.