Rev 5458 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
c-----------------------------------------------------------------------cc R : A Computer Langage for Statistical Data Analysisc Copyright (C) 1996, 1997 Robert Gentleman and Ross Ihakacc This program is free software; you can redistribute it and/or modifyc it under the terms of the GNU General Public License as published byc the Free Software Foundation; either version 2 of the License, orc (at your option) any later version.cc This program is distributed in the hope that it will be useful,c but WITHOUT ANY WARRANTY; without even the implied warranty ofc MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See thec GNU General Public License for more details.cc You should have received a copy of the GNU General Public Licensec along with this program; if not, write to the Free Softwarec Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USAcc-----------------------------------------------------------------------cc ch2inv computes the inverse of a positive-definite symmetricc matrix from its choleski factorization. this can be used (forc example) to compute the dispersion matrix for the estimatedc parameters in a regression analysis.cc on entrycc x double precision(ldx,k)c the choleski decomposition or thec qr decomposition as computed by dqrdcc or dqrdc2cc ldx integerc the leading dimension of the array xcc n integerc the number of rows of the matrix xcc k integerc the number of columns in the matrix kcc on returncc v double precision(k,k)c the value of inverse(x'x)cc This version dated Aug 24, 1996.c Ross Ihaka, University of Auckland.csubroutine ch2inv(x, ldx, n, v, info)double precision x(ldx, n), v(n, n)cdouble precision dinteger i, jcdo 20 i=1,nif(x(i,i) .eq. 0.0d0) theninfo = ireturnend ifdo 10 j=i,nv(i,j) = x(i,j)10 continue20 continuecall dpodi(v, n, n, d, 1)do 40 i=1,nim1 = i-1do 30 j=1,im1v(i,j) = v(j,i)30 continue40 continuereturnend