ccgsl  1.16.1
gsl::vector Class Reference

This class handles vector objects as shared handles. More...

#include <vector.hpp>

Inheritance diagram for gsl::vector:
Inheritance graph
Collaboration diagram for gsl::vector:
Collaboration graph

Classes

class  const_iterator_t
 A class template for the const iterators. More...
 
class  iterator_base
 The container must have iterator types. More...
 
class  iterator_t
 A class template for the two non-const iterators. More...
 

Public Types

typedef double value_type
 A container must have a value_type. More...
 
typedef value_typereference
 A container must have a reference type. More...
 
typedef value_type const & const_reference
 A container must have a constant reference type. More...
 
typedef value_typepointer
 A container must have a pointer type. More...
 
typedef value_type const * const_pointer
 A container must have a constant pointer type. More...
 
typedef const_iterator_t< false > const_iterator
 The const_iterator type. More...
 
typedef iterator_t< false > iterator
 The iterator type. More...
 
typedef const_iterator_t< true > const_reverse_iterator
 The const_reverse_t type. More...
 
typedef iterator_t< true > reverse_iterator
 The reverse_iterator type. More...
 
typedef const_iterator::difference_type difference_type
 A container must have a difference_type. More...
 
typedef size_t size_type
 A container must have a size_type. More...
 

Public Member Functions

 vector ()
 The default constructor is only really useful for assigning to. More...
 
 vector (size_t const n)
 The default constructor creates a new vector with n elements. More...
 
 vector (gsl_vector *v)
 Could construct from a gsl_vector. More...
 
 vector (std::initializer_list< double > initializer_list)
 Could construct from a std::initializer_list in C++11. More...
 
 vector (vector const &v)
 The copy constructor. More...
 
 vector (vector &v)
 The copy constructor. More...
 
vectoroperator= (vector const &v)
 The assignment operator. More...
 
template<typename V >
 vector (V &v, size_t const stride=1)
 Construct from an object that implements data() and size(). More...
 
vector clone () const
 The clone function. More...
 
 ~vector ()
 The destructor only deletes the pointers if count reaches zero. More...
 
void wrap_gsl_vector_without_ownership (gsl_vector *v)
 This function is intended mainly for internal use. More...
 
bool operator== (vector const &v) const
 Two vector objects are identically equal if their elements are identical. More...
 
void reset ()
 Stop sharing ownership of the shared pointer. More...
 
 vector (vector &&v)
 Move constructor. More...
 
vectoroperator= (vector &&v)
 Move operator. More...
 
bool operator!= (vector const &v) const
 Two vector objects are different equal if their elements are not identical. More...
 
bool operator< (vector const &v) const
 A container needs to define an ordering for sorting. More...
 
bool operator> (vector const &v) const
 A container needs to define an ordering for sorting. More...
 
bool operator<= (vector const &v) const
 A container needs to define an ordering for sorting. More...
 
bool operator>= (vector const &v) const
 A container needs to define an ordering for sorting. More...
 
iterator begin ()
 Get iterator pointing to first vector element. More...
 
const_iterator begin () const
 Get iterator pointing to first vector element. More...
 
iterator end ()
 Get iterator pointing beyond last vector element. More...
 
const_iterator end () const
 Get iterator pointing beyond last vector element. More...
 
size_type size () const
 The size (number of elements) of the vector. More...
 
double * data ()
 Give access to the data block. More...
 
double const * data () const
 Give access to the data block. More...
 
size_type max_size () const
 The max size (number of elements) of the vector. More...
 
bool empty () const
 Find if the vector is empty. More...
 
void swap (vector &v)
 Swap two vector objects. More...
 
reverse_iterator rbegin ()
 Get iterator pointing to first vector element. More...
 
const_reverse_iterator rbegin () const
 Get iterator pointing to first vector element. More...
 
reverse_iterator rend ()
 Get iterator pointing beyon last vector element. More...
 
const_reverse_iterator rend () const
 Get iterator pointing beyon last vector element. More...
 
double & operator[] (size_t const n)
 Get element at position n by reference ([] operator). More...
 
double const & operator[] (size_t const n) const
 Get element at position n by reference ([] operator). More...
 
gsl_vector * get ()
 Get the gsl_vector. More...
 
gsl_vector const * get () const
 Get the gsl_vector. More...
 
bool unique () const
 Find if this is the only object sharing the gsl_vector. More...
 
size_t use_count () const
 Find how many vector objects share this pointer. More...
 
 operator bool () const
 Allow conversion to bool. More...
 
void set_zero ()
 C++ version of gsl_vector_set_zero(). More...
 
void set_all (double x)
 C++ version of gsl_vector_set_all(). More...
 
int set_basis (size_t i)
 C++ version of gsl_vector_set_basis(). More...
 
int memcpy (vector const &src)
 C++ version of gsl_vector_memcpy(). More...
 
int reverse ()
 C++ version of gsl_vector_reverse(). More...
 
int swap_elements (size_t const i, size_t const j)
 C++ version of gsl_vector_swap_elements(). More...
 
double max () const
 C++ version of gsl_vector_max(). More...
 
double min () const
 C++ version of gsl_vector_min(). More...
 
