1 /* vector/gsl_vector_long_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_LONG_DOUBLE_H__
21 #define __GSL_VECTOR_LONG_DOUBLE_H__
24 #include <gsl/gsl_types.h>
25 #include <gsl/gsl_errno.h>
26 #include <gsl/gsl_check_range.h>
27 #include <gsl/gsl_block_long_double.h>
32 # define __BEGIN_DECLS extern "C" {
33 # define __END_DECLS }
35 # define __BEGIN_DECLS /* empty */
36 # define __END_DECLS /* empty */
46 gsl_block_long_double *block;
49 gsl_vector_long_double;
53 gsl_vector_long_double vector;
54 } _gsl_vector_long_double_view;
56 typedef _gsl_vector_long_double_view gsl_vector_long_double_view;
60 gsl_vector_long_double vector;
61 } _gsl_vector_long_double_const_view;
63 typedef const _gsl_vector_long_double_const_view gsl_vector_long_double_const_view;
68 gsl_vector_long_double *gsl_vector_long_double_alloc (const size_t n);
69 gsl_vector_long_double *gsl_vector_long_double_calloc (const size_t n);
71 gsl_vector_long_double *gsl_vector_long_double_alloc_from_block (gsl_block_long_double * b,
76 gsl_vector_long_double *gsl_vector_long_double_alloc_from_vector (gsl_vector_long_double * v,
81 void gsl_vector_long_double_free (gsl_vector_long_double * v);
85 _gsl_vector_long_double_view
86 gsl_vector_long_double_view_array (long double *v, size_t n);
88 _gsl_vector_long_double_view
89 gsl_vector_long_double_view_array_with_stride (long double *base,
93 _gsl_vector_long_double_const_view
94 gsl_vector_long_double_const_view_array (const long double *v, size_t n);
96 _gsl_vector_long_double_const_view
97 gsl_vector_long_double_const_view_array_with_stride (const long double *base,
101 _gsl_vector_long_double_view
102 gsl_vector_long_double_subvector (gsl_vector_long_double *v,
106 _gsl_vector_long_double_view
107 gsl_vector_long_double_subvector_with_stride (gsl_vector_long_double *v,
112 _gsl_vector_long_double_const_view
113 gsl_vector_long_double_const_subvector (const gsl_vector_long_double *v,
117 _gsl_vector_long_double_const_view
118 gsl_vector_long_double_const_subvector_with_stride (const gsl_vector_long_double *v,
125 long double gsl_vector_long_double_get (const gsl_vector_long_double * v, const size_t i);
126 void gsl_vector_long_double_set (gsl_vector_long_double * v, const size_t i, long double x);
128 long double *gsl_vector_long_double_ptr (gsl_vector_long_double * v, const size_t i);
129 const long double *gsl_vector_long_double_const_ptr (const gsl_vector_long_double * v, const size_t i);
131 void gsl_vector_long_double_set_zero (gsl_vector_long_double * v);
132 void gsl_vector_long_double_set_all (gsl_vector_long_double * v, long double x);
133 int gsl_vector_long_double_set_basis (gsl_vector_long_double * v, size_t i);
135 int gsl_vector_long_double_fread (FILE * stream, gsl_vector_long_double * v);
136 int gsl_vector_long_double_fwrite (FILE * stream, const gsl_vector_long_double * v);
137 int gsl_vector_long_double_fscanf (FILE * stream, gsl_vector_long_double * v);
138 int gsl_vector_long_double_fprintf (FILE * stream, const gsl_vector_long_double * v,
141 int gsl_vector_long_double_memcpy (gsl_vector_long_double * dest, const gsl_vector_long_double * src);
143 int gsl_vector_long_double_reverse (gsl_vector_long_double * v);
145 int gsl_vector_long_double_swap (gsl_vector_long_double * v, gsl_vector_long_double * w);
146 int gsl_vector_long_double_swap_elements (gsl_vector_long_double * v, const size_t i, const size_t j);
148 long double gsl_vector_long_double_max (const gsl_vector_long_double * v);
149 long double gsl_vector_long_double_min (const gsl_vector_long_double * v);
150 void gsl_vector_long_double_minmax (const gsl_vector_long_double * v, long double * min_out, long double * max_out);
152 size_t gsl_vector_long_double_max_index (const gsl_vector_long_double * v);
153 size_t gsl_vector_long_double_min_index (const gsl_vector_long_double * v);
154 void gsl_vector_long_double_minmax_index (const gsl_vector_long_double * v, size_t * imin, size_t * imax);
156 int gsl_vector_long_double_add (gsl_vector_long_double * a, const gsl_vector_long_double * b);
157 int gsl_vector_long_double_sub (gsl_vector_long_double * a, const gsl_vector_long_double * b);
158 int gsl_vector_long_double_mul (gsl_vector_long_double * a, const gsl_vector_long_double * b);
159 int gsl_vector_long_double_div (gsl_vector_long_double * a, const gsl_vector_long_double * b);
160 int gsl_vector_long_double_scale (gsl_vector_long_double * a, const double x);
161 int gsl_vector_long_double_add_constant (gsl_vector_long_double * a, const double x);
163 int gsl_vector_long_double_isnull (const gsl_vector_long_double * v);
164 int gsl_vector_long_double_ispos (const gsl_vector_long_double * v);
165 int gsl_vector_long_double_isneg (const gsl_vector_long_double * v);
166 int gsl_vector_long_double_isnonneg (const gsl_vector_long_double * v);
172 gsl_vector_long_double_get (const gsl_vector_long_double * v, const size_t i)
177 GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0);
180 return v->data[i * v->stride];
185 gsl_vector_long_double_set (gsl_vector_long_double * v, const size_t i, long double x)
190 GSL_ERROR_VOID ("index out of range", GSL_EINVAL);
193 v->data[i * v->stride] = x;
198 gsl_vector_long_double_ptr (gsl_vector_long_double * v, const size_t i)
203 GSL_ERROR_NULL ("index out of range", GSL_EINVAL);
206 return (long double *) (v->data + i * v->stride);
211 gsl_vector_long_double_const_ptr (const gsl_vector_long_double * v, const size_t i)
216 GSL_ERROR_NULL ("index out of range", GSL_EINVAL);
219 return (const long double *) (v->data + i * v->stride);
223 #endif /* HAVE_INLINE */
227 #endif /* __GSL_VECTOR_LONG_DOUBLE_H__ */