Thank you guys so much~~~~
  Regards~

2009/3/11 Simon Wood <s.w...@bath.ac.uk>

>
> A <- matrix(runif(25),5,5); A <- A%*%t(A) ## Example +ve def matrix
>
> U <- chol(A)   ## start from factor given by chol
> D <- diag(U)   ## extract sqrt(D)
> L <- t(U/D)     ## get unit lower triangular factor
> D <- diag(D^2)  ## and diagonal
> ## So now A = LDL'
> range(A-L%*%D%*%t(L))
>
> #best,
> #Simon
>
>
> On Tuesday 10 March 2009 21:33, Manli Yan wrote:
> >   Hi everyone:
> >   I try to use r to do the Cholesky Decomposition,which is A=LDL',so far
> I
> > only found how to decomposite A in to  LL' by using chol(A),the function
> > Cholesky(A) doesnt work,any one know other command to decomposte A in to
> > LDL'
> >
> >   My r code is:
> > library(Matrix)
> > A=matrix(c(1,1,1,1,5,5,1,5,14),nrow=3)
> >
> > > chol(A)
> >
> >      [,1] [,2] [,3]
> > [1,]    1    1    1
> > [2,]    0    2    2
> > [3,]    0    0    3
> >
> > > Cholesky(A)
> >
> > Error in function (classes, fdef, mtable)  :
> >   unable to find an inherited method for function "Cholesky", for
> signature
> > "matrix"
> >
> > whatz wrong???
> > thanks~
> >
> >       [[alternative HTML version deleted]]
>  >
> > ______________________________________________
> > R-help@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> > http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>and
> >  provide commented, minimal,
> > self-contained, reproducible code.
>
> --
> > Simon Wood, Mathematical Sciences, University of Bath, Bath, BA2 7AY UK
> > +44 1225 386603  www.maths.bath.ac.uk/~sw283
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to