1 /* vector/gsl_vector_complex_double.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_DOUBLE_H__
21 #define __GSL_VECTOR_COMPLEX_DOUBLE_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_double.h>
29 #include <gsl/gsl_vector_complex.h>
30 #include <gsl/gsl_block_complex_double.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 *block;
55 gsl_vector_complex vector;
56 } _gsl_vector_complex_view;
58 typedef _gsl_vector_complex_view gsl_vector_complex_view;
62 gsl_vector_complex vector;
63 } _gsl_vector_complex_const_view;
65 typedef const _gsl_vector_complex_const_view gsl_vector_complex_const_view;
69 gsl_vector_complex *gsl_vector_complex_alloc (const size_t n);
70 gsl_vector_complex *gsl_vector_complex_calloc (const size_t n);
73 gsl_vector_complex_alloc_from_block (gsl_block_complex * b,
79 gsl_vector_complex_alloc_from_vector (gsl_vector_complex * v,
84 void gsl_vector_complex_free (gsl_vector_complex * v);
88 _gsl_vector_complex_view
89 gsl_vector_complex_view_array (double *base,
92 _gsl_vector_complex_view
93 gsl_vector_complex_view_array_with_stride (double *base,
97 _gsl_vector_complex_const_view
98 gsl_vector_complex_const_view_array (const double *base,
101 _gsl_vector_complex_const_view
102 gsl_vector_complex_const_view_array_with_stride (const double *base,
106 _gsl_vector_complex_view
107 gsl_vector_complex_subvector (gsl_vector_complex *base,
112 _gsl_vector_complex_view
113 gsl_vector_complex_subvector_with_stride (gsl_vector_complex *v,
118 _gsl_vector_complex_const_view
119 gsl_vector_complex_const_subvector (const gsl_vector_complex *base,
124 _gsl_vector_complex_const_view
125 gsl_vector_complex_const_subvector_with_stride (const gsl_vector_complex *v,
131 gsl_vector_complex_real (gsl_vector_complex *v);
134 gsl_vector_complex_imag (gsl_vector_complex *v);
136 _gsl_vector_const_view
137 gsl_vector_complex_const_real (const gsl_vector_complex *v);
139 _gsl_vector_const_view
140 gsl_vector_complex_const_imag (const gsl_vector_complex *v);
145 void gsl_vector_complex_set_zero (gsl_vector_complex * v);
146 void gsl_vector_complex_set_all (gsl_vector_complex * v,
148 int gsl_vector_complex_set_basis (gsl_vector_complex * v, size_t i);
150 int gsl_vector_complex_fread (FILE * stream,
151 gsl_vector_complex * v);
152 int gsl_vector_complex_fwrite (FILE * stream,
153 const gsl_vector_complex * v);
154 int gsl_vector_complex_fscanf (FILE * stream,
155 gsl_vector_complex * v);
156 int gsl_vector_complex_fprintf (FILE * stream,
157 const gsl_vector_complex * v,
160 int gsl_vector_complex_memcpy (gsl_vector_complex * dest, const gsl_vector_complex * src);
162 int gsl_vector_complex_reverse (gsl_vector_complex * v);
164 int gsl_vector_complex_swap (gsl_vector_complex * v, gsl_vector_complex * w);
165 int gsl_vector_complex_swap_elements (gsl_vector_complex * v, const size_t i, const size_t j);
167 int gsl_vector_complex_equal (const gsl_vector_complex * u,
168 const gsl_vector_complex * v);
170 int gsl_vector_complex_isnull (const gsl_vector_complex * v);
171 int gsl_vector_complex_ispos (const gsl_vector_complex * v);
172 int gsl_vector_complex_isneg (const gsl_vector_complex * v);
173 int gsl_vector_complex_isnonneg (const gsl_vector_complex * v);
175 int gsl_vector_complex_add (gsl_vector_complex * a, const gsl_vector_complex * b);
176 int gsl_vector_complex_sub (gsl_vector_complex * a, const gsl_vector_complex * b);
177 int gsl_vector_complex_mul (gsl_vector_complex * a, const gsl_vector_complex * b);
178 int gsl_vector_complex_div (gsl_vector_complex * a, const gsl_vector_complex * b);
179 int gsl_vector_complex_scale (gsl_vector_complex * a, const gsl_complex x);
180 int gsl_vector_complex_add_constant (gsl_vector_complex * a, const gsl_complex x);
181 int gsl_vector_complex_axpby (const gsl_complex alpha, const gsl_vector_complex * x, const gsl_complex beta, gsl_vector_complex * y);
183 INLINE_DECL gsl_complex gsl_vector_complex_get (const gsl_vector_complex * v, const size_t i);
184 INLINE_DECL void gsl_vector_complex_set (gsl_vector_complex * v, const size_t i, gsl_complex z);
185 INLINE_DECL gsl_complex *gsl_vector_complex_ptr (gsl_vector_complex * v, const size_t i);
186 INLINE_DECL const gsl_complex *gsl_vector_complex_const_ptr (const gsl_vector_complex * v, const size_t i);
192 gsl_vector_complex_get (const gsl_vector_complex * v,
196 if (GSL_RANGE_COND(i >= v->size))
198 gsl_complex zero = {{0, 0}};
199 GSL_ERROR_VAL ("index out of range", GSL_EINVAL, zero);
202 return *GSL_COMPLEX_AT (v, i);
207 gsl_vector_complex_set (gsl_vector_complex * v,
208 const size_t i, gsl_complex z)
211 if (GSL_RANGE_COND(i >= v->size))
213 GSL_ERROR_VOID ("index out of range", GSL_EINVAL);
216 *GSL_COMPLEX_AT (v, i) = z;
221 gsl_vector_complex_ptr (gsl_vector_complex * v,
225 if (GSL_RANGE_COND(i >= v->size))
227 GSL_ERROR_NULL ("index out of range", GSL_EINVAL);
230 return GSL_COMPLEX_AT (v, i);
235 gsl_vector_complex_const_ptr (const gsl_vector_complex * v,
239 if (GSL_RANGE_COND(i >= v->size))
241 GSL_ERROR_NULL ("index out of range", GSL_EINVAL);
244 return GSL_COMPLEX_AT (v, i);
248 #endif /* HAVE_INLINE */
252 #endif /* __GSL_VECTOR_COMPLEX_DOUBLE_H__ */