1 /* vector/gsl_vector_complex_float.h
3 * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or (at
8 * your option) any later version.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 #ifndef __GSL_VECTOR_COMPLEX_FLOAT_H__
21 #define __GSL_VECTOR_COMPLEX_FLOAT_H__
24 #include <gsl/gsl_types.h>
25 #include <gsl/gsl_errno.h>
26 #include <gsl/gsl_complex.h>
27 #include <gsl/gsl_check_range.h>
28 #include <gsl/gsl_vector_float.h>
29 #include <gsl/gsl_vector_complex.h>
30 #include <gsl/gsl_block_complex_float.h>
35 # define __BEGIN_DECLS extern "C" {
36 # define __END_DECLS }
38 # define __BEGIN_DECLS /* empty */
39 # define __END_DECLS /* empty */
49 gsl_block_complex_float *block;
51 } gsl_vector_complex_float;
55 gsl_vector_complex_float vector;
56 } _gsl_vector_complex_float_view;
58 typedef _gsl_vector_complex_float_view gsl_vector_complex_float_view;
62 gsl_vector_complex_float vector;
63 } _gsl_vector_complex_float_const_view;
65 typedef const _gsl_vector_complex_float_const_view gsl_vector_complex_float_const_view;
69 gsl_vector_complex_float *gsl_vector_complex_float_alloc (const size_t n);
70 gsl_vector_complex_float *gsl_vector_complex_float_calloc (const size_t n);
72 gsl_vector_complex_float *
73 gsl_vector_complex_float_alloc_from_block (gsl_block_complex_float * b,
78 gsl_vector_complex_float *
79 gsl_vector_complex_float_alloc_from_vector (gsl_vector_complex_float * v,
84 void gsl_vector_complex_float_free (gsl_vector_complex_float * v);
88 _gsl_vector_complex_float_view
89 gsl_vector_complex_float_view_array (float *base,
92 _gsl_vector_complex_float_view
93 gsl_vector_complex_float_view_array_with_stride (float *base,
97 _gsl_vector_complex_float_const_view
98 gsl_vector_complex_float_const_view_array (const float *base,
101 _gsl_vector_complex_float_const_view
102 gsl_vector_complex_float_const_view_array_with_stride (const float *base,
106 _gsl_vector_complex_float_view
107 gsl_vector_complex_float_subvector (gsl_vector_complex_float *base,
112 _gsl_vector_complex_float_view
113 gsl_vector_complex_float_subvector_with_stride (gsl_vector_complex_float *v,
118 _gsl_vector_complex_float_const_view
119 gsl_vector_complex_float_const_subvector (const gsl_vector_complex_float *base,
124 _gsl_vector_complex_float_const_view
125 gsl_vector_complex_float_const_subvector_with_stride (const gsl_vector_complex_float *v,
130 _gsl_vector_float_view
131 gsl_vector_complex_float_real (gsl_vector_complex_float *v);
133 _gsl_vector_float_view
134 gsl_vector_complex_float_imag (gsl_vector_complex_float *v);
136 _gsl_vector_float_const_view
137 gsl_vector_complex_float_const_real (const gsl_vector_complex_float *v);
139 _gsl_vector_float_const_view
140 gsl_vector_complex_float_const_imag (const gsl_vector_complex_float *v);
146 gsl_vector_complex_float_get (const gsl_vector_complex_float * v, const size_t i);
148 void gsl_vector_complex_float_set (gsl_vector_complex_float * v, const size_t i,
149 gsl_complex_float z);
152 *gsl_vector_complex_float_ptr (gsl_vector_complex_float * v, const size_t i);
154 const gsl_complex_float
155 *gsl_vector_complex_float_const_ptr (const gsl_vector_complex_float * v, const size_t i);
157 void gsl_vector_complex_float_set_zero (gsl_vector_complex_float * v);
158 void gsl_vector_complex_float_set_all (gsl_vector_complex_float * v,
159 gsl_complex_float z);
160 int gsl_vector_complex_float_set_basis (gsl_vector_complex_float * v, size_t i);
162 int gsl_vector_complex_float_fread (FILE * stream,
163 gsl_vector_complex_float * v);
164 int gsl_vector_complex_float_fwrite (FILE * stream,
165 const gsl_vector_complex_float * v);
166 int gsl_vector_complex_float_fscanf (FILE * stream,
167 gsl_vector_complex_float * v);
168 int gsl_vector_complex_float_fprintf (FILE * stream,
169 const gsl_vector_complex_float * v,
172 int gsl_vector_complex_float_memcpy (gsl_vector_complex_float * dest, const gsl_vector_complex_float * src);
174 int gsl_vector_complex_float_reverse (gsl_vector_complex_float * v);
176 int gsl_vector_complex_float_swap (gsl_vector_complex_float * v, gsl_vector_complex_float * w);
177 int gsl_vector_complex_float_swap_elements (gsl_vector_complex_float * v, const size_t i, const size_t j);
179 int gsl_vector_complex_float_isnull (const gsl_vector_complex_float * v);
180 int gsl_vector_complex_float_ispos (const gsl_vector_complex_float * v);
181 int gsl_vector_complex_float_isneg (const gsl_vector_complex_float * v);
187 gsl_vector_complex_float_get (const gsl_vector_complex_float * v,
193 gsl_complex_float zero = {{0, 0}};
194 GSL_ERROR_VAL ("index out of range", GSL_EINVAL, zero);
197 return *GSL_COMPLEX_FLOAT_AT (v, i);
202 gsl_vector_complex_float_set (gsl_vector_complex_float * v,
203 const size_t i, gsl_complex_float z)
208 GSL_ERROR_VOID ("index out of range", GSL_EINVAL);
211 *GSL_COMPLEX_FLOAT_AT (v, i) = z;
216 gsl_vector_complex_float_ptr (gsl_vector_complex_float * v,
222 GSL_ERROR_NULL ("index out of range", GSL_EINVAL);
225 return GSL_COMPLEX_FLOAT_AT (v, i);
229 const gsl_complex_float *
230 gsl_vector_complex_float_const_ptr (const gsl_vector_complex_float * v,
236 GSL_ERROR_NULL ("index out of range", GSL_EINVAL);
239 return GSL_COMPLEX_FLOAT_AT (v, i);
243 #endif /* HAVE_INLINE */
247 #endif /* __GSL_VECTOR_COMPLEX_FLOAT_H__ */