void minmax (double *min_out, double *max_out) const
 C++ version of gsl_vector_minmax(). More...
 
size_t max_index () const
 C++ version of gsl_vector_max_index(). More...
 
size_t min_index () const
 C++ version of gsl_vector_min_index(). More...
 
void minmax_index (size_t *imin, size_t *imax) const
 C++ version of gsl_vector_minmax_index(). More...
 
int add (vector const &b)
 C++ version of gsl_vector_add(). More...
 
int sub (vector const &b)
 C++ version of gsl_vector_sub(). More...
 
int mul (vector const &b)
 C++ version of gsl_vector_mul(). More...
 
int div (vector const &b)
 C++ version of gsl_vector_div(). More...
 
int scale (double const x)
 C++ version of gsl_vector_scale(). More...
 
int add_constant (double const x)
 C++ version of gsl_vector_add_constant(). More...
 
int isnull () const
 C++ version of gsl_vector_isnull(). More...
 
int ispos () const
 C++ version of gsl_vector_ispos(). More...
 
int isneg () const
 C++ version of gsl_vector_isneg(). More...
 
int isnonneg () const
 C++ version of gsl_vector_isnonneg(). More...
 
double get (size_t const i) const
 C++ version of gsl_vector_get(). More...
 
void set (size_t const i, double x)
 C++ version of gsl_vector_set(). More...
 
double * ptr (size_t const i)
 C++ version of gsl_vector_ptr(). More...
 
double const * const_ptr (size_t const i) const
 C++ version of gsl_vector_const_ptr(). More...
 
int fread (FILE *stream)
 C++ version of gsl_vector_fread(). More...
 
int fwrite (FILE *stream) const
 C++ version of gsl_vector_fwrite(). More...
 
int fscanf (FILE *stream)
 C++ version of gsl_vector_fscanf(). More...
 
int fprintf (FILE *stream, char const *format) const
 C++ version of gsl_vector_fprintf(). More...
 
 vector (block &b, size_t const offset, size_t const n, size_t const stride=1)
 C++ version of gsl_vector_alloc_from_block(). More...
 
 vector (vector &v, size_t const offset, size_t const n, size_t const stride=1)
 C++ version of gsl_vector_alloc_from_vector(). More...
 
vector subvector (size_t i, size_t n)
 C++ version of gsl_vector_subvector(). More...
 
vector subvector_with_stride (size_t i, size_t stride, size_t n)
 C++ version of gsl_vector_subvector_with_stride(). More...
 
vector const const_subvector (size_t i, size_t n) const
 C++ version of gsl_vector_const_subvector(). More...
 
vector const const_subvector_with_stride (size_t i, size_t stride, size_t n) const
 C++ version of gsl_vector_const_subvector_with_stride(). More...
 
vector const subvector (size_t i, size_t n) const
 Another C++ version of gsl_const_vector_subvector_with_stride(). More...
 
vector const subvector_with_stride (size_t i, size_t stride, size_t n) const
 Another C++ version of gsl_vector_const_subvector_with_stride(). More...
 

Static Public Member Functions

static vector calloc (size_t const n)
 C++ version of gsl_vector_calloc(). More...
 
static vector view_array (double *v, size_t n)
 C++ version of gsl_vector_view_array(). More...
 
static vector view_array_with_stride (double *base, size_t stride, size_t n)
 C++ version of gsl_vector_view_array_with_stride(). More...
 
static vector const const_view_array (double const *v, size_t n)
 C++ version of gsl_vector_const_view_array(). More...
 
static vector const const_view_array_with_stride (double const *base, size_t stride, size_t n)
 C++ version of gsl_vector_const_view_array_with_stride(). More...
 
static vector const view_array (double const *v, size_t n)
 Another C++ version of gsl_vector_const_view_array(). More...
 
static vector const view_array_with_stride (double const *base, size_t stride, size_t n)
 Another C++ version of gsl_vector_const_view_array_with_stride(). More...
 
static vector alloc_row_from_matrix (matrix &m, size_t const i)
 C++ version of gsl_vector_alloc_row_from_matrix(). More...
 
static vector alloc_col_from_matrix (matrix &m, size_t const j)
 C++ version of gsl_vector_alloc_col_from_matrix(). More...
 

Private Attributes

gsl_vector * ccgsl_pointer
 The shared pointer. More...
 
size_t * count
 The shared reference count. More...
 

Detailed Description

This class handles vector objects as shared handles.

It models a random access container so that STL functions work with vector.

Note that vector_views are implemented as vector objects here.

If you want to use a std::vector<double> or similar object as if it were a gsl::vector object, use the constructor that takes a stride argument. But use it with caution. Changing the size of the original object does not change the size of the gsl::vector object; so it may be safer to create gsl::vector objects in this way as needed.

Definition at line 46 of file vector.hpp.

Member Typedef Documentation

The const_iterator type.

Definition at line 1039 of file vector.hpp.

A container must have a constant pointer type.

Definition at line 371 of file vector.hpp.

A container must have a constant reference type.

Definition at line 361 of file vector.hpp.

The const_reverse_t type.

Definition at line 1047 of file vector.hpp.

A container must have a difference_type.

Definition at line 1056 of file vector.hpp.

The iterator type.

