diff libcruft/qrupdate/cch1up.f @ 7789:82be108cc558

First attempt at single precision tyeps * * * corrections to qrupdate single precision routines * * * prefer demotion to single over promotion to double * * * Add single precision support to log2 function * * * Trivial PROJECT file update * * * Cache optimized hermitian/transpose methods * * * Add tests for tranpose/hermitian and ChangeLog entry for new transpose code
author David Bateman <dbateman@free.fr>
date Sun, 27 Apr 2008 22:34:17 +0200
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libcruft/qrupdate/cch1up.f	Sun Apr 27 22:34:17 2008 +0200
@@ -0,0 +1,56 @@
+c Copyright (C) 2008  VZLU Prague, a.s., Czech Republic
+c 
+c Author: Jaroslav Hajek <highegg@gmail.com>
+c 
+c This source is free software; you can redistribute it and/or modify
+c it under the terms of the GNU General Public License as published by
+c the Free Software Foundation; either version 2 of the License, or
+c (at your option) any later version.
+c 
+c This program is distributed in the hope that it will be useful,
+c but WITHOUT ANY WARRANTY; without even the implied warranty of
+c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+c GNU General Public License for more details.
+c 
+c You should have received a copy of the GNU General Public License
+c along with this software; see the file COPYING.  If not, see
+c <http://www.gnu.org/licenses/>.
+c 
+      subroutine cch1up(n,R,u,w)
+c purpose:      given an upper triangular matrix R that is a Cholesky
+c               factor of a hermitian positive definite matrix A, i.e.
+c               A = R'*R, this subroutine updates R -> R1 so that
+c               R1'*R1 = A + u*u' or A - u*u'
+c               (complex version)
+c arguments:
+c n (in)        the order of matrix R
+c R (io)        on entry, the upper triangular matrix R
+c               on exit, the updated matrix R1
+c u (io)        the vector determining the rank-1 update
+c               on exit, u is destroyed.
+c w (w)         a real workspace vector of size n
+c 
+c NOTE: the workspace vector is used to store the rotations
+c       so that R does not need to be traversed by rows.
+c
+      integer n
+      complex R(n,n),u(n)
+      real w(n)
+      external clartg
+      complex rr,ui,t
+      integer i,j
+      
+      do i = 1,n
+c apply stored rotations, column-wise
+        ui = conjg(u(i))
+        do j = 1,i-1
+          t = w(j)*R(j,i) + u(j)*ui
+          ui = w(j)*ui - conjg(u(j))*R(j,i)
+          R(j,i) = t
+        end do
+c generate next rotation        
+        call clartg(R(i,i),ui,w(i),u(i),rr)
+        R(i,i) = rr
+      end do
+      end
+