normalize_config {lazy.tools}R Documentation

Normalize Configuration Matrix

Description

This function normalizes the input matrix.

Usage

normalize_config(F, center = 1, rotate = 0, A = NULL)

Arguments

F

n x ndim matrix to be normalized

A

nvar x ndim additional matrix to be normalized

center=0

not to column center F

rotate=1

to rotate F so that F'F = diagonal.

Details

When center==1, F will be column centered.
If rotate==1, F will be rotated so that t(F)%*%F=diagonal.
When A is present, and rotate==1

 t(F)%*%F = nrow(F)*I  and  t(A)%*%A = diagonal

Note that, given F and A, the above normalization with center=0 does not change the value of F %*%t(A).

Value

Normalized F or a list consisting of F and A.

Examples


n=10; nvar=5; ndim=3
set.seed(1701)
F=matrix(rnorm(n*ndim),n,ndim)
A=matrix(runif(nvar*ndim),n,ndim)
FA=F%*%t(A)
meanF=colMeans(F)
Print(F,A,meanF)

F1=normalize_config( F )
temp=mandd(F1)
Print(round(t(F1)%*%F1,4), colMeans(F1))

F11=normalize_config( F, rotate=1 )
temp=mandd(F11)
Print(round(t(F11)%*%F11,4), colMeans(F11))

F2=normalize_config( F, center=0, rotate=1 )
Print(round(t(F2)%*%F2,4), colMeans(F2))

temp=normalize_config( F, center=1, rotate=1, A=A )
F3=temp$F; A3=temp$A
Print(round(t(F3)%*%F3,4), colMeans(F3))
Print(round(t(A3)%*%A3,4), max(abs(FA-F3%*%t(A3))))

temp=normalize_config( F, center=0, rotate=1, A=A )
F4=temp$F; A4=temp$A
Print(round(t(F4)%*%F4,4), colMeans(F4))
Print(round(t(A4)%*%A4,4), max(abs(FA-F4%*%t(A4))))



[Package lazy.tools version 0.1.6 ]