Definition at line 1043 of file vector.hpp.

A container must have a pointer type.

Definition at line 366 of file vector.hpp.

A container must have a reference type.

Definition at line 356 of file vector.hpp.

The reverse_iterator type.

Definition at line 1051 of file vector.hpp.

typedef size_t gsl::vector::size_type

A container must have a size_type.

Definition at line 1061 of file vector.hpp.

typedef double gsl::vector::value_type

A container must have a value_type.

Definition at line 351 of file vector.hpp.

Constructor & Destructor Documentation

gsl::vector::vector ( size_t const  n)
inlineexplicit

The default constructor creates a new vector with n elements.

Parameters
nThe number of elements in the vector

Definition at line 61 of file vector.hpp.

References ccgsl_pointer, and count.

gsl::vector::vector ( gsl_vector *  v)
inlineexplicit

Could construct from a gsl_vector.

This is not usually a good idea. In this case we should not use gsl_vector_free() to deallocate the memory.

Parameters
vThe vector

Definition at line 78 of file vector.hpp.

References ccgsl_pointer, and count.

gsl::vector::vector ( std::initializer_list< double >  initializer_list)
inline

Could construct from a std::initializer_list in C++11.

Parameters
initializer_listThe initializer_list.

Definition at line 89 of file vector.hpp.

References begin(), ccgsl_pointer, and count.

gsl::vector::vector ( vector const &  v)
inline

The copy constructor.

This shares the vector. Use clone() if you want a full copy.

Parameters
vThe vector to copy.

Definition at line 110 of file vector.hpp.

References count.

gsl::vector::vector ( vector v)
inline

The copy constructor.

This shares the vector. Use clone() if you want a full copy.

Parameters
vThe vector to copy.

Definition at line 117 of file vector.hpp.

References count.

template<typename V >
gsl::vector::vector ( V &  v,
size_t const  stride = 1 
)
inline

Construct from an object that implements data() and size().

This is primarily intended to allow you to construct from a std::vector<double> or std::array<double,size_t> object. But it could be used to construct a subvector. This constructor shares the data with the original object. But the price of efficiency is safety. If you change the size of v the size of the gsl::vector does not change. Stride is normally set to 1 and allows us to define a constructor. But it can be set to another value to indicate, for example, that you only wish every second element to be included in this.

Parameters
vThe object that you want this to share data with.
strideThe stride.

Definition at line 151 of file vector.hpp.

References ccgsl_pointer, and count.

gsl::vector::~vector ( )
inline

The destructor only deletes the pointers if count reaches zero.

Definition at line 185 of file vector.hpp.

References ccgsl_pointer, and count.

gsl::vector::vector ( vector &&  v)
inline

Move constructor.

Parameters
vThe vector to move.

Definition at line 244 of file vector.hpp.

References count.

gsl::vector::vector ( block b,
size_t const  offset,
size_t const  n,
size_t const  stride = 1 
)
inline

C++ version of gsl_vector_alloc_from_block().

Parameters
bThe block
offsetThe offset within the block
nThe number of elements
strideThe stride

Definition at line 1462 of file vector.hpp.

References gsl::block::get().

gsl::vector::vector ( vector v,
size_t const  offset,
size_t const  n,
size_t const  stride = 1 
)
inline

C++ version of gsl_vector_alloc_from_vector().

Parameters
vThe vector
offsetThe offset
nThe number of elements
strideThe stride

Definition at line 1479 of file vector.hpp.

References get().

Member Function Documentation

int gsl::vector::add ( vector const &  b)
inline

C++ version of gsl_vector_add().

Parameters
bvector to add to this
Returns
error code on failure

Definition at line 1354 of file vector.hpp.

References get().

int gsl::vector::add_constant ( double const  x)
inline

C++ version of gsl_vector_add_constant().

Parameters
xconstant to add to each element of this
Returns
error code on failure

Definition at line 1384 of file vector.hpp.

vector gsl::vector::alloc_col_from_matrix ( matrix m,
size_t const  j 
)
inlinestatic

C++ version of gsl_vector_alloc_col_from_matrix().

Parameters
mA matrix
jA column
Returns
A vector

Definition at line 1537 of file matrix.hpp.

References gsl::matrix::get(), and vector().

vector gsl::vector::alloc_row_from_matrix ( matrix m,
size_t const  i 
)
inlinestatic

C++ version of gsl_vector_alloc_row_from_matrix().

Parameters
mA matrix
iA row
Returns
A vector

Definition at line 1535 of file matrix.hpp.

References gsl::matrix::get(), and vector().

iterator gsl::vector::begin ( )
inline

Get iterator pointing to first vector element.

Returns
iterator pointing to first vector element

Definition at line 1067 of file vector.hpp.

Referenced by vector().

const_iterator gsl::vector::begin ( ) const
inline

Get iterator pointing to first vector element.

Returns
iterator pointing to first vector element

Definition at line 1074 of file vector.hpp.

static vector gsl::vector::calloc ( size_t const  n)
inlinestatic

C++ version of gsl_vector_calloc().

This constructs a vector object with entries initialised to zero.

Parameters
nThe size of the vector
Returns
A vector initialised to zero

Definition at line 1280 of file vector.hpp.

