ccross: ccross

View source: R/ctools.R

ccrossR Documentation

ccross

Description

Computation of the following matrix-product: \mathbf{XDX}' Where \mathbf{D} is a diagonal matrix, which is being passed to the function as a vector.

Usage

ccross(X,D=NULL)	

Arguments

X

matrix

D

numeric vector, will be used as a weighting diagonal matrix of dimension ncol(X). If omitted an identity matrix will be assigned.

Value

Square matrix of dimension nrow(X)

Examples


# Computing the matrix-square-root of a positive definite square matrix:
# generate random data
rand_data(100,500)

W <- ccross(M)

# this is the implementation of the matrix power-operator '%**%'
W_sqrt <- with(eigen(W), ccross(vectors,values**0.5))

cheuerde/cpgen documentation built on July 27, 2023, 11:34 a.m.