PLaSK library
Loading...
Searching...
No Matches
sinqmb.c
Go to the documentation of this file.
1/* sinqmb.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__6 = 6;
18static integer c__8 = 8;
19static integer c__10 = 10;
20static integer c_n1 = -1;
21static integer c_n5 = -5;
22
23/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
24/* * * */
25/* * copyright (c) 2011 by UCAR * */
26/* * * */
27/* * University Corporation for Atmospheric Research * */
28/* * * */
29/* * all rights reserved * */
30/* * * */
31/* * FFTPACK version 5.1 * */
32/* * * */
33/* * A Fortran Package of Fast Fourier * */
34/* * * */
35/* * Subroutines and Example Programs * */
36/* * * */
37/* * by * */
38/* * * */
39/* * Paul Swarztrauber and Dick Valent * */
40/* * * */
41/* * of * */
42/* * * */
43/* * the National Center for Atmospheric Research * */
44/* * * */
45/* * Boulder, Colorado (80307) U.S.A. * */
46/* * * */
47/* * which is sponsored by * */
48/* * * */
49/* * the National Science Foundation * */
50/* * * */
51/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
52
53/* Subroutine */ int sinqmb_(integer *lot, integer *jump, integer *n, integer
54 *inc, doublereal *x, integer *lenx, doublereal *wsave, integer *
55 lensav, doublereal *work, integer *lenwrk, integer *ier)
56{
57 /* System generated locals */
58 integer x_dim1, x_offset, i__1, i__2, i__3;
59
60 /* Builtin functions */
61 double log(doublereal);
62
63 /* Local variables */
64 integer k, m, kc, lj, ns2, ier1;
65 doublereal xhold;
66 extern /* Subroutine */ int cosqmb_(integer *, integer *, integer *,
68 doublereal *, integer *, integer *);
69 extern logical xercon_(integer *, integer *, integer *, integer *);
70 extern /* Subroutine */ int xerfft_(char *, integer *, ftnlen);
71
72
73 /* Parameter adjustments */
74 x_dim1 = *inc;
75 x_offset = 1 + x_dim1;
76 x -= x_offset;
77 --wsave;
78 --work;
79
80 /* Function Body */
81 *ier = 0;
82
83 if (*lenx < (*lot - 1) * *jump + *inc * (*n - 1) + 1) {
84 *ier = 1;
85 xerfft_("SINQMB", &c__6, (ftnlen)6);
86 } else if (*lensav < (*n << 1) + (integer) (log((doublereal) (*n)) / log(
87 2.)) + 4) {
88 *ier = 2;
89 xerfft_("SINQMB", &c__8, (ftnlen)6);
90 } else if (*lenwrk < *lot * *n) {
91 *ier = 3;
92 xerfft_("SINQMB", &c__10, (ftnlen)6);
93 } else if (! xercon_(inc, jump, n, lot)) {
94 *ier = 4;
95 xerfft_("SINQMB", &c_n1, (ftnlen)6);
96 }
97
98 lj = (*lot - 1) * *jump + 1;
99 if (*n > 1) {
100 goto L101;
101 }
102 i__1 = lj;
103 i__2 = *jump;
104 for (m = 1; i__2 < 0 ? m >= i__1 : m <= i__1; m += i__2) {
105 x[m + x_dim1] *= 4.;
106/* L201: */
107 }
108 return 0;
109L101:
110 ns2 = *n / 2;
111 i__2 = *n;
112 for (k = 2; k <= i__2; k += 2) {
113 i__1 = lj;
114 i__3 = *jump;
115 for (m = 1; i__3 < 0 ? m >= i__1 : m <= i__1; m += i__3) {
116 x[m + k * x_dim1] = -x[m + k * x_dim1];
117/* L202: */
118 }
119/* L102: */
120 }
121 cosqmb_(lot, jump, n, inc, &x[x_offset], lenx, &wsave[1], lensav, &work[1]
122 , lenwrk, &ier1);
123 if (ier1 != 0) {
124 *ier = 20;
125 xerfft_("SINQMB", &c_n5, (ftnlen)6);
126 goto L300;
127 }
128 i__2 = ns2;
129 for (k = 1; k <= i__2; ++k) {
130 kc = *n - k;
131 i__3 = lj;
132 i__1 = *jump;
133 for (m = 1; i__1 < 0 ? m >= i__3 : m <= i__3; m += i__1) {
134 xhold = x[m + k * x_dim1];
135 x[m + k * x_dim1] = x[m + (kc + 1) * x_dim1];
136 x[m + (kc + 1) * x_dim1] = xhold;
137/* L203: */
138 }
139/* L103: */
140 }
141L300:
142 return 0;
143} /* sinqmb_ */
144