References vector().

vector gsl::vector::clone ( ) const
inline

The clone function.

Use this if you want a copy of the block that does not share the underlying data.

Returns
a new copy of this.

Definition at line 174 of file vector.hpp.

References get(), and size().

double const* gsl::vector::const_ptr ( size_t const  i) const
inline

C++ version of gsl_vector_const_ptr().

Parameters
iindex of element to get
Returns
pointer to element

Definition at line 1428 of file vector.hpp.

vector const gsl::vector::const_subvector ( size_t  i,
size_t  n 
) const
inline

C++ version of gsl_vector_const_subvector().

Parameters
iThe offset
nThe size
Returns
A subvector

Definition at line 1587 of file vector.hpp.

References vector().

vector const gsl::vector::const_subvector_with_stride ( size_t  i,
size_t  stride,
size_t  n 
) const
inline

C++ version of gsl_vector_const_subvector_with_stride().

Parameters
iThe offset
strideThe stride
nThe size
Returns
A subvector

Definition at line 1599 of file vector.hpp.

References vector().

static vector const gsl::vector::const_view_array ( double const *  v,
size_t  n 
)
inlinestatic

C++ version of gsl_vector_const_view_array().

Parameters
vAn array of type double
nThe size of the vector
Returns
A vector

Definition at line 1518 of file vector.hpp.

References vector().

static vector const gsl::vector::const_view_array_with_stride ( double const *  base,
size_t  stride,
size_t  n 
)
inlinestatic

C++ version of gsl_vector_const_view_array_with_stride().

Parameters
baseAn array of type double
strideThe stride
nThe size of the vector
Returns
A vector

Definition at line 1530 of file vector.hpp.

References vector().

Referenced by gsl::vector_complex::const_imag(), gsl::vector_complex::const_real(), gsl::vector_complex::imag(), and gsl::vector_complex::real().

double* gsl::vector::data ( )
inline

Give access to the data block.

The data() and size() functions mimic the functions of std::array<T> and std::vector<T>. This function can throw an exception or produce a GSL error if the vector stride is not 1. However, new vector objects are always initialised to have a stride of 1.

Returns
The data block.

Definition at line 1107 of file vector.hpp.

References ccgsl_pointer.

Referenced by gsl::fit::linear(), gsl::fit::mul(), gsl::fft::halfcomplex::unpack(), gsl::fft::real::unpack(), gsl::fit::wlinear(), and gsl::fit::wmul().

double const* gsl::vector::data ( ) const
inline

Give access to the data block.

The data() and size() functions mimic the functions of std::array<T> and std::vector<T>. This function can throw an exception or produce a GSL error if the vector stride is not 1. However, new vector objects are always initialised to have a stride of 1.

Returns
The data block.

Definition at line 1121 of file vector.hpp.

References ccgsl_pointer.

int gsl::vector::div ( vector const &  b)
inline

C++ version of gsl_vector_div().

Parameters
bvector to dividev this by elementwise
Returns
error code on failure

Definition at line 1372 of file vector.hpp.

References get().

bool gsl::vector::empty ( ) const
inline

Find if the vector is empty.

Returns
true if has size zero; otherwise false

Definition at line 1140 of file vector.hpp.

References ccgsl_pointer.

iterator gsl::vector::end ( )
inline

Get iterator pointing beyond last vector element.

Returns
iterator pointing beyond last vector element

Definition at line 1082 of file vector.hpp.

References ccgsl_pointer, and size().

const_iterator gsl::vector::end ( ) const
inline

Get iterator pointing beyond last vector element.

Returns
iterator pointing beyond last vector element

Definition at line 1090 of file vector.hpp.

References ccgsl_pointer, and size().

int gsl::vector::fprintf ( FILE *  stream,
char const *  format 
) const
inline

C++ version of gsl_vector_fprintf().

Parameters
streamA C file stream
formatd, e, f or g
Returns
error code on failure

Definition at line 1453 of file vector.hpp.

int gsl::vector::fread ( FILE *  stream)
inline

C++ version of gsl_vector_fread().

Parameters
streamA C file stream
Returns
error code on failure

Definition at line 1434 of file vector.hpp.

int gsl::vector::fscanf ( FILE *  stream)
inline

C++ version of gsl_vector_fscanf().

Parameters
streamA C file stream
Returns
error code on failure

Definition at line 1446 of file vector.hpp.

int gsl::vector::fwrite ( FILE *  stream) const
inline

C++ version of gsl_vector_fwrite().

Parameters
streamA C file stream
Returns
error code on failure

Definition at line 1440 of file vector.hpp.

gsl_vector* gsl::vector::get ( )
inline

Get the gsl_vector.

Returns
the gsl_vector

Definition at line 1246 of file vector.hpp.

References ccgsl_pointer.

