GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
inits.f
Go to the documentation of this file.
1 *DECK INITS
2  FUNCTION inits (OS, NOS, ETA)
3 C***BEGIN PROLOGUE INITS
4 C***PURPOSE Determine the number of terms needed in an orthogonal
5 C polynomial series so that it meets a specified accuracy.
6 C***LIBRARY SLATEC (FNLIB)
7 C***CATEGORY C3A2
8 C***TYPE SINGLE PRECISION (INITS-S, INITDS-D)
9 C***KEYWORDS CHEBYSHEV, FNLIB, INITIALIZE, ORTHOGONAL POLYNOMIAL,
10 C ORTHOGONAL SERIES, SPECIAL FUNCTIONS
11 C***AUTHOR Fullerton, W., (LANL)
12 C***DESCRIPTION
13 C
14 C Initialize the orthogonal series, represented by the array OS, so
15 C that INITS is the number of terms needed to insure the error is no
16 C larger than ETA. Ordinarily, ETA will be chosen to be one-tenth
17 C machine precision.
18 C
19 C Input Arguments --
20 C OS single precision array of NOS coefficients in an orthogonal
21 C series.
22 C NOS number of coefficients in OS.
23 C ETA single precision scalar containing requested accuracy of
24 C series.
25 C
26 C***REFERENCES (NONE)
27 C***ROUTINES CALLED XERMSG
28 C***REVISION HISTORY (YYMMDD)
29 C 770401 DATE WRITTEN
30 C 890831 Modified array declarations. (WRB)
31 C 891115 Modified error message. (WRB)
32 C 891115 REVISION DATE from Version 3.2
33 C 891214 Prologue converted to Version 4.0 format. (BAB)
34 C 900315 CALLs to XERROR changed to CALLs to XERMSG. (THJ)
35 C***END PROLOGUE INITS
36  REAL os(*)
37 C***FIRST EXECUTABLE STATEMENT INITS
38  IF (nos .LT. 1) CALL xermsg ('SLATEC', 'INITS',
39  + 'Number of coefficients is less than 1', 2, 1)
40 C
41  err = 0.
42  DO 10 ii = 1,nos
43  i = nos + 1 - ii
44  err = err + abs(os(i))
45  IF (err.GT.eta) GO TO 20
46  10 CONTINUE
47 C
48  20 IF (i .EQ. nos) CALL xermsg ('SLATEC', 'INITS',
49  + 'Chebyshev series too short for specified accuracy', 1, 1)
50  inits = i
51 C
52  RETURN
53  END
static T abs(T x)
Definition: pr-output.cc:1696