vecvecindex {lazy.mat}R Documentation

Returns the index to convert vec(Mat) to vec(t(Mat)) and vice versa.

Description

Returns the index to convert vec(Mat) to vec(t(Mat)) and vice versa.

Usage

vecvecindex(nr, nc = nr)

Arguments

nr

# of rows

nc

# of columns

Details

Let A be nr x nc.
To create vec(t(A)) from vec(A), use
index=vecvecindex( nr,nc ) # same order as A matrix
vec(t(A)) == vec(A)[index]

To create vec(A) from vec(t(A)), use
index=vecvecindex( nc,nr ) # reverse order
vec(A) == vec(t(A))[index]



Can be used with character matrix.

Commutation matrix can be created by this index. See lazy.mat::Kmat function.

Value

vector of index

Examples

A <- demomat(3,2)
vecA <- vec(A); vectA <- vec(t(A))
i1 <- vecvecindex(3,2)
vectA-vecA[i1]
i2 <- vecvecindex(2,3)
vecA-vectA[i2]


[Package lazy.mat version 0.1.4 Index]