PLaSK library
Loading...
Searching...
No Matches
sintf1.c
Go to the documentation of this file.
1/* sintf1.f -- translated by f2c (version 20100827).
2 You must link the resulting object file with libf2c:
3 on Microsoft Windows system, link with libf2c.lib;
4 on Linux or Unix systems, link with .../path/to/libf2c.a -lm
5 or, if you install libf2c.a in a standard place, with -lf2c -lm
6 -- in that order, at the end of the command line, as in
7 cc *.o -lf2c -lm
8 Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
9
10 http://www.netlib.org/f2c/libf2c.zip
11*/
12
13#include "f2c.h"
14
15/* Table of constant values */
16
17static integer c__1 = 1;
18static integer c_n5 = -5;
19
20/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
21/* * * */
22/* * copyright (c) 2011 by UCAR * */
23/* * * */
24/* * University Corporation for Atmospheric Research * */
25/* * * */
26/* * all rights reserved * */
27/* * * */
28/* * FFTPACK version 5.1 * */
29/* * * */
30/* * A Fortran Package of Fast Fourier * */
31/* * * */
32/* * Subroutines and Example Programs * */
33/* * * */
34/* * by * */
35/* * * */
36/* * Paul Swarztrauber and Dick Valent * */
37/* * * */
38/* * of * */
39/* * * */
40/* * the National Center for Atmospheric Research * */
41/* * * */
42/* * Boulder, Colorado (80307) U.S.A. * */
43/* * * */
44/* * which is sponsored by * */
45/* * * */
46/* * the National Science Foundation * */
47/* * * */
48/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
49
50/* Subroutine */ int sintf1_(integer *n, integer *inc, doublereal *x,
51 doublereal *wsave, doublereal *xh, doublereal *work, integer *ier)
52{
53 /* System generated locals */
54 integer x_dim1, x_offset, i__1;
55
56 /* Builtin functions */
57 double sqrt(doublereal), log(doublereal);
58
59 /* Local variables */
60 integer i__, k;
61 doublereal t1, t2;
62 integer kc, np1, ns2, ier1, modn;
63 doublereal dsum;
64 integer lnxh, lnwk, lnsv;
65 doublereal sfnp1, xhold;
66 extern /* Subroutine */ int rfft1f_(integer *, integer *, doublereal *,
68 integer *);
69 doublereal ssqrt3;
70 extern /* Subroutine */ int xerfft_(char *, integer *, ftnlen);
71
72 /* Parameter adjustments */
73 x_dim1 = *inc;
74 x_offset = 1 + x_dim1;
75 x -= x_offset;
76 --wsave;
77 --xh;
78
79 /* Function Body */
80 *ier = 0;
81 if ((i__1 = *n - 2) < 0) {
82 goto L200;
83 } else if (i__1 == 0) {
84 goto L102;
85 } else {
86 goto L103;
87 }
88L102:
89 ssqrt3 = 1. / sqrt(3.);
90 xhold = ssqrt3 * (x[x_dim1 + 1] + x[(x_dim1 << 1) + 1]);
91 x[(x_dim1 << 1) + 1] = ssqrt3 * (x[x_dim1 + 1] - x[(x_dim1 << 1) + 1]);
92 x[x_dim1 + 1] = xhold;
93 goto L200;
94L103:
95 np1 = *n + 1;
96 ns2 = *n / 2;
97 i__1 = ns2;
98 for (k = 1; k <= i__1; ++k) {
99 kc = np1 - k;
100 t1 = x[k * x_dim1 + 1] - x[kc * x_dim1 + 1];
101 t2 = wsave[k] * (x[k * x_dim1 + 1] + x[kc * x_dim1 + 1]);
102 xh[k + 1] = t1 + t2;
103 xh[kc + 1] = t2 - t1;
104/* L104: */
105 }
106 modn = *n % 2;
107 if (modn == 0) {
108 goto L124;
109 }
110 xh[ns2 + 2] = x[(ns2 + 1) * x_dim1 + 1] * 4.;
111L124:
112 xh[1] = 0.;
113 lnxh = np1;
114 lnsv = np1 + (integer) (log((doublereal) np1) / log(2.)) + 4;
115 lnwk = np1;
116
117 rfft1f_(&np1, &c__1, &xh[1], &lnxh, &wsave[ns2 + 1], &lnsv, work, &lnwk, &
118 ier1);
119 if (ier1 != 0) {
120 *ier = 20;
121 xerfft_("SINTF1", &c_n5, (ftnlen)6);
122 goto L200;
123 }
124
125 if (np1 % 2 != 0) {
126 goto L30;
127 }
128 xh[np1] += xh[np1];
129L30:
130 sfnp1 = 1. / (doublereal) np1;
131 x[x_dim1 + 1] = xh[1] * .5;
132 dsum = x[x_dim1 + 1];
133 i__1 = *n;
134 for (i__ = 3; i__ <= i__1; i__ += 2) {
135 x[(i__ - 1) * x_dim1 + 1] = xh[i__] * .5;
136 dsum += xh[i__ - 1] * .5;
137 x[i__ * x_dim1 + 1] = dsum;
138/* L105: */
139 }
140 if (modn != 0) {
141 goto L200;
142 }
143 x[*n * x_dim1 + 1] = xh[*n + 1] * .5;
144L200:
145 return 0;
146} /* sintf1_ */
147