PLaSK library
Loading...
Searching...
No Matches
cosqmb.c
Go to the documentation of this file.
1/* cosqmb.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 cosqmb_(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;
59
60 /* Builtin functions */
61 double log(doublereal), sqrt(doublereal);
62
63 /* Local variables */
64 integer m;
65 doublereal x1;
66 integer lj, ier1;
67 extern /* Subroutine */ int mcsqb1_(integer *, integer *, integer *,
69 doublereal ssqrt2;
70 extern logical xercon_(integer *, integer *, integer *, integer *);
71 extern /* Subroutine */ int xerfft_(char *, integer *, ftnlen);
72
73
74 /* Parameter adjustments */
75 x_dim1 = *inc;
76 x_offset = 1 + x_dim1;
77 x -= x_offset;
78 --wsave;
79 --work;
80
81 /* Function Body */
82 *ier = 0;
83
84 if (*lenx < (*lot - 1) * *jump + *inc * (*n - 1) + 1) {
85 *ier = 1;
86 xerfft_("COSQMB", &c__6, (ftnlen)6);
87 goto L300;
88 } else if (*lensav < (*n << 1) + (integer) (log((doublereal) (*n)) / log(
89 2.)) + 4) {
90 *ier = 2;
91 xerfft_("COSQMB", &c__8, (ftnlen)6);
92 goto L300;
93 } else if (*lenwrk < *lot * *n) {
94 *ier = 3;
95 xerfft_("COSQMB", &c__10, (ftnlen)6);
96 goto L300;
97 } else if (! xercon_(inc, jump, n, lot)) {
98 *ier = 4;
99 xerfft_("COSQMB", &c_n1, (ftnlen)6);
100 goto L300;
101 }
102
103 lj = (*lot - 1) * *jump + 1;
104 if ((i__1 = *n - 2) < 0) {
105 goto L101;
106 } else if (i__1 == 0) {
107 goto L102;
108 } else {
109 goto L103;
110 }
111L101:
112 i__1 = lj;
113 i__2 = *jump;
114 for (m = 1; i__2 < 0 ? m >= i__1 : m <= i__1; m += i__2) {
115 x[m + x_dim1] = x[m + x_dim1];
116/* L201: */
117 }
118 return 0;
119L102:
120 ssqrt2 = 1. / sqrt(2.);
121 i__2 = lj;
122 i__1 = *jump;
123 for (m = 1; i__1 < 0 ? m >= i__2 : m <= i__2; m += i__1) {
124 x1 = x[m + x_dim1] + x[m + (x_dim1 << 1)];
125 x[m + (x_dim1 << 1)] = ssqrt2 * (x[m + x_dim1] - x[m + (x_dim1 << 1)])
126 ;
127 x[m + x_dim1] = x1;
128/* L202: */
129 }
130 return 0;
131L103:
132 mcsqb1_(lot, jump, n, inc, &x[x_offset], &wsave[1], &work[1], &ier1);
133 if (ier1 != 0) {
134 *ier = 20;
135 xerfft_("COSQMB", &c_n5, (ftnlen)6);
136 }
137
138L300:
139 return 0;
140} /* cosqmb_ */
141