Referenced by add(), gsl::linalg::balance_accum(), gsl::linalg::balance_columns(), gsl::linalg::balance_matrix(), gsl::linalg::bidiag_decomp(), gsl::linalg::bidiag_unpack(), gsl::linalg::bidiag_unpack2(), gsl::linalg::bidiag_unpack_B(), gsl::linalg::cholesky_decomp_unit(), gsl::linalg::cholesky_solve(), gsl::linalg::cholesky_svx(), clone(), gsl::matrix::const_view_vector(), gsl::matrix::const_view_vector_with_tda(), gsl::blas::dasum(), gsl::blas::daxpy(), gsl::blas::dcopy(), gsl::blas::ddot(), gsl::multiroot::test::delta(), gsl::multifit::test::delta(), gsl::blas::dgemv(), gsl::blas::dger(), gsl::multifit::fdfsolver::dif_df(), gsl::multifit::fdfsolver::dif_fdf(), gsl::multimin::diff(), div(), gsl::blas::dnrm2(), gsl::blas::drot(), gsl::blas::drotm(), gsl::blas::dscal(), gsl::blas::dswap(), gsl::blas::dsymv(), gsl::blas::dsyr(), gsl::blas::dsyr2(), gsl::blas::dtrmv(), gsl::blas::dtrsv(), gsl::bspline::eval(), gsl::bspline::eval_nonzero(), gsl::multiroot::fdjacobian(), gsl::eigen::gen(), gsl::eigen::gen_QZ(), gsl::eigen::genherm(), gsl::eigen::genhermv(), gsl::eigen::genhermv_sort(), gsl::eigen::gensymm(), gsl::eigen::gensymmv(), gsl::eigen::gensymmv_sort(), gsl::eigen::genv(), gsl::eigen::genv_QZ(), gsl::eigen::genv_sort(), gsl::matrix::get_col(), gsl::matrix::get_row(), gsl::multifit::gradient(), gsl::multimin::test::gradient(), gsl::multifit::test::gradient(), gsl::eigen::herm(), gsl::linalg::hermtd_unpack(), gsl::linalg::hermtd_unpack_T(), gsl::eigen::hermv(), gsl::eigen::hermv_sort(), gsl::linalg::hessenberg(), gsl::linalg::hessenberg_decomp(), gsl::linalg::hessenberg_submatrix(), gsl::linalg::hessenberg_unpack(), gsl::linalg::hessenberg_unpack_accum(), gsl::linalg::hesstri_decomp(), gsl::linalg::HH_solve(), gsl::linalg::HH_svx(), gsl::linalg::householder_hm(), gsl::linalg::householder_hv(), gsl::linalg::householder_mh(), gsl::linalg::householder_transform(), gsl::blas::idamax(), gsl::bspline::knots(), gsl::linalg::L_solve_T(), gsl::fit::linear(), gsl::multifit::linear(), gsl::multifit::linear_est(), gsl::multifit::linear_residuals(), gsl::multifit::linear_svd(), gsl::multifit::linear_usvd(), gsl::linalg::LQ_decomp(), gsl::linalg::LQ_LQsolve(), gsl::linalg::LQ_Lsolve_T(), gsl::linalg::LQ_lssolve_T(), gsl::linalg::LQ_Lsvx_T(), gsl::linalg::LQ_solve_T(), gsl::linalg::LQ_svx_T(), gsl::linalg::LQ_unpack(), gsl::linalg::LQ_update(), gsl::linalg::LQ_vecQ(), gsl::linalg::LQ_vecQT(), gsl::linalg::LU_refine(), gsl::linalg::LU_solve(), gsl::linalg::LU_svx(), memcpy(), gsl::fit::mul(), mul(), gsl::linalg::PTLQ_decomp(), gsl::linalg::PTLQ_decomp2(), gsl::linalg::PTLQ_LQsolve_T(), gsl::linalg::PTLQ_Lsolve_T(), gsl::linalg::PTLQ_Lsvx_T(), gsl::linalg::PTLQ_solve_T(), gsl::linalg::PTLQ_svx_T(), gsl::linalg::PTLQ_update(), gsl::linalg::QR_decomp(), gsl::linalg::QR_lssolve(), gsl::linalg::QR_QRsolve(), gsl::linalg::QR_QTmat(), gsl::linalg::QR_QTvec(), gsl::linalg::QR_Qvec(), gsl::linalg::QR_Rsolve(), gsl::linalg::QR_Rsvx(), gsl::linalg::QR_solve(), gsl::linalg::QR_svx(), gsl::linalg::QR_unpack(), gsl::linalg::QR_update(), gsl::linalg::QRPT_decomp(), gsl::linalg::QRPT_decomp2(), gsl::linalg::QRPT_QRsolve(), gsl::linalg::QRPT_Rsolve(), gsl::linalg::QRPT_Rsvx(), gsl::linalg::QRPT_solve(), gsl::linalg::QRPT_svx(), gsl::linalg::QRPT_update(), gsl::linalg::R_solve(), gsl::linalg::R_svx(), gsl::multiroot::test::residual(), gsl::multifit::robust(), gsl::multifit::robust_est(), gsl::multimin::fminimizer::set(), gsl::multiroot::fsolver::set(), gsl::multifit::fsolver::set(), gsl::multimin::fdfminimizer::set(), gsl::multiroot::fdfsolver::set(), gsl::multifit::fdfsolver::set(), gsl::matrix::set_col(), gsl::matrix::set_row(), gsl::linalg::solve_cyc_tridiag(), gsl::linalg::solve_symm_cyc_tridiag(), gsl::linalg::solve_symm_tridiag(), gsl::linalg::solve_tridiag(), sub(), gsl::linalg::SV_decomp(), gsl::linalg::SV_decomp_jacobi(), gsl::linalg::SV_decomp_mod(), gsl::linalg::SV_leverage(), gsl::linalg::SV_solve(), gsl::eigen::symm(), gsl::linalg::symmtd_decomp(), gsl::linalg::symmtd_unpack(), gsl::linalg::symmtd_unpack_T(), gsl::eigen::symmv(), gsl::eigen::symmv_sort(), vector(), gsl::permute::vector_forward(), gsl::permute::vector_inverse(), gsl::matrix::view_vector(), gsl::matrix::view_vector_with_tda(), gsl::fit::wlinear(), gsl::multifit::wlinear(), gsl::multifit::wlinear_svd(), gsl::multifit::wlinear_usvd(), and gsl::fit::wmul().

