Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/gsl/gsl_vector_complex_float.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /* vector/gsl_vector_complex_float.h
0002  * 
0003  * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough
0004  * 
0005  * This program is free software; you can redistribute it and/or modify
0006  * it under the terms of the GNU General Public License as published by
0007  * the Free Software Foundation; either version 3 of the License, or (at
0008  * your option) any later version.
0009  * 
0010  * This program is distributed in the hope that it will be useful, but
0011  * WITHOUT ANY WARRANTY; without even the implied warranty of
0012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0013  * General Public License for more details.
0014  * 
0015  * You should have received a copy of the GNU General Public License
0016  * along with this program; if not, write to the Free Software
0017  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0018  */
0019 
0020 #ifndef __GSL_VECTOR_COMPLEX_FLOAT_H__
0021 #define __GSL_VECTOR_COMPLEX_FLOAT_H__
0022 
0023 #include <stdlib.h>
0024 #include <gsl/gsl_types.h>
0025 #include <gsl/gsl_errno.h>
0026 #include <gsl/gsl_complex.h>
0027 #include <gsl/gsl_check_range.h>
0028 #include <gsl/gsl_vector_float.h>
0029 #include <gsl/gsl_vector_complex.h>
0030 #include <gsl/gsl_block_complex_float.h>
0031 
0032 #undef __BEGIN_DECLS
0033 #undef __END_DECLS
0034 #ifdef __cplusplus
0035 # define __BEGIN_DECLS extern "C" {
0036 # define __END_DECLS }
0037 #else
0038 # define __BEGIN_DECLS /* empty */
0039 # define __END_DECLS /* empty */
0040 #endif
0041 
0042 __BEGIN_DECLS
0043 
0044 typedef struct 
0045 {
0046   size_t size;
0047   size_t stride;
0048   float *data;
0049   gsl_block_complex_float *block;
0050   int owner;
0051 } gsl_vector_complex_float;
0052 
0053 typedef struct
0054 {
0055   gsl_vector_complex_float vector;
0056 } _gsl_vector_complex_float_view;
0057 
0058 typedef _gsl_vector_complex_float_view gsl_vector_complex_float_view;
0059 
0060 typedef struct
0061 {
0062   gsl_vector_complex_float vector;
0063 } _gsl_vector_complex_float_const_view;
0064 
0065 typedef const _gsl_vector_complex_float_const_view gsl_vector_complex_float_const_view;
0066 
0067 /* Allocation */
0068 
0069 gsl_vector_complex_float *gsl_vector_complex_float_alloc (const size_t n);
0070 gsl_vector_complex_float *gsl_vector_complex_float_calloc (const size_t n);
0071 
0072 gsl_vector_complex_float *
0073 gsl_vector_complex_float_alloc_from_block (gsl_block_complex_float * b, 
0074                                            const size_t offset, 
0075                                            const size_t n, 
0076                                            const size_t stride);
0077 
0078 gsl_vector_complex_float *
0079 gsl_vector_complex_float_alloc_from_vector (gsl_vector_complex_float * v, 
0080                                              const size_t offset, 
0081                                              const size_t n, 
0082                                              const size_t stride);
0083 
0084 void gsl_vector_complex_float_free (gsl_vector_complex_float * v);
0085 
0086 /* Views */
0087 
0088 _gsl_vector_complex_float_view
0089 gsl_vector_complex_float_view_array (float *base,
0090                                      size_t n);
0091 
0092 _gsl_vector_complex_float_view
0093 gsl_vector_complex_float_view_array_with_stride (float *base,
0094                                                  size_t stride,
0095                                                  size_t n);
0096 
0097 _gsl_vector_complex_float_const_view
0098 gsl_vector_complex_float_const_view_array (const float *base,
0099                                            size_t n);
0100 
0101 _gsl_vector_complex_float_const_view
0102 gsl_vector_complex_float_const_view_array_with_stride (const float *base,
0103                                                        size_t stride,
0104                                                        size_t n);
0105 
0106 _gsl_vector_complex_float_view
0107 gsl_vector_complex_float_subvector (gsl_vector_complex_float *base,
0108                                          size_t i, 
0109                                          size_t n);
0110 
0111 
0112 _gsl_vector_complex_float_view 
0113 gsl_vector_complex_float_subvector_with_stride (gsl_vector_complex_float *v, 
0114                                                 size_t i, 
0115                                                 size_t stride, 
0116                                                 size_t n);
0117 
0118 _gsl_vector_complex_float_const_view
0119 gsl_vector_complex_float_const_subvector (const gsl_vector_complex_float *base,
0120                                                size_t i, 
0121                                                size_t n);
0122 
0123 
0124 _gsl_vector_complex_float_const_view 
0125 gsl_vector_complex_float_const_subvector_with_stride (const gsl_vector_complex_float *v, 
0126                                                       size_t i, 
0127                                                       size_t stride, 
0128                                                       size_t n);
0129 
0130 _gsl_vector_float_view
0131 gsl_vector_complex_float_real (gsl_vector_complex_float *v);
0132 
0133 _gsl_vector_float_view 
0134 gsl_vector_complex_float_imag (gsl_vector_complex_float *v);
0135 
0136 _gsl_vector_float_const_view
0137 gsl_vector_complex_float_const_real (const gsl_vector_complex_float *v);
0138 
0139 _gsl_vector_float_const_view 
0140 gsl_vector_complex_float_const_imag (const gsl_vector_complex_float *v);
0141 
0142 
0143 /* Operations */
0144 
0145 void gsl_vector_complex_float_set_zero (gsl_vector_complex_float * v);
0146 void gsl_vector_complex_float_set_all (gsl_vector_complex_float * v,
0147                                        gsl_complex_float z);
0148 int gsl_vector_complex_float_set_basis (gsl_vector_complex_float * v, size_t i);
0149 
0150 int gsl_vector_complex_float_fread (FILE * stream,
0151                                     gsl_vector_complex_float * v);
0152 int gsl_vector_complex_float_fwrite (FILE * stream,
0153                                      const gsl_vector_complex_float * v);
0154 int gsl_vector_complex_float_fscanf (FILE * stream,
0155                                      gsl_vector_complex_float * v);
0156 int gsl_vector_complex_float_fprintf (FILE * stream,
0157                                       const gsl_vector_complex_float * v,
0158                                       const char *format);
0159 
0160 int gsl_vector_complex_float_memcpy (gsl_vector_complex_float * dest, const gsl_vector_complex_float * src);
0161 int gsl_vector_complex_float_conj_memcpy (gsl_vector_complex_float * dest, const gsl_vector_complex_float * src);
0162 
0163 int gsl_vector_complex_float_reverse (gsl_vector_complex_float * v);
0164 
0165 int gsl_vector_complex_float_swap (gsl_vector_complex_float * v, gsl_vector_complex_float * w);
0166 int gsl_vector_complex_float_swap_elements (gsl_vector_complex_float * v, const size_t i, const size_t j);
0167 
0168 int gsl_vector_complex_float_equal (const gsl_vector_complex_float * u, 
0169                                     const gsl_vector_complex_float * v);
0170 
0171 int gsl_vector_complex_float_isnull (const gsl_vector_complex_float * v);
0172 int gsl_vector_complex_float_ispos (const gsl_vector_complex_float * v);
0173 int gsl_vector_complex_float_isneg (const gsl_vector_complex_float * v);
0174 int gsl_vector_complex_float_isnonneg (const gsl_vector_complex_float * v);
0175 
0176 int gsl_vector_complex_float_add (gsl_vector_complex_float * a, const gsl_vector_complex_float * b);
0177 int gsl_vector_complex_float_sub (gsl_vector_complex_float * a, const gsl_vector_complex_float * b);
0178 int gsl_vector_complex_float_mul (gsl_vector_complex_float * a, const gsl_vector_complex_float * b);
0179 int gsl_vector_complex_float_div (gsl_vector_complex_float * a, const gsl_vector_complex_float * b);
0180 int gsl_vector_complex_float_scale (gsl_vector_complex_float * a, const gsl_complex_float x);
0181 int gsl_vector_complex_float_add_constant (gsl_vector_complex_float * a, const gsl_complex_float x);
0182 int gsl_vector_complex_float_axpby (const gsl_complex_float alpha, const gsl_vector_complex_float * x, const gsl_complex_float beta, gsl_vector_complex_float * y);
0183 
0184 int gsl_vector_complex_float_div_real (gsl_vector_complex_float * a, const gsl_vector_float * b);
0185 
0186 INLINE_DECL gsl_complex_float gsl_vector_complex_float_get (const gsl_vector_complex_float * v, const size_t i);
0187 INLINE_DECL void gsl_vector_complex_float_set (gsl_vector_complex_float * v, const size_t i, gsl_complex_float z);
0188 INLINE_DECL gsl_complex_float *gsl_vector_complex_float_ptr (gsl_vector_complex_float * v, const size_t i);
0189 INLINE_DECL const gsl_complex_float *gsl_vector_complex_float_const_ptr (const gsl_vector_complex_float * v, const size_t i);
0190 
0191 #ifdef HAVE_INLINE
0192 
0193 INLINE_FUN
0194 gsl_complex_float
0195 gsl_vector_complex_float_get (const gsl_vector_complex_float * v,
0196                               const size_t i)
0197 {
0198 #if GSL_RANGE_CHECK
0199   if (GSL_RANGE_COND(i >= v->size))
0200     {
0201       gsl_complex_float zero = {{0, 0}};
0202       GSL_ERROR_VAL ("index out of range", GSL_EINVAL, zero);
0203     }
0204 #endif
0205   return *GSL_COMPLEX_FLOAT_AT (v, i);
0206 }
0207 
0208 INLINE_FUN
0209 void
0210 gsl_vector_complex_float_set (gsl_vector_complex_float * v,
0211                               const size_t i, gsl_complex_float z)
0212 {
0213 #if GSL_RANGE_CHECK
0214   if (GSL_RANGE_COND(i >= v->size))
0215     {
0216       GSL_ERROR_VOID ("index out of range", GSL_EINVAL);
0217     }
0218 #endif
0219   *GSL_COMPLEX_FLOAT_AT (v, i) = z;
0220 }
0221 
0222 INLINE_FUN
0223 gsl_complex_float *
0224 gsl_vector_complex_float_ptr (gsl_vector_complex_float * v,
0225                               const size_t i)
0226 {
0227 #if GSL_RANGE_CHECK
0228   if (GSL_RANGE_COND(i >= v->size))
0229     {
0230       GSL_ERROR_NULL ("index out of range", GSL_EINVAL);
0231     }
0232 #endif
0233   return GSL_COMPLEX_FLOAT_AT (v, i);
0234 }
0235 
0236 INLINE_FUN
0237 const gsl_complex_float *
0238 gsl_vector_complex_float_const_ptr (const gsl_vector_complex_float * v,
0239                                     const size_t i)
0240 {
0241 #if GSL_RANGE_CHECK
0242   if (GSL_RANGE_COND(i >= v->size))
0243     {
0244       GSL_ERROR_NULL ("index out of range", GSL_EINVAL);
0245     }
0246 #endif
0247   return GSL_COMPLEX_FLOAT_AT (v, i);
0248 }
0249 
0250 
0251 #endif /* HAVE_INLINE */
0252 
0253 __END_DECLS
0254 
0255 #endif /* __GSL_VECTOR_COMPLEX_FLOAT_H__ */