CategoryVector2D
NxMテーブルは(N-1)x(M-1)自由度。NxMテーブルを(N-1)x(M-1)次元空間上の点に対応付ける
N<-5
M<-4
CategoryVector2D(N,M)
CategoryVector2D2<-function(N = 3, M = 4){
cvN <- CategoryVector(N)
cvM <- CategoryVector(M)
m <- matrix(0, N * M, (N - 1) * (M - 1))
counter<-1
for(i in 1:N){
for(j in 1:M){
m[counter,]<-c(t((cvN[i,])%*%t(cvM[j,])))
counter<-counter+1
}
}
m
}
\name{CategoryVector2D}
\alias{CategoryVector2D}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{
CategoryVector2D
}
\description{
N+1個の頂点を持つN単体はN次元空間におさまる。その頂点座標を出す関数
}
\usage{
N<-5
M<-4
CategoryVector2D(N,M)
}
%- maybe also 'usage' for other objects documented here.
\details{
%% ~~ If necessary, more details than the description above ~~
}
\value{
ncx(nc-1)行列
}
\references{
%% ~put references to the literature/web site here ~
}
\author{
%% ~~who you are~~
}
\note{
%% ~~further notes~~
}
%% ~Make other sections like Warning with \section{Warning }{....} ~
\seealso{
}
\examples{
N<-5
M<-4
CategoryVector2D(N,M)
CategoryVector2D.old<-
function (N = 3, M = 4)
{
cvN <- CategoryVector(N)
cvM <- CategoryVector(M)
m <- matrix(0, N * M, (N - 1) * (M - 1))
counter1 <- 1
counter2 <- 1
for (i in 1:N) {
for (j in 1:M) {
counter2 <- 1
for (k in 1:(N - 1)) {
for (l in 1:(M - 1)) {
m[counter1, counter2] <- cvN[i, k] * cvM[j,
l]
counter2 <- counter2 + 1
}
}
counter1 <- counter1 + 1
}
}
m
}
N<-4
M<-5
cc<-CategoryVector2D(N,M)
cc2<-CategoryVector2D.old(N,M)
cc-cc2