gsl_vector const* gsl::vector::get ( ) const
inline

Get the gsl_vector.

Returns
the gsl_vector

Definition at line 1251 of file vector.hpp.

References ccgsl_pointer.

double gsl::vector::get ( size_t const  i) const
inline

C++ version of gsl_vector_get().

Parameters
iindex of element to get
Returns
value of element

Definition at line 1410 of file vector.hpp.

int gsl::vector::isneg ( ) const
inline

C++ version of gsl_vector_isneg().

Returns
+1 or 0 according as elements are all negative or not

Definition at line 1399 of file vector.hpp.

int gsl::vector::isnonneg ( ) const
inline

C++ version of gsl_vector_isnonneg().

Returns
+1 or 0 according as elements are all nonnegative or not

Definition at line 1404 of file vector.hpp.

int gsl::vector::isnull ( ) const
inline

C++ version of gsl_vector_isnull().

Returns
+1 or 0 according as elements are all zero or not

Definition at line 1389 of file vector.hpp.

int gsl::vector::ispos ( ) const
inline

C++ version of gsl_vector_ispos().

Returns
+1 or 0 according as elements are all positive or not

Definition at line 1394 of file vector.hpp.

double gsl::vector::max ( ) const
inline

C++ version of gsl_vector_max().

Returns
maximum element of vector

Definition at line 1319 of file vector.hpp.

size_t gsl::vector::max_index ( ) const
inline

C++ version of gsl_vector_max_index().

Returns
index of maximum value of vector

Definition at line 1336 of file vector.hpp.

size_type gsl::vector::max_size ( ) const
inline

The max size (number of elements) of the vector.

Identical to size but required for a container.

Returns
The size of the vector

Definition at line 1134 of file vector.hpp.

References ccgsl_pointer.

int gsl::vector::memcpy ( vector const &  src)
inline

C++ version of gsl_vector_memcpy().

Parameters
srcsource vector
Returns
error code on failure

Definition at line 1301 of file vector.hpp.

References get().

double gsl::vector::min ( ) const
inline

C++ version of gsl_vector_min().

Returns
minimum element of vector

Definition at line 1324 of file vector.hpp.

Referenced by operator<(), and operator>().

size_t gsl::vector::min_index ( ) const
inline

C++ version of gsl_vector_min_index().

Returns
index of minimum value of vector

Definition at line 1341 of file vector.hpp.

void gsl::vector::minmax ( double *  min_out,
double *  max_out 
) const
inline

C++ version of gsl_vector_minmax().

Parameters
min_outminimum element of vector
max_outmaximum element of vector

Definition at line 1330 of file vector.hpp.

void gsl::vector::minmax_index ( size_t *  imin,
size_t *  imax 
) const
inline

C++ version of gsl_vector_minmax_index().

Parameters
iminindex of minimum value of vector
imaxindex of maximum value of vector

Definition at line 1347 of file vector.hpp.

int gsl::vector::mul ( vector const &  b)
inline

C++ version of gsl_vector_mul().

Parameters
bvector to multiply elementwise with this
Returns
error code on failure

Definition at line 1366 of file vector.hpp.

References get().

gsl::vector::operator bool ( ) const
inlineexplicit

Allow conversion to bool.

Returns
true or false according as this contains a pointer to a gsl_vector

Definition at line 1271 of file vector.hpp.

bool gsl::vector::operator!= ( vector const &  v) const
inline

Two vector objects are different equal if their elements are not identical.

Parameters
vThe vector to be compared with this
Returns
false or true according as this and v have identical elements or not

Definition at line 265 of file vector.hpp.

References operator==().

bool gsl::vector::operator< ( vector const &  v) const
inline

A container needs to define an ordering for sorting.

This uses standard lexicographical ordering and so is not useful, for example, for checking, that a vector is nonnegative.

Parameters
vThe vector to be compared with this
Returns
false or true according as this is less than v lexicographically

Definition at line 277 of file vector.hpp.

References ccgsl_pointer, min(), and size().

Referenced by operator<=().

bool gsl::vector::operator<= ( vector const &  v) const
inline

A container needs to define an ordering for sorting.

This uses standard lexicographical ordering and so is not useful, for example, for checking, that a vector is nonnegative.

Parameters
vThe vector to be compared with this
Returns
false or true according as this is less than or equal to v lexicographically

