68 INTEGER,
INTENT(IN) :: nrows,ncols
69 INTEGER,
INTENT(OUT),
OPTIONAL :: scount
70 REAL(RFREAL) ::
a(nrows,ncols),
ainv(ncols,nrows)
77 CHARACTER(CHRLEN) :: rcsidentstring
78 INTEGER :: errorflag,
i,info,
j,workarrayrealsize
79 INTEGER :: workarrayint(8*ncols)
80 REAL(RFREAL) ::
s(ncols)
81 REAL(RFREAL),
DIMENSION(:),
ALLOCATABLE :: workarrayreal
82 REAL(RFREAL) :: sinv(ncols,nrows),u(nrows,nrows),vt(ncols,ncols), &
89 rcsidentstring =
'$RCSfile: RFLU_InvertMatrixSVD.F90,v $ $Revision: 1.9 $'
92 'RFLU_InvertMatrixSVD.F90')
98 workarrayrealsize = 2*(4*ncols*ncols + nrows + 9*ncols)
100 ALLOCATE(workarrayreal(workarrayrealsize),stat=errorflag)
101 global%error = errorflag
102 IF ( global%error /= err_none )
THEN
103 CALL
errorstop(global,err_allocate,__line__,
'workArrayReal')
110 CALL
dgesdd(
'A',nrows,ncols,
a,nrows,
s,u,nrows,vt,ncols,workarrayreal, &
111 workarrayrealsize,workarrayint,info)
113 IF ( global%error /= err_none )
THEN
114 CALL
errorstop(global,err_lapack_output,__line__)
125 sinv(
i,
j) = 0.0_rfreal
140 IF (
s(1) > 100.0_rfreal*epsilon(1.0_rfreal) )
THEN
141 sinv(1,1) = 1.0_rfreal/
s(1)
143 sinv(1,1) = 0.0_rfreal
147 outerloop:
DO i = 2,ncols
148 IF (
s(
i) > 0.01_rfreal*
s(
i-1) )
THEN
149 sinv(
i,
i) = 1.0_rfreal/
s(
i)
151 sinv(
i,
i) = 0.0_rfreal
155 sinv(
j,
j) = 0.0_rfreal
167 ainv = matmul(transpose(vt),matmul(sinv,transpose(u)))
173 DEALLOCATE(workarrayreal,stat=errorflag)
174 global%error = errorflag
175 IF ( global%error /= err_none )
THEN
176 CALL
errorstop(global,err_deallocate,__line__,
'workArrayReal')
subroutine ainv(ajac, ajacin, det, ndim)
subroutine rflu_invertmatrixsvd(global, nRows, nCols, a, aInv, sCount)
subroutine registerfunction(global, funName, fileName)
subroutine dgesdd(JOBZ, M, N, A, LDA, S, U, LDU, VT, LDVT, WORK, LWORK, IWORK, INFO)
*********************************************************************Illinois Open Source License ****University of Illinois NCSA **Open Source License University of Illinois All rights reserved ****Developed free of to any person **obtaining a copy of this software and associated documentation to deal with the Software without including without limitation the rights to and or **sell copies of the and to permit persons to whom the **Software is furnished to do subject to the following this list of conditions and the following disclaimers ****Redistributions in binary form must reproduce the above **copyright this list of conditions and the following **disclaimers in the documentation and or other materials **provided with the distribution ****Neither the names of the Center for Simulation of Advanced the University of nor the names of its **contributors may be used to endorse or promote products derived **from this Software without specific prior written permission ****THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE v
subroutine errorstop(global, errorCode, errorLine, addMessage)
subroutine deregisterfunction(global)