Learn R Programming

cpgen (version 0.1)

ccross: 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

Run this code

# Computing the matrix-square-root of a positive definite square matrix:
## Not run: 
# # generate random data
# rand_data(500,5000)
# 
# W <- ccross(M)
# 
# # this is the implementation of the matrix power-operator '%**%'
# W_sqrt <- with(eigen(W), ccross(vectors,values**0.5))
# ## End(Not run)

Run the code above in your browser using DataLab