Rev 14004 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
cc takes the sum of the absolute values.c jack dongarra, linpack, 3/11/78.c modified 3/93 to return if incx .le. 0.c modified 12/3/93, array(1) declarations changed to array(*)cdouble precision function dasum(n,dx,incx)double precision dx(*),dtempinteger i,incx,m,mp1,n,nincxcdasum = 0.0d0dtemp = 0.0d0if( n.le.0 .or. incx.le.0 )returnif(incx.ne.1) thencc code for increment not equal to 1cnincx = n*incxdo 10 i = 1,nincx,incxdtemp = dtemp + dabs(dx(i))10 continuedasum = dtempelsecc code for increment equal to 1ccc clean-up loopcm = mod(n,6)if( m .ne. 0 ) thendo 30 i = 1,mdtemp = dtemp + dabs(dx(i))30 continueif( n .lt. 6 ) go to 60endifmp1 = m + 1do 50 i = mp1,n,6dtemp = dtemp + dabs(dx(i)) + dabs(dx(i + 1)) +& dabs(dx(i + 2))+ dabs(dx(i + 3)) +& dabs(dx(i + 4))+ dabs(dx(i + 5))50 continue60 dasum = dtempendifreturnendcc constant times a vector plus a vector.c uses unrolled loops for increments equal to one.c jack dongarra, linpack, 3/11/78.c modified 12/3/93, array(1) declarations changed to array(*)csubroutine daxpy(n,da,dx,incx,dy,incy)double precision dx(*),dy(*),dainteger i,incx,incy,ix,iy,m,mp1,ncif(n.le.0)returnif (da .eq. 0.0d0) returnif(incx.eq.1.and.incy.eq.1)go to 20cc code for unequal increments or equal incrementsc not equal to 1cix = 1iy = 1if(incx.lt.0)ix = (-n+1)*incx + 1if(incy.lt.0)iy = (-n+1)*incy + 1do 10 i = 1,ndy(iy) = dy(iy) + da*dx(ix)ix = ix + incxiy = iy + incy10 continuereturncc code for both increments equal to 1ccc clean-up loopc20 m = mod(n,4)if( m .eq. 0 ) go to 40do 30 i = 1,mdy(i) = dy(i) + da*dx(i)30 continueif( n .lt. 4 ) return40 mp1 = m + 1do 50 i = mp1,n,4dy(i) = dy(i) + da*dx(i)dy(i + 1) = dy(i + 1) + da*dx(i + 1)dy(i + 2) = dy(i + 2) + da*dx(i + 2)dy(i + 3) = dy(i + 3) + da*dx(i + 3)50 continuereturnendcc copies a vector, x, to a vector, y.c uses unrolled loops for increments equal to one.c jack dongarra, linpack, 3/11/78.c modified 12/3/93, array(1) declarations changed to array(*)csubroutine dcopy(n,dx,incx,dy,incy)double precision dx(*),dy(*)integer i,incx,incy,ix,iy,m,mp1,ncif(n.le.0)returnif(incx.eq.1.and.incy.eq.1)go to 20cc code for unequal increments or equal incrementsc not equal to 1cix = 1iy = 1if(incx.lt.0)ix = (-n+1)*incx + 1if(incy.lt.0)iy = (-n+1)*incy + 1do 10 i = 1,ndy(iy) = dx(ix)ix = ix + incxiy = iy + incy10 continuereturncc code for both increments equal to 1ccc clean-up loopc20 m = mod(n,7)if( m .eq. 0 ) go to 40do 30 i = 1,mdy(i) = dx(i)30 continueif( n .lt. 7 ) return40 mp1 = m + 1do 50 i = mp1,n,7dy(i) = dx(i)dy(i + 1) = dx(i + 1)dy(i + 2) = dx(i + 2)dy(i + 3) = dx(i + 3)dy(i + 4) = dx(i + 4)dy(i + 5) = dx(i + 5)dy(i + 6) = dx(i + 6)50 continuereturnendcc forms the dot product of two vectors.c uses unrolled loops for increments equal to one.c jack dongarra, linpack, 3/11/78.c modified 12/3/93, array(1) declarations changed to array(*)cdouble precision function ddot(n,dx,incx,dy,incy)double precision dx(*),dy(*),dtempinteger i,incx,incy,ix,iy,m,mp1,ncddot = 0.0d0dtemp = 0.0d0if(n.le.0)returnif(incx.eq.1.and.incy.eq.1)go to 20cc code for unequal increments or equal incrementsc not equal to 1cix = 1iy = 1if(incx.lt.0)ix = (-n+1)*incx + 1if(incy.lt.0)iy = (-n+1)*incy + 1do 10 i = 1,ndtemp = dtemp + dx(ix)*dy(iy)ix = ix + incxiy = iy + incy10 continueddot = dtempreturncc code for both increments equal to 1cc clean-up loopc20 m = mod(n,5)if( m .eq. 0 ) go to 40do 30 i = 1,mdtemp = dtemp + dx(i)*dy(i)30 continueif( n .lt. 5 ) go to 6040 mp1 = m + 1do 50 i = mp1,n,5dtemp = dtemp + dx(i)*dy(i) + dx(i + 1)*dy(i + 1) +* dx(i + 2)*dy(i + 2) + dx(i + 3)*dy(i + 3) + dx(i + 4)*dy(i + 4)50 continue60 ddot = dtempreturnendcc smach computes machine parameters of floating pointc arithmetic for use in testing only. not required byc linpack proper.cc if trouble with automatic computation of these quantities,c they can be set by direct assignment statements.c assume the computer hascc b = base of arithmeticc t = number of base b digitsc l = smallest possible exponentc u = largest possible exponentcc thencc eps = b**(1-t)c tiny = 100.0*b**(-l+t)c huge = 0.01*b**(u-t)cc dmach same as smach except t, l, u apply toc double precision.cc cmach same as smach except if complex divisionc is done bycc 1/(x+i*y) = (x-i*y)/(x**2+y**2)cc thencc tiny = sqrt(tiny)c huge = sqrt(huge)ccc job is 1, 2 or 3 for epsilon, tiny and huge, respectively.cdouble precision function dmach(job)integer jobdouble precision eps,tiny,huge,sceps = 1.0d010 eps = eps/2.0d0s = 1.0d0 + epsif (s .gt. 1.0d0) go to 10eps = 2.0d0*epscs = 1.0d020 tiny = ss = s/16.0d0if (s*1.0 .ne. 0.0d0) go to 20tiny = (tiny/eps)*100.0huge = 1.0d0/tinycdmach = 0.0d0if (job .eq. 1) dmach = epsif (job .eq. 2) dmach = tinyif (job .eq. 3) dmach = hugereturnendcc dnrm2() returns the euclidean norm of a vector via the functionc name, so thatcc dnrm2 := sqrt( x'*x )ccc -- This version written on 25-October-1982.c Modified on 14-October-1993 to inline the call to DLASSQ.c Sven Hammarling, Nag Ltd.ccdouble precision function dnrm2 ( n, x, incx )c .. scalar arguments ..integer incx, nc .. array arguments ..double precision x( * )c .. parameters ..double precision one , zeroparameter ( one = 1.0d+0, zero = 0.0d+0 )c .. local scalars ..integer ixdouble precision absxi, norm, scale, ssqc .. intrinsic functions ..intrinsic abs, sqrtc ..c .. executable statements ..if( n.lt.1 .or. incx.lt.1 )thennorm = zeroelse if( n.eq.1 )thennorm = abs( x( 1 ) )elsescale = zerossq = onec the following loop is equivalent to this call to the lapackc auxiliary routine:c call dlassq( n, x, incx, scale, ssq )cdo 10, ix = 1, 1 + ( n - 1 )*incx, incxif( x( ix ).ne.zero )thenabsxi = abs( x( ix ) )if( scale.lt.absxi )thenssq = one + ssq*( scale/absxi )**2scale = absxielsessq = ssq + ( absxi/scale )**2end ifend if10 continuenorm = scale * sqrt( ssq )end ifcdnrm2 = normreturnendc end of dnrm2.cc applies a plane rotation.c jack dongarra, linpack, 3/11/78.c modified 12/3/93, array(1) declarations changed to array(*)csubroutine drot (n,dx,incx,dy,incy,c,s)double precision dx(*),dy(*),dtemp,c,sinteger i,incx,incy,ix,iy,ncif(n.le.0)returnif(incx.eq.1.and.incy.eq.1)go to 20cc code for unequal increments or equal increments not equalc to 1cix = 1iy = 1if(incx.lt.0)ix = (-n+1)*incx + 1if(incy.lt.0)iy = (-n+1)*incy + 1do 10 i = 1,ndtemp = c*dx(ix) + s*dy(iy)dy(iy) = c*dy(iy) - s*dx(ix)dx(ix) = dtempix = ix + incxiy = iy + incy10 continuereturncc code for both increments equal to 1c20 do 30 i = 1,ndtemp = c*dx(i) + s*dy(i)dy(i) = c*dy(i) - s*dx(i)dx(i) = dtemp30 continuereturnendcc construct givens plane rotation.c jack dongarra, linpack, 3/11/78.csubroutine drotg(da,db,c,s)double precision da,db,c,s,roe,scale,r,zcroe = dbif( dabs(da) .gt. dabs(db) ) roe = dascale = dabs(da) + dabs(db)if( scale .ne. 0.0d0 ) go to 10c = 1.0d0s = 0.0d0r = 0.0d0z = 0.0d0go to 2010 r = scale*dsqrt((da/scale)**2 + (db/scale)**2)r = dsign(1.0d0,roe)*rc = da/rs = db/rz = 1.0d0if( dabs(da) .gt. dabs(db) ) z = sif( dabs(db) .ge. dabs(da) .and. c .ne. 0.0d0 ) z = 1.0d0/c20 da = rdb = zreturnendcc scales a vector by a constant.c uses unrolled loops for increment equal to one.c jack dongarra, linpack, 3/11/78.c modified 3/93 to return if incx .le. 0.c modified 12/3/93, array(1) declarations changed to array(*)csubroutine dscal(n,da,dx,incx)double precision da,dx(*)integer i,incx,m,mp1,n,nincxcif( n.le.0 .or. incx.le.0 )returnif(incx.eq.1)go to 20cc code for increment not equal to 1cnincx = n*incxdo 10 i = 1,nincx,incxdx(i) = da*dx(i)10 continuereturncc code for increment equal to 1ccc clean-up loopc20 m = mod(n,5)if( m .eq. 0 ) go to 40do 30 i = 1,mdx(i) = da*dx(i)30 continueif( n .lt. 5 ) return40 mp1 = m + 1do 50 i = mp1,n,5dx(i) = da*dx(i)dx(i + 1) = da*dx(i + 1)dx(i + 2) = da*dx(i + 2)dx(i + 3) = da*dx(i + 3)dx(i + 4) = da*dx(i + 4)50 continuereturnendcc interchanges two vectors.c uses unrolled loops for increments equal one.c jack dongarra, linpack, 3/11/78.c modified 12/3/93, array(1) declarations changed to array(*)csubroutine dswap (n,dx,incx,dy,incy)double precision dx(*),dy(*),dtempinteger i,incx,incy,ix,iy,m,mp1,ncif(n.le.0)returnif(incx.eq.1.and.incy.eq.1)go to 20cc code for unequal increments or equal increments not equalc to 1cix = 1iy = 1if(incx.lt.0)ix = (-n+1)*incx + 1if(incy.lt.0)iy = (-n+1)*incy + 1do 10 i = 1,ndtemp = dx(ix)dx(ix) = dy(iy)dy(iy) = dtempix = ix + incxiy = iy + incy10 continuereturncc code for both increments equal to 1cc clean-up loopc20 m = mod(n,3)if( m .eq. 0 ) go to 40do 30 i = 1,mdtemp = dx(i)dx(i) = dy(i)dy(i) = dtemp30 continueif( n .lt. 3 ) return40 mp1 = m + 1do 50 i = mp1,n,3dtemp = dx(i)dx(i) = dy(i)dy(i) = dtempdtemp = dx(i + 1)dx(i + 1) = dy(i + 1)dy(i + 1) = dtempdtemp = dx(i + 2)dx(i + 2) = dy(i + 2)dy(i + 2) = dtemp50 continuereturnendcc finds the index of element having max. absolute value.c jack dongarra, linpack, 3/11/78.c modified 3/93 to return if incx .le. 0.c modified 12/3/93, array(1) declarations changed to array(*)cinteger function idamax(n,dx,incx)double precision dx(*),dmaxinteger i,incx,ix,ncidamax = 0if( n.lt.1 .or. incx.le.0 ) returnidamax = 1if(n.eq.1)returnif(incx.eq.1)go to 20cc code for increment not equal to 1cix = 1dmax = dabs(dx(1))ix = ix + incxdo 10 i = 2,nif(dabs(dx(ix)).gt.dmax)thenidamax = idmax = dabs(dx(ix))endifix = ix + incx10 continuereturncc code for increment equal to 1c20 dmax = dabs(dx(1))do 30 i = 2,nif(dabs(dx(i)).le.dmax) go to 30idamax = idmax = dabs(dx(i))30 continuereturnendsubroutine dgemm ( transa, transb, m, n, k, alpha, a, lda, b, ldb,1 beta, c, ldc )c .. scalar arguments ..character*1 transa, transbinteger m, n, k, lda, ldb, ldcdouble precision alpha, betac .. array arguments ..double precision a( lda, * ), b( ldb, * ), c( ldc, * )c ..cc purposec =======cc dgemm performs one of the matrix-matrix operationscc c := alpha*op( a )*op( b ) + beta*c,cc where op( x ) is one ofcc op( x ) = x or op( x ) = x',cc alpha and beta are scalars, and a, b and c are matrices, with op( a )c an m by k matrix, op( b ) a k by n matrix and c an m by n matrix.cc parametersc ==========cc transa - character*1.c on entry, transa specifies the form of op( a ) to be used inc the matrix multiplication as follows:cc transa = 'n' or 'n', op( a ) = a.cc transa = 't' or 't', op( a ) = a'.cc transa = 'c' or 'c', op( a ) = a'.cc unchanged on exit.cc transb - character*1.c on entry, transb specifies the form of op( b ) to be used inc the matrix multiplication as follows:cc transb = 'n' or 'n', op( b ) = b.cc transb = 't' or 't', op( b ) = b'.cc transb = 'c' or 'c', op( b ) = b'.cc unchanged on exit.cc m - integer.c on entry, m specifies the number of rows of the matrixc op( a ) and of the matrix c. m must be at least zero.c unchanged on exit.cc n - integer.c on entry, n specifies the number of columns of the matrixc op( b ) and the number of columns of the matrix c. n must bec at least zero.c unchanged on exit.cc k - integer.c on entry, k specifies the number of columns of the matrixc op( a ) and the number of rows of the matrix op( b ). k mustc be at least zero.c unchanged on exit.cc alpha - double precision.c on entry, alpha specifies the scalar alpha.c unchanged on exit.cc a - double precision array of dimension ( lda, ka ), where ka isc k when transa = 'n' or 'n', and is m otherwise.c before entry with transa = 'n' or 'n', the leading m by kc part of the array a must contain the matrix a, otherwisec the leading k by m part of the array a must contain thec matrix a.c unchanged on exit.cc lda - integer.c on entry, lda specifies the first dimension of a as declaredc in the calling (sub) program. when transa = 'n' or 'n' thenc lda must be at least max( 1, m ), otherwise lda must be atc least max( 1, k ).c unchanged on exit.cc b - double precision array of dimension ( ldb, kb ), where kb isc n when transb = 'n' or 'n', and is k otherwise.c before entry with transb = 'n' or 'n', the leading k by nc part of the array b must contain the matrix b, otherwisec the leading n by k part of the array b must contain thec matrix b.c unchanged on exit.cc ldb - integer.c on entry, ldb specifies the first dimension of b as declaredc in the calling (sub) program. when transb = 'n' or 'n' thenc ldb must be at least max( 1, k ), otherwise ldb must be atc least max( 1, n ).c unchanged on exit.cc beta - double precision.c on entry, beta specifies the scalar beta. when beta isc supplied as zero then c need not be set on input.c unchanged on exit.cc c - double precision array of dimension ( ldc, n ).c before entry, the leading m by n part of the array c mustc contain the matrix c, except when beta is zero, in whichc case c need not be set on entry.c on exit, the array c is overwritten by the m by n matrixc ( alpha*op( a )*op( b ) + beta*c ).cc ldc - integer.c on entry, ldc specifies the first dimension of c as declaredc in the calling (sub) program. ldc must be at leastc max( 1, m ).c unchanged on exit.ccc level 3 blas routine.cc -- written on 8-february-1989.c jack dongarra, argonne national laboratory.c iain duff, aere harwell.c jeremy du croz, numerical algorithms group ltd.c sven hammarling, numerical algorithms group ltd.ccc .. external functions ..logical lsameexternal lsamec .. external subroutines ..external xerblac .. intrinsic functions ..intrinsic maxc .. local scalars ..logical nota, notbinteger i, info, j, l, ncola, nrowa, nrowbdouble precision tempc .. parameters ..double precision one , zeroparameter ( one = 1.0d+0, zero = 0.0d+0 )c ..c .. executable statements ..cc set nota and notb as true if a and b respectively are notc transposed and set nrowa, ncola and nrowb as the number of rowsc and columns of a and the number of rows of b respectively.cnota = lsame( transa, 'n' )notb = lsame( transb, 'n' )if( nota )thennrowa = mncola = kelsenrowa = kncola = mend ifif( notb )thennrowb = kelsenrowb = nend ifcc test the input parameters.cinfo = 0if( ( .not.nota ).and.1 ( .not.lsame( transa, 'c' ) ).and.1 ( .not.lsame( transa, 't' ) ) )theninfo = 1else if( ( .not.notb ).and.1 ( .not.lsame( transb, 'c' ) ).and.1 ( .not.lsame( transb, 't' ) ) )theninfo = 2else if( m .lt.0 )theninfo = 3else if( n .lt.0 )theninfo = 4else if( k .lt.0 )theninfo = 5else if( lda.lt.max( 1, nrowa ) )theninfo = 8else if( ldb.lt.max( 1, nrowb ) )theninfo = 10else if( ldc.lt.max( 1, m ) )theninfo = 13end ifif( info.ne.0 )thencall xerbla( 'dgemm ', info )returnend ifcc quick return if possible.cif( ( m.eq.0 ).or.( n.eq.0 ).or.1 ( ( ( alpha.eq.zero ).or.( k.eq.0 ) ).and.( beta.eq.one ) ) )1 returncc and if alpha.eq.zero.cif( alpha.eq.zero )thenif( beta.eq.zero )thendo 20, j = 1, ndo 10, i = 1, mc( i, j ) = zero10 continue20 continueelsedo 40, j = 1, ndo 30, i = 1, mc( i, j ) = beta*c( i, j )30 continue40 continueend ifreturnend ifcc start the operations.cif( notb )thenif( nota )thencc form c := alpha*a*b + beta*c.cdo 90, j = 1, nif( beta.eq.zero )thendo 50, i = 1, mc( i, j ) = zero50 continueelse if( beta.ne.one )thendo 60, i = 1, mc( i, j ) = beta*c( i, j )60 continueend ifdo 80, l = 1, kif( b( l, j ).ne.zero )thentemp = alpha*b( l, j )do 70, i = 1, mc( i, j ) = c( i, j ) + temp*a( i, l )70 continueend if80 continue90 continueelsecc form c := alpha*a'*b + beta*ccdo 120, j = 1, ndo 110, i = 1, mtemp = zerodo 100, l = 1, ktemp = temp + a( l, i )*b( l, j )100 continueif( beta.eq.zero )thenc( i, j ) = alpha*tempelsec( i, j ) = alpha*temp + beta*c( i, j )end if110 continue120 continueend ifelseif( nota )thencc form c := alpha*a*b' + beta*ccdo 170, j = 1, nif( beta.eq.zero )thendo 130, i = 1, mc( i, j ) = zero130 continueelse if( beta.ne.one )thendo 140, i = 1, mc( i, j ) = beta*c( i, j )140 continueend ifdo 160, l = 1, kif( b( j, l ).ne.zero )thentemp = alpha*b( j, l )do 150, i = 1, mc( i, j ) = c( i, j ) + temp*a( i, l )150 continueend if160 continue170 continueelsecc form c := alpha*a'*b' + beta*ccdo 200, j = 1, ndo 190, i = 1, mtemp = zerodo 180, l = 1, ktemp = temp + a( l, i )*b( j, l )180 continueif( beta.eq.zero )thenc( i, j ) = alpha*tempelsec( i, j ) = alpha*temp + beta*c( i, j )end if190 continue200 continueend ifend ifcreturncc end of dgemm .cendsubroutine dtrsm ( side, uplo, transa, diag, m, n, alpha, a, lda,$ b, ldb )* .. scalar arguments ..character*1 side, uplo, transa, diaginteger m, n, lda, ldbdouble precision alpha* .. array arguments ..double precision a( lda, * ), b( ldb, * )* ..** purpose* =======** dtrsm solves one of the matrix equations** op( a )*x = alpha*b, or x*op( a ) = alpha*b,** where alpha is a scalar, x and b are m by n matrices, a is a unit, or* non-unit, upper or lower triangular matrix and op( a ) is one of** op( a ) = a or op( a ) = a'.** the matrix x is overwritten on b.** parameters* ==========** side - character*1.* on entry, side specifies whether op( a ) appears on the left* or right of x as follows:** side = 'l' or 'l' op( a )*x = alpha*b.** side = 'r' or 'r' x*op( a ) = alpha*b.** unchanged on exit.** uplo - character*1.* on entry, uplo specifies whether the matrix a is an upper or* lower triangular matrix as follows:** uplo = 'u' or 'u' a is an upper triangular matrix.** uplo = 'l' or 'l' a is a lower triangular matrix.** unchanged on exit.** transa - character*1.* on entry, transa specifies the form of op( a ) to be used in* the matrix multiplication as follows:** transa = 'n' or 'n' op( a ) = a.** transa = 't' or 't' op( a ) = a'.** transa = 'c' or 'c' op( a ) = a'.** unchanged on exit.** diag - character*1.* on entry, diag specifies whether or not a is unit triangular* as follows:** diag = 'u' or 'u' a is assumed to be unit triangular.** diag = 'n' or 'n' a is not assumed to be unit* triangular.** unchanged on exit.** m - integer.* on entry, m specifies the number of rows of b. m must be at* least zero.* unchanged on exit.** n - integer.* on entry, n specifies the number of columns of b. n must be* at least zero.* unchanged on exit.** alpha - double precision.* on entry, alpha specifies the scalar alpha. when alpha is* zero then a is not referenced and b need not be set before* entry.* unchanged on exit.** a - double precision array of dimension ( lda, k ), where k is m* when side = 'l' or 'l' and is n when side = 'r' or 'r'.* before entry with uplo = 'u' or 'u', the leading k by k* upper triangular part of the array a must contain the upper* triangular matrix and the strictly lower triangular part of* a is not referenced.* before entry with uplo = 'l' or 'l', the leading k by k* lower triangular part of the array a must contain the lower* triangular matrix and the strictly upper triangular part of* a is not referenced.* note that when diag = 'u' or 'u', the diagonal elements of* a are not referenced either, but are assumed to be unity.* unchanged on exit.** lda - integer.* on entry, lda specifies the first dimension of a as declared* in the calling (sub) program. when side = 'l' or 'l' then* lda must be at least max( 1, m ), when side = 'r' or 'r'* then lda must be at least max( 1, n ).* unchanged on exit.** b - double precision array of dimension ( ldb, n ).* before entry, the leading m by n part of the array b must* contain the right-hand side matrix b, and on exit is* overwritten by the solution matrix x.** ldb - integer.* on entry, ldb specifies the first dimension of b as declared* in the calling (sub) program. ldb must be at least* max( 1, m ).* unchanged on exit.*** level 3 blas routine.*** -- written on 8-february-1989.* jack dongarra, argonne national laboratory.* iain duff, aere harwell.* jeremy du croz, numerical algorithms group ltd.* sven hammarling, numerical algorithms group ltd.*** .. external functions ..logical lsameexternal lsame* .. external subroutines ..external xerbla* .. intrinsic functions ..intrinsic max* .. local scalars ..logical lside, nounit, upperinteger i, info, j, k, nrowadouble precision temp* .. parameters ..double precision one , zeroparameter ( one = 1.0d+0, zero = 0.0d+0 )* ..* .. executable statements ..** test the input parameters.*lside = lsame( side , 'l' )if( lside )thennrowa = melsenrowa = nend ifnounit = lsame( diag , 'n' )upper = lsame( uplo , 'u' )*info = 0if( ( .not.lside ).and.$ ( .not.lsame( side , 'r' ) ) )theninfo = 1else if( ( .not.upper ).and.$ ( .not.lsame( uplo , 'l' ) ) )theninfo = 2else if( ( .not.lsame( transa, 'n' ) ).and.$ ( .not.lsame( transa, 't' ) ).and.$ ( .not.lsame( transa, 'c' ) ) )theninfo = 3else if( ( .not.lsame( diag , 'u' ) ).and.$ ( .not.lsame( diag , 'n' ) ) )theninfo = 4else if( m .lt.0 )theninfo = 5else if( n .lt.0 )theninfo = 6else if( lda.lt.max( 1, nrowa ) )theninfo = 9else if( ldb.lt.max( 1, m ) )theninfo = 11end ifif( info.ne.0 )thencall xerbla( 'dtrsm ', info )returnend if** quick return if possible.*if( n.eq.0 )$ return** and when alpha.eq.zero.*if( alpha.eq.zero )thendo 20, j = 1, ndo 10, i = 1, mb( i, j ) = zero10 continue20 continuereturnend if** start the operations.*if( lside )thenif( lsame( transa, 'n' ) )then** form b := alpha*inv( a )*b.*if( upper )thendo 60, j = 1, nif( alpha.ne.one )thendo 30, i = 1, mb( i, j ) = alpha*b( i, j )30 continueend ifdo 50, k = m, 1, -1if( b( k, j ).ne.zero )thenif( nounit )$ b( k, j ) = b( k, j )/a( k, k )do 40, i = 1, k - 1b( i, j ) = b( i, j ) - b( k, j )*a( i, k )40 continueend if50 continue60 continueelsedo 100, j = 1, nif( alpha.ne.one )thendo 70, i = 1, mb( i, j ) = alpha*b( i, j )70 continueend ifdo 90 k = 1, mif( b( k, j ).ne.zero )thenif( nounit )$ b( k, j ) = b( k, j )/a( k, k )do 80, i = k + 1, mb( i, j ) = b( i, j ) - b( k, j )*a( i, k )80 continueend if90 continue100 continueend ifelse** form b := alpha*inv( a' )*b.*if( upper )thendo 130, j = 1, ndo 120, i = 1, mtemp = alpha*b( i, j )do 110, k = 1, i - 1temp = temp - a( k, i )*b( k, j )110 continueif( nounit )$ temp = temp/a( i, i )b( i, j ) = temp120 continue130 continueelsedo 160, j = 1, ndo 150, i = m, 1, -1temp = alpha*b( i, j )do 140, k = i + 1, mtemp = temp - a( k, i )*b( k, j )140 continueif( nounit )$ temp = temp/a( i, i )b( i, j ) = temp150 continue160 continueend ifend ifelseif( lsame( transa, 'n' ) )then** form b := alpha*b*inv( a ).*if( upper )thendo 210, j = 1, nif( alpha.ne.one )thendo 170, i = 1, mb( i, j ) = alpha*b( i, j )170 continueend ifdo 190, k = 1, j - 1if( a( k, j ).ne.zero )thendo 180, i = 1, mb( i, j ) = b( i, j ) - a( k, j )*b( i, k )180 continueend if190 continueif( nounit )thentemp = one/a( j, j )do 200, i = 1, mb( i, j ) = temp*b( i, j )200 continueend if210 continueelsedo 260, j = n, 1, -1if( alpha.ne.one )thendo 220, i = 1, mb( i, j ) = alpha*b( i, j )220 continueend ifdo 240, k = j + 1, nif( a( k, j ).ne.zero )thendo 230, i = 1, mb( i, j ) = b( i, j ) - a( k, j )*b( i, k )230 continueend if240 continueif( nounit )thentemp = one/a( j, j )do 250, i = 1, mb( i, j ) = temp*b( i, j )250 continueend if260 continueend ifelse** form b := alpha*b*inv( a' ).*if( upper )thendo 310, k = n, 1, -1if( nounit )thentemp = one/a( k, k )do 270, i = 1, mb( i, k ) = temp*b( i, k )270 continueend ifdo 290, j = 1, k - 1if( a( j, k ).ne.zero )thentemp = a( j, k )do 280, i = 1, mb( i, j ) = b( i, j ) - temp*b( i, k )280 continueend if290 continueif( alpha.ne.one )thendo 300, i = 1, mb( i, k ) = alpha*b( i, k )300 continueend if310 continueelsedo 360, k = 1, nif( nounit )thentemp = one/a( k, k )do 320, i = 1, mb( i, k ) = temp*b( i, k )320 continueend ifdo 340, j = k + 1, nif( a( j, k ).ne.zero )thentemp = a( j, k )do 330, i = 1, mb( i, j ) = b( i, j ) - temp*b( i, k )330 continueend if340 continueif( alpha.ne.one )thendo 350, i = 1, mb( i, k ) = alpha*b( i, k )350 continueend if360 continueend ifend ifend if*return** end of dtrsm .*endlogical function lsame( ca, cb )cc -- lapack auxiliary routine (version 2.0) --c univ. of tennessee, univ. of california berkeley, nag ltd.,c courant institute, argonne national lab, and rice universityc january 31, 1994cc .. scalar arguments ..character ca, cbc ..cc purposec =======cc lsame returns .true. if ca is the same letter as cb regardless ofc case.cc argumentsc =========cc ca (input) character*1c cb (input) character*1c ca and cb specify the single characters to be compared.cc =====================================================================cc .. intrinsic functions ..intrinsic icharc ..c .. local scalars ..integer inta, intb, zcodec ..c .. executable statements ..cc test if the characters are equalclsame = ca.eq.cbif( lsame )1 returncc now test for equivalence if both characters are alphabetic.czcode = ichar( 'z' )cc use 'z' rather than 'a' so that ascii can be detected on primec machines, on which ichar returns a value with bit 8 set.c ichar('a') on prime machines returns 193 which is the same asc ichar('a') on an ebcdic machine.cinta = ichar( ca )intb = ichar( cb )cif( zcode.eq.90 .or. zcode.eq.122 ) thencc ascii is assumed - zcode is the ascii code of either lower orc upper case 'z'.cif( inta.ge.97 .and. inta.le.122 ) inta = inta - 32if( intb.ge.97 .and. intb.le.122 ) intb = intb - 32celse if( zcode.eq.233 .or. zcode.eq.169 ) thencc ebcdic is assumed - zcode is the ebcdic code of either lower orc upper case 'z'.cif( inta.ge.129 .and. inta.le.137 .or.1 inta.ge.145 .and. inta.le.153 .or.1 inta.ge.162 .and. inta.le.169 ) inta = inta + 64if( intb.ge.129 .and. intb.le.137 .or.1 intb.ge.145 .and. intb.le.153 .or.1 intb.ge.162 .and. intb.le.169 ) intb = intb + 64celse if( zcode.eq.218 .or. zcode.eq.250 ) thencc ascii is assumed, on prime machines - zcode is the ascii codec plus 128 of either lower or upper case 'z'.cif( inta.ge.225 .and. inta.le.250 ) inta = inta - 32if( intb.ge.225 .and. intb.le.250 ) intb = intb - 32end iflsame = inta.eq.intbcc returncc end of lsamecendc SUBROUTINE XERBLA( SRNAME, INFO )cc -- LAPACK auxiliary routine (preliminary version) --c Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,c Courant Institute, Argonne National Lab, and Rice Universityc February 29, 1992cc .. Scalar Arguments ..c CHARACTER*6 SRNAMEc INTEGER INFOc ..cc Purposec =======cc XERBLA is an error handler for the LAPACK routines.c It is called by an LAPACK routine if an input parameter has anc invalid value. A message is printed and execution stops.cc Installers may consider modifying the STOP statement in order toc call system-specific exception-handling facilities.cc Argumentsc =========cc SRNAME (input) CHARACTER*6c The name of the routine which called XERBLA.cc INFO (input) INTEGERc The position of the invalid parameter in the parameter listc of the calling routine.cc This has been replaced by a C routine in src/main/print.c