PLaSK library
Loading...
Searching...
No Matches
mcsqf1.c
Go to the documentation of this file.
1/* mcsqf1.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 mcsqf1_(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 rfftmf_(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 = ns2;
83 for (k = 2; k <= i__1; ++k) {
84 kc = np2 - k;
85 m1 = 0;
86 i__2 = lj;
87 i__3 = *jump;
88 for (m = 1; i__3 < 0 ? m >= i__2 : m <= i__2; m += i__3) {
89 ++m1;
90 work[m1 + k * work_dim1] = x[m + k * x_dim1] + x[m + kc * x_dim1];
91 work[m1 + kc * work_dim1] = x[m + k * x_dim1] - x[m + kc * x_dim1]
92 ;
93/* L201: */
94 }
95/* L101: */
96 }
97 modn = *n % 2;
98 if (modn != 0) {
99 goto L301;
100 }
101 m1 = 0;
102 i__1 = lj;
103 i__3 = *jump;
104 for (m = 1; i__3 < 0 ? m >= i__1 : m <= i__1; m += i__3) {
105 ++m1;
106 work[m1 + (ns2 + 1) * work_dim1] = x[m + (ns2 + 1) * x_dim1] + x[m + (
107 ns2 + 1) * x_dim1];
108/* L202: */
109 }
110L301:
111 i__3 = ns2;
112 for (k = 2; k <= i__3; ++k) {
113 kc = np2 - k;
114 m1 = 0;
115 i__1 = lj;
116 i__2 = *jump;
117 for (m = 1; i__2 < 0 ? m >= i__1 : m <= i__1; m += i__2) {
118 ++m1;
119 x[m + k * x_dim1] = wsave[k - 1] * work[m1 + kc * work_dim1] +
120 wsave[kc - 1] * work[m1 + k * work_dim1];
121 x[m + kc * x_dim1] = wsave[k - 1] * work[m1 + k * work_dim1] -
122 wsave[kc - 1] * work[m1 + kc * work_dim1];
123/* L302: */
124 }
125/* L102: */
126 }
127 if (modn != 0) {
128 goto L303;
129 }
130 m1 = 0;
131 i__3 = lj;
132 i__2 = *jump;
133 for (m = 1; i__2 < 0 ? m >= i__3 : m <= i__3; m += i__2) {
134 ++m1;
135 x[m + (ns2 + 1) * x_dim1] = wsave[ns2] * work[m1 + (ns2 + 1) *
136 work_dim1];
137/* L304: */
138 }
139L303:
140 lenx = (*lot - 1) * *jump + *inc * (*n - 1) + 1;
141 lnsv = *n + (integer) (log((doublereal) (*n)) / log(2.)) + 4;
142 lnwk = *lot * *n;
143
144 rfftmf_(lot, jump, n, inc, &x[x_offset], &lenx, &wsave[*n + 1], &lnsv, &
145 work[work_offset], &lnwk, &ier1);
146 if (ier1 != 0) {
147 *ier = 20;
148 xerfft_("MCSQF1", &c_n5, (ftnlen)6);
149 goto L400;
150 }
151
152 i__2 = *n;
153 for (i__ = 3; i__ <= i__2; i__ += 2) {
154 i__3 = lj;
155 i__1 = *jump;
156 for (m = 1; i__1 < 0 ? m >= i__3 : m <= i__3; m += i__1) {
157 xim1 = (x[m + (i__ - 1) * x_dim1] + x[m + i__ * x_dim1]) * .5;
158 x[m + i__ * x_dim1] = (x[m + (i__ - 1) * x_dim1] - x[m + i__ *
159 x_dim1]) * .5;
160 x[m + (i__ - 1) * x_dim1] = xim1;
161/* L203: */
162 }
163/* L103: */
164 }
165L400:
166 return 0;
167} /* mcsqf1_ */
168