Definition at line 331 of file vector.hpp.

References operator<(), and operator==().

vector& gsl::vector::operator= ( vector const &  v)
inline

The assignment operator.

This makes a shared copy.

Parameters
vThe vector to copy

Definition at line 125 of file vector.hpp.

References ccgsl_pointer, and count.

vector& gsl::vector::operator= ( vector &&  v)
inline

Move operator.

Parameters
vThe vector to move.
Returns
A reference to this.

Definition at line 253 of file vector.hpp.

References vector().

bool gsl::vector::operator== ( vector const &  v) const
inline

Two vector objects are identically equal if their elements are identical.

Parameters
vThe vector to be compared with this
Returns
true or false according as this and v have identical elements or not

Definition at line 223 of file vector.hpp.

References ccgsl_pointer.

Referenced by operator!=(), operator<=(), and operator>=().

bool gsl::vector::operator> ( vector const &  v) const
inline

A container needs to define an ordering for sorting.

This uses standard lexicographical ordering and so is not useful, for example, for checking, that a vector is nonnegative.

Parameters
vThe vector to be compared with this
Returns
false or true according as this is greater than v lexicographically

Definition at line 304 of file vector.hpp.

References ccgsl_pointer, min(), and size().

Referenced by operator>=().

bool gsl::vector::operator>= ( vector const &  v) const
inline

A container needs to define an ordering for sorting.

This uses standard lexicographical ordering and so is not useful, for example, for checking, that a vector is nonnegative.

Parameters
vThe vector to be compared with this
Returns
false or true according as this is no less than v lexicographically

Definition at line 343 of file vector.hpp.

References operator==(), and operator>().

double& gsl::vector::operator[] ( size_t const  n)
inline

Get element at position n by reference ([] operator).

Parameters
nThe position of the element
Returns
a reference to a double

Definition at line 1190 of file vector.hpp.

References ccgsl_pointer, gsl::exception::GSL_EFAULT, gsl::exception::GSL_EINVAL, and size().

double const& gsl::vector::operator[] ( size_t const  n) const
inline

Get element at position n by reference ([] operator).

Parameters
nThe position of the element
Returns
a reference to a double

Definition at line 1213 of file vector.hpp.

References ccgsl_pointer, gsl::exception::GSL_EFAULT, gsl::exception::GSL_EINVAL, and size().

double* gsl::vector::ptr ( size_t const  i)
inline

C++ version of gsl_vector_ptr().

Parameters
iindex of element to get
Returns
pointer to element

Definition at line 1422 of file vector.hpp.

reverse_iterator gsl::vector::rbegin ( )
inline

Get iterator pointing to first vector element.

Returns
iterator pointing to first vector element

Definition at line 1157 of file vector.hpp.

References ccgsl_pointer, and size().

const_reverse_iterator gsl::vector::rbegin ( ) const
inline

Get iterator pointing to first vector element.

Returns
iterator pointing to first vector element

Definition at line 1165 of file vector.hpp.

References ccgsl_pointer, and size().

reverse_iterator gsl::vector::rend ( )
inline

Get iterator pointing beyon last vector element.

Returns
iterator pointing beyond last vector element

Definition at line 1174 of file vector.hpp.

const_reverse_iterator gsl::vector::rend ( ) const
inline

Get iterator pointing beyon last vector element.

Returns
iterator pointing beyond last vector element

Definition at line 1181 of file vector.hpp.

void gsl::vector::reset ( )
inline

Stop sharing ownership of the shared pointer.

Definition at line 238 of file vector.hpp.

References vector().

int gsl::vector::reverse ( )
inline

C++ version of gsl_vector_reverse().

Returns
error code on failure

Definition at line 1306 of file vector.hpp.

int gsl::vector::scale ( double const  x)
inline

C++ version of gsl_vector_scale().

Parameters
xconstant to multiply this by
Returns
error code on failure

Definition at line 1378 of file vector.hpp.

void gsl::vector::set ( size_t const  i,
double  x 
)
inline

C++ version of gsl_vector_set().

Parameters
iindex to set
xnew value for element

Definition at line 1416 of file vector.hpp.

void gsl::vector::set_all ( double  x)
inline

C++ version of gsl_vector_set_all().

Parameters
xThe value to which all elements are set

Definition at line 1289 of file vector.hpp.

int gsl::vector::set_basis ( size_t  i)
inline

C++ version of gsl_vector_set_basis().

Creates a basis vector with one nonzero element.

Parameters
iThe element to be set to 1.
Returns
error code on failure

Definition at line 1295 of file vector.hpp.

void gsl::vector::set_zero ( )
inline

C++ version of gsl_vector_set_zero().

Definition at line 1284 of file vector.hpp.

size_type gsl::vector::size ( ) const
inline

The size (number of elements) of the vector.

Returns
The size of the vector

Definition at line 1099 of file vector.hpp.

References ccgsl_pointer.

Referenced by clone(), end(), gsl::fit::linear(), gsl::fit::mul(), operator<(), operator>(), operator[](), rbegin(), gsl::fft::halfcomplex::unpack(), gsl::fft::real::unpack(), gsl::fit::wlinear(), and gsl::fit::wmul().

