summaryrefslogtreecommitdiff
path: root/2.3-1/src/fortran/lapack/drscl.f
diff options
context:
space:
mode:
authoryash11122017-07-07 21:20:49 +0530
committeryash11122017-07-07 21:20:49 +0530
commit9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 (patch)
treef50d6e06d8fe6bc1a9053ef10d4b4d857800ab51 /2.3-1/src/fortran/lapack/drscl.f
downloadScilab2C-9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0.tar.gz
Scilab2C-9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0.tar.bz2
Scilab2C-9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0.zip
sci2c arduino updated
Diffstat (limited to '2.3-1/src/fortran/lapack/drscl.f')
-rw-r--r--2.3-1/src/fortran/lapack/drscl.f114
1 files changed, 114 insertions, 0 deletions
diff --git a/2.3-1/src/fortran/lapack/drscl.f b/2.3-1/src/fortran/lapack/drscl.f
new file mode 100644
index 00000000..a13e96d8
--- /dev/null
+++ b/2.3-1/src/fortran/lapack/drscl.f
@@ -0,0 +1,114 @@
+ SUBROUTINE DRSCL( N, SA, SX, INCX )
+*
+* -- LAPACK auxiliary routine (version 3.1) --
+* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
+* November 2006
+*
+* .. Scalar Arguments ..
+ INTEGER INCX, N
+ DOUBLE PRECISION SA
+* ..
+* .. Array Arguments ..
+ DOUBLE PRECISION SX( * )
+* ..
+*
+* Purpose
+* =======
+*
+* DRSCL multiplies an n-element real vector x by the real scalar 1/a.
+* This is done without overflow or underflow as long as
+* the final result x/a does not overflow or underflow.
+*
+* Arguments
+* =========
+*
+* N (input) INTEGER
+* The number of components of the vector x.
+*
+* SA (input) DOUBLE PRECISION
+* The scalar a which is used to divide each component of x.
+* SA must be >= 0, or the subroutine will divide by zero.
+*
+* SX (input/output) DOUBLE PRECISION array, dimension
+* (1+(N-1)*abs(INCX))
+* The n-element vector x.
+*
+* INCX (input) INTEGER
+* The increment between successive values of the vector SX.
+* > 0: SX(1) = X(1) and SX(1+(i-1)*INCX) = x(i), 1< i<= n
+*
+* =====================================================================
+*
+* .. Parameters ..
+ DOUBLE PRECISION ONE, ZERO
+ PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )
+* ..
+* .. Local Scalars ..
+ LOGICAL DONE
+ DOUBLE PRECISION BIGNUM, CDEN, CDEN1, CNUM, CNUM1, MUL, SMLNUM
+* ..
+* .. External Functions ..
+ DOUBLE PRECISION DLAMCH
+ EXTERNAL DLAMCH
+* ..
+* .. External Subroutines ..
+ EXTERNAL DSCAL
+* ..
+* .. Intrinsic Functions ..
+ INTRINSIC ABS
+* ..
+* .. Executable Statements ..
+*
+* Quick return if possible
+*
+ IF( N.LE.0 )
+ $ RETURN
+*
+* Get machine parameters
+*
+ SMLNUM = DLAMCH( 'S' )
+ BIGNUM = ONE / SMLNUM
+ CALL DLABAD( SMLNUM, BIGNUM )
+*
+* Initialize the denominator to SA and the numerator to 1.
+*
+ CDEN = SA
+ CNUM = ONE
+*
+ 10 CONTINUE
+ CDEN1 = CDEN*SMLNUM
+ CNUM1 = CNUM / BIGNUM
+ IF( ABS( CDEN1 ).GT.ABS( CNUM ) .AND. CNUM.NE.ZERO ) THEN
+*
+* Pre-multiply X by SMLNUM if CDEN is large compared to CNUM.
+*
+ MUL = SMLNUM
+ DONE = .FALSE.
+ CDEN = CDEN1
+ ELSE IF( ABS( CNUM1 ).GT.ABS( CDEN ) ) THEN
+*
+* Pre-multiply X by BIGNUM if CDEN is small compared to CNUM.
+*
+ MUL = BIGNUM
+ DONE = .FALSE.
+ CNUM = CNUM1
+ ELSE
+*
+* Multiply X by CNUM / CDEN and return.
+*
+ MUL = CNUM / CDEN
+ DONE = .TRUE.
+ END IF
+*
+* Scale the vector X by MUL
+*
+ CALL DSCAL( N, MUL, SX, INCX )
+*
+ IF( .NOT.DONE )
+ $ GO TO 10
+*
+ RETURN
+*
+* End of DRSCL
+*
+ END