PLaSK library
Loading...
Searching...
No Matches
mcsqb1.c
Go to the documentation of this file.
1/* mcsqb1.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_n5 = -5;
18
19/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
20/* * * */
21/* * copyright (c) 2011 by UCAR * */
22/* * * */
23/* * University Corporation for Atmospheric Research * */
24/* * * */
25/* * all rights reserved * */
26/* * * */
27/* * FFTPACK version 5.1 * */
28/* * * */
29/* * A Fortran Package of Fast Fourier * */
30/* * * */
31/* * Subroutines and Example Programs * */
32/* * * */
33/* * by * */
34/* * * */
35/* * Paul Swarztrauber and Dick Valent * */
36/* * * */
37/* * of * */
38/* * * */
39/* * the National Center for Atmospheric Research * */
40/* * * */
41/* * Boulder, Colorado (80307) U.S.A. * */
42/* * * */
43/* * which is sponsored by * */
44/* * * */
45/* * the National Science Foundation * */
46/* * * */
47/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
48
49/* Subroutine */ int mcsqb1_(integer *lot, integer *jump, integer *n, integer
50 *inc, doublereal *x, doublereal *wsave, doublereal *work, integer *
51 ier)
52{
53 /* System generated locals */
54 integer x_dim1, x_offset, work_dim1, work_offset, i__1, i__2, i__3;
55
56 /* Builtin functions */
57 double log(doublereal);
58
59 /* Local variables */
60 integer i__, k, m, m1, kc, lj, np2, ns2, ier1;
61 doublereal xim1;
62 integer modn, lenx, lnwk, lnsv;
63 extern /* Subroutine */ int rfftmb_(integer *, integer *, integer *,
65 doublereal *, integer *, integer *), xerfft_(char *, integer *,
66 ftnlen);
67
68 /* Parameter adjustments */
69 work_dim1 = *lot;
70 work_offset = 1 + work_dim1;
71 work -= work_offset;
72 x_dim1 = *inc;
73 x_offset = 1 + x_dim1;
74 x -= x_offset;
75 --wsave;
76
77 /* Function Body */
78 *ier = 0;
79 lj = (*lot - 1) * *jump + 1;
80 ns2 = (*n + 1) / 2;
81 np2 = *n + 2;
82 i__1 = *n;
83 for (i__ = 3; i__ <= i__1; i__ += 2) {
84 i__2 = lj;
85 i__3 = *jump;
86 for (m = 1; i__3 < 0 ? m >= i__2 : m <= i__2; m += i__3) {
87 xim1 = x[m + (i__ - 1) * x_dim1] + x[m + i__ * x_dim1];
88 x[m + i__ * x_dim1] = (x[m + (i__ - 1) * x_dim1] - x[m + i__ *
89 x_dim1]) * .5;
90 x[m + (i__ - 1) * x_dim1] = xim1 * .5;
91/* L201: */
92 }
93/* L101: */
94 }
95 i__1 = lj;
96 i__3 = *jump;
97 for (m = 1; i__3 < 0 ? m >= i__1 : m <= i__1; m += i__3) {
98 x[m + x_dim1] *= .5;
99/* L301: */
100 }
101 modn = *n % 2;
102 if (modn != 0) {
103 goto L302;
104 }
105 i__3 = lj;
106 i__1 = *jump;
107 for (m = 1; i__1 < 0 ? m >= i__3 : m <= i__3; m += i__1) {
108 x[m + *n * x_dim1] *= .5;
109/* L303: */
110 }
111L302:
112 lenx = (*lot - 1) * *jump + *inc * (*n - 1) + 1;
113 lnsv = *n + (integer) (log((doublereal) (*n)) / log(2.)) + 4;
114 lnwk = *lot * *n;
115
116 rfftmb_(lot, jump, n, inc, &x[x_offset], &lenx, &wsave[*n + 1], &lnsv, &
117 work[work_offset], &lnwk, &ier1);
118 if (ier1 != 0) {
119 *ier = 20;
120 xerfft_("MCSQB1", &c_n5, (ftnlen)6);
121 goto L400;
122 }
123
124 i__1 = ns2;
125 for (k = 2; k <= i__1; ++k) {
126 kc = np2 - k;
127 m1 = 0;
128 i__3 = lj;
129 i__2 = *jump;
130 for (m = 1; i__2 < 0 ? m >= i__3 : m <= i__3; m += i__2) {
131 ++m1;
132 work[m1 + k * work_dim1] = wsave[k - 1] * x[m + kc * x_dim1] +
133 wsave[kc - 1] * x[m + k * x_dim1];
134 work[m1 + kc * work_dim1] = wsave[k - 1] * x[m + k * x_dim1] -
135 wsave[kc - 1] * x[m + kc * x_dim1];
136/* L202: */
137 }
138/* L102: */
139 }
140 if (modn != 0) {
141 goto L305;
142 }
143 i__1 = lj;
144 i__2 = *jump;
145 for (m = 1; i__2 < 0 ? m >= i__1 : m <= i__1; m += i__2) {
146 x[m + (ns2 + 1) * x_dim1] = wsave[ns2] * (x[m + (ns2 + 1) * x_dim1] +
147 x[m + (ns2 + 1) * x_dim1]);
148/* L304: */
149 }
150L305:
151 i__2 = ns2;
152 for (k = 2; k <= i__2; ++k) {
153 kc = np2 - k;
154 m1 = 0;
155 i__1 = lj;
156 i__3 = *jump;
157 for (m = 1; i__3 < 0 ? m >= i__1 : m <= i__1; m += i__3) {
158 ++m1;
159 x[m + k * x_dim1] = work[m1 + k * work_dim1] + work[m1 + kc *
160 work_dim1];
161 x[m + kc * x_dim1] = work[m1 + k * work_dim1] - work[m1 + kc *
162 work_dim1];
163/* L203: */
164 }
165/* L103: */
166 }
167 i__2 = lj;
168 i__3 = *jump;
169 for (m = 1; i__3 < 0 ? m >= i__2 : m <= i__2; m += i__3) {
170 x[m + x_dim1] += x[m + x_dim1];
171/* L104: */
172 }
173L400:
174 return 0;
175} /* mcsqb1_ */
176