comparison src/DLD-FUNCTIONS/fftn.cc @ 10154:40dfc0c99116

DLD-FUNCTIONS/*.cc: untabify
author John W. Eaton <jwe@octave.org>
date Wed, 20 Jan 2010 17:33:41 -0500
parents 0ce82753dd72
children d0ce5e973937
comparison
equal deleted inserted replaced
10153:2c28f9d0360f 10154:40dfc0c99116
62 62
63 if (nargin > 1) 63 if (nargin > 1)
64 { 64 {
65 Matrix val = args(1).matrix_value (); 65 Matrix val = args(1).matrix_value ();
66 if (val.rows () > val.columns ()) 66 if (val.rows () > val.columns ())
67 val = val.transpose (); 67 val = val.transpose ();
68 68
69 if (error_state || val.columns () != dims.length () || val.rows () != 1) 69 if (error_state || val.columns () != dims.length () || val.rows () != 1)
70 error ("%s: second argument must be a vector of length dim", fcn); 70 error ("%s: second argument must be a vector of length dim", fcn);
71 else 71 else
72 { 72 {
73 for (int i = 0; i < dims.length (); i++) 73 for (int i = 0; i < dims.length (); i++)
74 { 74 {
75 if (xisnan (val(i,0))) 75 if (xisnan (val(i,0)))
76 error ("%s: NaN is invalid as a dimension", fcn); 76 error ("%s: NaN is invalid as a dimension", fcn);
77 else if (NINTbig (val(i,0)) < 0) 77 else if (NINTbig (val(i,0)) < 0)
78 error ("%s: all dimension must be greater than zero", fcn); 78 error ("%s: all dimension must be greater than zero", fcn);
79 else 79 else
80 { 80 {
81 dims(i) = NINTbig(val(i,0)); 81 dims(i) = NINTbig(val(i,0));
82 } 82 }
83 } 83 }
84 } 84 }
85 } 85 }
86 86
87 if (error_state) 87 if (error_state)
88 return retval; 88 return retval;
89 89
90 if (dims.all_zero ()) 90 if (dims.all_zero ())
91 { 91 {
92 if (arg.is_single_type ()) 92 if (arg.is_single_type ())
93 return octave_value (FloatMatrix ()); 93 return octave_value (FloatMatrix ());
94 else 94 else
95 return octave_value (Matrix ()); 95 return octave_value (Matrix ());
96 } 96 }
97 97
98 if (arg.is_single_type ()) 98 if (arg.is_single_type ())
99 { 99 {
100 if (arg.is_real_type ()) 100 if (arg.is_real_type ())
101 { 101 {
102 FloatNDArray nda = arg.float_array_value (); 102 FloatNDArray nda = arg.float_array_value ();
103 103
104 if (! error_state) 104 if (! error_state)
105 { 105 {
106 nda.resize (dims, 0.0); 106 nda.resize (dims, 0.0);
107 retval = (type != 0 ? nda.ifourierNd () : nda.fourierNd ()); 107 retval = (type != 0 ? nda.ifourierNd () : nda.fourierNd ());
108 } 108 }
109 } 109 }
110 else 110 else
111 { 111 {
112 FloatComplexNDArray cnda = arg.float_complex_array_value (); 112 FloatComplexNDArray cnda = arg.float_complex_array_value ();
113 113
114 if (! error_state) 114 if (! error_state)
115 { 115 {
116 cnda.resize (dims, 0.0); 116 cnda.resize (dims, 0.0);
117 retval = (type != 0 ? cnda.ifourierNd () : cnda.fourierNd ()); 117 retval = (type != 0 ? cnda.ifourierNd () : cnda.fourierNd ());
118 } 118 }
119 } 119 }
120 } 120 }
121 else 121 else
122 { 122 {
123 if (arg.is_real_type ()) 123 if (arg.is_real_type ())
124 { 124 {
125 NDArray nda = arg.array_value (); 125 NDArray nda = arg.array_value ();
126 126
127 if (! error_state) 127 if (! error_state)
128 { 128 {
129 nda.resize (dims, 0.0); 129 nda.resize (dims, 0.0);
130 retval = (type != 0 ? nda.ifourierNd () : nda.fourierNd ()); 130 retval = (type != 0 ? nda.ifourierNd () : nda.fourierNd ());
131 } 131 }
132 } 132 }
133 else if (arg.is_complex_type ()) 133 else if (arg.is_complex_type ())
134 { 134 {
135 ComplexNDArray cnda = arg.complex_array_value (); 135 ComplexNDArray cnda = arg.complex_array_value ();
136 136
137 if (! error_state) 137 if (! error_state)
138 { 138 {
139 cnda.resize (dims, 0.0); 139 cnda.resize (dims, 0.0);
140 retval = (type != 0 ? cnda.ifourierNd () : cnda.fourierNd ()); 140 retval = (type != 0 ? cnda.ifourierNd () : cnda.fourierNd ());
141 } 141 }
142 } 142 }
143 else 143 else
144 { 144 {
145 gripe_wrong_type_arg (fcn, arg); 145 gripe_wrong_type_arg (fcn, arg);
146 } 146 }
147 } 147 }
148 148
149 return retval; 149 return retval;
150 } 150 }
151 151