Sphere2Simplex
無限大の半径を持つ空間を単位正単体に縮める
Sphere2Simplex(c(1,2,3))
minind<-function(x){
which(x==min(x))[1]
}
minindval<-function(x){
list(ind=minind(x),v=min(x))
}
Sphere2Simplex<-function(x){
if(!is.matrix(x)){
x<-matrix(x,nr=1)
}
n<-length(x[1,])
cv<-CategoryVector(n+1)
X<-x%*%t(cv)
MinIndVal<-matrix(unlist(apply(X,1,minindval)),ncol=2,byrow=TRUE)
r<-sqrt(apply(x^2,1,sum))
tmpr<-TangentDist(r,1)
tmpRatio<-tmpr/(1/(n))
tmpk<-1+tmpRatio
ratio<-(tmpr^2/apply(abs(x)^tmpk,1,sum))^(1/tmpk)
x*ratio
}
\name{Sphere2Simplex}
\alias{Sphere2Simplex}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{
Sphere2Simplex
}
\description{
Spherical space is transformed to a unit simplex
無限球座標を単位正単体に縮める
}
\usage{
Sphere2Simplex(c(1,2,3))
}
%- maybe also 'usage' for other objects documented here.
\details{
%% ~~ If necessary, more details than the description above ~~
}
\value{
transformed coordinate
}
\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{
CategoryVector,TangentDist
}
\examples{
xs<-matrix(0,100,3)
xs[1,]<-c(0,0,1)
for(i in 2:100){
xs[i,]<-xs[i-1,]*1.1
}
xsc<-Sphere2Simplex(xs)
plot(xsc[,1])
}
% Add one or more standard keywords, see file 'KEYWORDS' in the
% R documentation directory.
\keyword{ ~kwd1 }
\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line