int gsl::vector::sub ( vector const &  b)
inline

C++ version of gsl_vector_sub().

Parameters
bvector to subtract from this
Returns
error code on failure

Definition at line 1360 of file vector.hpp.

References get().

vector gsl::vector::subvector ( size_t  i,
size_t  n 
)
inline

C++ version of gsl_vector_subvector().

Parameters
iThe offset
nThe size
Returns
A subvector

Definition at line 1564 of file vector.hpp.

References vector().

vector const gsl::vector::subvector ( size_t  i,
size_t  n 
) const
inline

Another C++ version of gsl_const_vector_subvector_with_stride().

Parameters
iThe offset
nThe size
Returns
A subvector

Definition at line 1610 of file vector.hpp.

References vector().

vector gsl::vector::subvector_with_stride ( size_t  i,
size_t  stride,
size_t  n 
)
inline

C++ version of gsl_vector_subvector_with_stride().

Parameters
iThe offset
strideThe stride
nThe size
Returns
A subvector

Definition at line 1576 of file vector.hpp.

References vector().

vector const gsl::vector::subvector_with_stride ( size_t  i,
size_t  stride,
size_t  n 
) const
inline

Another C++ version of gsl_vector_const_subvector_with_stride().

Parameters
iThe offset
strideThe stride
nThe size
Returns
A subvector

Definition at line 1622 of file vector.hpp.

References vector().

void gsl::vector::swap ( vector v)
inline

Swap two vector objects.

This works even if the vector objects have different sizes because it swaps pointers.

Parameters
vThe vector to swap with this.

Definition at line 1147 of file vector.hpp.

References ccgsl_pointer, and count.

int gsl::vector::swap_elements ( size_t const  i,
size_t const  j 
)
inline

C++ version of gsl_vector_swap_elements().

Parameters
ifirst element
jsecond element
Returns
error code on failure

Definition at line 1313 of file vector.hpp.

bool gsl::vector::unique ( ) const
inline

Find if this is the only object sharing the gsl_vector.

Returns
true or falses according as this is the only vector object sharing the gsl_vector

Definition at line 1257 of file vector.hpp.

size_t gsl::vector::use_count ( ) const
inline

Find how many vector objects share this pointer.

Returns
the number of vector objects that share this pointer

Definition at line 1262 of file vector.hpp.

References count.

static vector gsl::vector::view_array ( double *  v,
size_t  n 
)
inlinestatic

C++ version of gsl_vector_view_array().

Parameters
vAn array of type double
nThe size of the vector
Returns
A vector

Definition at line 1495 of file vector.hpp.

References vector().

static vector const gsl::vector::view_array ( double const *  v,
size_t  n 
)
inlinestatic

Another C++ version of gsl_vector_const_view_array().

Parameters
vAn array of type double
nThe size of the vector
Returns
A vector

Definition at line 1541 of file vector.hpp.

References vector().

static vector gsl::vector::view_array_with_stride ( double *  base,
size_t  stride,
size_t  n 
)
inlinestatic

C++ version of gsl_vector_view_array_with_stride().

Parameters
baseAn array of type double
strideThe stride
nThe size of the vector
Returns
A vector

Definition at line 1507 of file vector.hpp.

References vector().

Referenced by gsl::vector_complex::imag(), and gsl::vector_complex::real().

static vector const gsl::vector::view_array_with_stride ( double const *  base,
size_t  stride,
size_t  n 
)
inlinestatic

Another C++ version of gsl_vector_const_view_array_with_stride().

Parameters
baseAn array of type double
strideThe stride
nThe size of the vector
Returns
A vector

Definition at line 1553 of file vector.hpp.

References vector().

void gsl::vector::wrap_gsl_vector_without_ownership ( gsl_vector *  v)
inline

This function is intended mainly for internal use.

It allows this to point to a gsl_vector without the possibility deleting it when this is no longer in scope. It is the responsibility of the programmer to delete v. The function is used internally for converting a function that takes a gsl::vector* argument to one that takes a gsl_vector* argument.

Parameters
vThe gsl_vector

Definition at line 204 of file vector.hpp.

References ccgsl_pointer, and count.

Referenced by gsl::multifit::fsolver::driver(), gsl::multifit::fdfsolver::driver(), gsl::multiroot::fsolver::dx(), gsl::multimin::fdfminimizer::dx(), gsl::multiroot::fdfsolver::dx(), gsl::multimin::fdfminimizer::gradient(), gsl::multifit::fsolver::iterate(), gsl::multifit::fdfsolver::iterate(), gsl::bspline::workspace::knots(), gsl::multifit::fsolver::position(), gsl::multifit::fdfsolver::position(), gsl::multiroot::fsolver::root(), gsl::multiroot::fdfsolver::root(), gsl::multifit::fsolver::set(), gsl::multifit::fdfsolver::set(), gsl::multimin::fminimizer::x(), and gsl::multimin::fdfminimizer::x().

Member Data Documentation

size_t* gsl::vector::count
private

The shared reference count.

Definition at line 1239 of file vector.hpp.

Referenced by operator=(), swap(), use_count(), vector(), wrap_gsl_vector_without_ownership(), and ~vector().


The documentation for this class was generated from the following files: