Learn R Programming

strucchangeRcpp (version 1.5-3-1.0.4)

root.matrix.crossprod: Root of X^TX

Description

Computes the root of the Gramian X^TX.

Usage

root.matrix.crossprod(X)

Value

a symmetric matrix V where V^2 equals X^TX

Arguments

X

a matrix

Examples

Run this code
set.seed(1)
n <- 100
p <- 3
X <- matrix(rnorm(n*p),nrow=n, ncol=p)
test <- root.matrix.crossprod(X)
## control results
t(X) %*% X
test %*% test

Run the code above in your browser using DataLab