GNU Octave 10.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
dcnst0.f
Go to the documentation of this file.
1C Work performed under the auspices of the U.S. Department of Energy
2C by Lawrence Livermore National Laboratory under contract number
3C W-7405-Eng-48.
4C
5 SUBROUTINE dcnst0 (NEQ, Y, ICNSTR, IRET)
6C
7C***BEGIN PROLOGUE DCNST0
8C***DATE WRITTEN 950808 (YYMMDD)
9C***REVISION DATE 950808 (YYMMDD)
10C
11C
12C-----------------------------------------------------------------------
13C***DESCRIPTION
14C
15C This subroutine checks for constraint violations in the initial
16C approximate solution u.
17C
18C On entry
19C
20C NEQ -- size of the nonlinear system, and the length of arrays
21C Y and ICNSTR.
22C
23C Y -- real array containing the initial approximate root.
24C
25C ICNSTR -- INTEGER array of length NEQ containing flags indicating
26C which entries in Y are to be constrained.
27C if ICNSTR(I) = 2, then Y(I) must be .GT. 0,
28C if ICNSTR(I) = 1, then Y(I) must be .GE. 0,
29C if ICNSTR(I) = -1, then Y(I) must be .LE. 0, while
30C if ICNSTR(I) = -2, then Y(I) must be .LT. 0, while
31C if ICNSTR(I) = 0, then Y(I) is not constrained.
32C
33C On return
34C
35C IRET -- output flag.
36C IRET=0 means that u satisfied all constraints.
37C IRET.NE.0 means that Y(IRET) failed to satisfy its
38C constraint.
39C
40C-----------------------------------------------------------------------
41 IMPLICIT DOUBLE PRECISION(a-h,o-z)
42 dimension y(neq), icnstr(neq)
43 SAVE zero
44 DATA zero/0.d0/
45C-----------------------------------------------------------------------
46C Check constraints for initial Y. If a constraint has been violated,
47C set IRET = I to signal an error return to calling routine.
48C-----------------------------------------------------------------------
49 iret = 0
50 DO 100 i = 1,neq
51 IF (icnstr(i) .EQ. 2) THEN
52 IF (y(i) .LE. zero) THEN
53 iret = i
54 RETURN
55 ENDIF
56 ELSEIF (icnstr(i) .EQ. 1) THEN
57 IF (y(i) .LT. zero) THEN
58 iret = i
59 RETURN
60 ENDIF
61 ELSEIF (icnstr(i) .EQ. -1) THEN
62 IF (y(i) .GT. zero) THEN
63 iret = i
64 RETURN
65 ENDIF
66 ELSEIF (icnstr(i) .EQ. -2) THEN
67 IF (y(i) .GE. zero) THEN
68 iret = i
69 RETURN
70 ENDIF
71 ENDIF
72 100 CONTINUE
73 RETURN
74C----------------------- END OF SUBROUTINE DCNST0 ----------------------
75 END
subroutine dcnst0(neq, y, icnstr, iret)
Definition dcnst0.f:6