21#ifndef CCGSL_BLOCK_COMPLEX_HPP
22#define CCGSL_BLOCK_COMPLEX_HPP
24#include<gsl/gsl_block.h>
29#ifdef __GXX_EXPERIMENTAL_CXX0X__
69 try {
count =
new size_t; }
catch( std::bad_alloc& e ){
88#ifdef __GXX_EXPERIMENTAL_CXX0X__
93 block_complex( std::initializer_list<std::complex<double> > initializer_list ){
94 size_t const n = initializer_list.size();
97 try {
count =
new size_t; }
catch( std::bad_alloc& e ){
106 for(
auto x : initializer_list ){
107 *p =
complex( std::move( x ) ); ++p;
169#ifdef __GXX_EXPERIMENTAL_CXX0X__
175 std::swap(
count, v.count );
176 v.ccgsl_pointer =
nullptr;
236 for(
size_t i = 0; i <
min; ++i ){
239 if( t < u )
return true;
240 if( u < t )
return false;
243 return size < v_size;
263 for(
size_t i = 0; i <
min; ++i ){
266 if( t > u )
return true;
267 if( u > t )
return false;
270 return size > v_size;
328 template<
typename container,
typename content,
bool reverse>
364 }
else if(
v->ccgsl_pointer == 0 ){
390 }
else if(
v->ccgsl_pointer == 0 ){
417 }
else if(
v->ccgsl_pointer == 0 ){
442 if(
v == 0 or i.
v == 0 ){
445 }
else if(
v->ccgsl_pointer == 0 or i.
v->ccgsl_pointer == 0 ){
450 if(
v->ccgsl_pointer != i.
v->ccgsl_pointer ){
451 gsl_error(
"trying to take difference of iterators for different block_complexs", __FILE__, __LINE__,
484 if(
v == 0 or i.
v == 0 ){
489 if(
v->ccgsl_pointer != i.
v->ccgsl_pointer ){
490 gsl_error(
"trying to take difference of iterators for different block_complexs", __FILE__, __LINE__,
506 }
else if(
v->ccgsl_pointer == 0 ){
523 }
else if(
v->ccgsl_pointer == 0 ){
540 }
else if(
v->ccgsl_pointer == 0 ){
688 if( this->
v == 0 or i.
v == 0 ){
697 gsl_error(
"trying to take difference of iterators for different block_complexs", __FILE__, __LINE__,
726 if( this->
v == 0 or i.
v == 0 ){
732 gsl_error(
"trying to take difference of iterators for different block_complexs", __FILE__, __LINE__,
874 if( this->
v == 0 or i.
v == 0 ){
883 gsl_error(
"trying to take difference of iterators for different block_complexs", __FILE__, __LINE__,
924 if( this->
v == 0 or i.
v == 0 ){
930 gsl_error(
"trying to take difference of iterators for different block_complexs", __FILE__, __LINE__,
959 if( this->
v == 0 or i.
v == 0 ){
965 gsl_error(
"trying to take difference of iterators for different block_complexs", __FILE__, __LINE__,
1053 if(
ccgsl_pointer == 0 ) gsl_error(
"null block", __FILE__, __LINE__, GSL_EFAULT );
1061 if(
ccgsl_pointer == 0 ) gsl_error(
"null block", __FILE__, __LINE__, GSL_EFAULT );
1133#ifndef GSL_RANGE_CHECK_OFF
1156#ifndef GSL_RANGE_CHECK_OFF
1198#ifdef __GXX_EXPERIMENTAL_CXX0X__
A class template for the const iterators.
const_iterator_t< reverse > & operator--()
The prefix – operator.
const_iterator_t(iterator_t< reverse > const &i)
A copy constructor.
const_iterator_t< reverse > operator+(difference_type const n) const
The + operator.
bool operator!=(iterator_t< reverse > const &i) const
Comparison with non-const iterator.
bool operator<(iterator_t< reverse > const &i) const
Comparison with non-const iterator.
bool operator==(iterator_t< reverse > const &i) const
Comparison with non-const iterator.
const_iterator_t< reverse > & operator-=(difference_type const n)
The -= operator.
const_iterator_t< reverse > & operator+=(difference_type const n)
The += operator.
const_iterator_t< reverse > & operator=(const_iterator_t< reverse > const &i)
We can assign one output iterator from another.
bool operator!=(const_iterator_t< reverse > const &i) const
Comparison with const iterator.
iterator_base< block_complexconst, double, reverse >::difference_type difference_type
Difference type.
bool operator==(const_iterator_t< reverse > const &i) const
Comparison with const iterator.
bool operator<(const_iterator_t< reverse > const &i) const
Comparison with const iterator.
const_iterator_t< reverse > operator++(int)
The postfix ++ operator.
difference_type operator-(const_iterator_t< reverse > const &i) const
The - operator: find distance between two iterators.
difference_type operator-(iterator_t< reverse > const &i) const
The - operator: find distance between two iterators.
const_iterator_t< reverse > operator--(int)
The postfix – operator.
const_iterator_t< reverse > & operator++()
The prefix ++ operator.
const_iterator_t(block_complex const *v, difference_type position)
This constructor allows block_complex to create non-default iterators.
const_iterator_t< reverse > operator-(difference_type const n) const
The - operator: subtract distance from iterator.
const_iterator_t()
The default constructor.
The container must have iterator types.
difference_type position
Mark position of iterator within block_complex.
iterator_base(container *v, difference_type position)
This constructor allows block_complex to create non-default iterators.
void decrement()
Derement the iterator.
std::random_access_iterator_tag iterator_category
An iterator must have a pointer type.
iterator_base()
The iterator is default constructible.
container * v
Store a pointer to a block_complex we can iterate over: 0 if no block_complex.
reference operator*() const
Dereference the pointer.
pointer operator->() const
Dereference the pointer.
complex_ref reference
An iterator must have a reference type.
void increment()
Increment the iterator.
void shift(difference_type const n)
Shift iterator n places.
bool operator!=(iterator_base< container, content, reverse > const &i) const
The != operator.
reference operator[](difference_type const n) const
Get element at i + n by reference ([] operator).
bool operator<(iterator_base< container, content, reverse > const &i) const
The < operator is used to compare iterators.
difference_type operator-(iterator_base< container, content, reverse > const &i) const
The - operator: find distance between two iterators.
ptrdiff_t difference_type
An iterator must have a difference_type.
bool operator==(iterator_base< container, content, reverse > const &i) const
The == operator.
complex value_type
An iterator must have a value_type.
complex_ptr pointer
An iterator must have a pointer type.
A class template for the two non-const iterators.
iterator_t< reverse > operator++(int)
The postfix ++ operator.
iterator_t< reverse > & operator++()
The prefix ++ operator.
iterator_t< reverse > & operator=(iterator_t< reverse > const &i)
We can assign one output iterator from another.
difference_type operator-(const_iterator_t< reverse > const &i) const
The - operator: find distance between two iterators.
iterator_t< reverse > operator-(difference_type const n) const
The - operator: subtract distance from iterator.
iterator_t(block_complex *v, difference_type position)
This constructor allows block_complex to create non-default iterators.
iterator_t< reverse > & operator--()
The prefix – operator.
iterator_t< reverse > & operator+=(difference_type const n)
The += operator.
iterator_base< block_complex, double, reverse >::difference_type difference_type
Difference type.
bool operator==(const_iterator_t< reverse > const &i) const
Comparison with const iterator.
difference_type operator-(iterator_t< reverse > const &i) const
The - operator: find distance between two iterators.
iterator_t< reverse > operator+(difference_type const n) const
The + operator.
bool operator!=(const_iterator_t< reverse > const &i) const
Comparison with const iterator.
iterator_t< reverse > & operator-=(difference_type const n)
The -= operator.
iterator_t< reverse > operator--(int)
The postfix – operator.
bool operator<(const_iterator_t< reverse > const &i) const
Comparison with const iterator.
iterator_t()
The default constructor.
This class handles vector_complexs as shared handles.
size_t size_type
A container must have a size_type.
reverse_iterator rbegin()
Get iterator pointing to first block_complex element.
size_t use_count() const
Find how many block_complex objects share this pointer.
bool empty() const
Find if the block_complex is empty.
block_complex(size_t const n)
The default constructor creates a new block_complex with n elements.
size_type size() const
The size (number of elements) of the block_complex.
bool operator<(block_complex const &v) const
A container needs to define an ordering for sorting.
reference operator[](size_t const n)
Get element at position n by reference ([] operator).
const_iterator end() const
Get iterator pointing beyond last block_complex element.
complex_ref reference
A container must have a reference type.
const_iterator_t< true > const_reverse_iterator
The const_reverse_iterator type.
const_iterator::difference_type difference_type
A container must have a difference_type.
iterator end()
Get iterator pointing beyond last block_complex element.
bool operator>=(block_complex const &v) const
A container needs to define an ordering for sorting.
block_complex()
The default constructor is only really useful for assigning to.
block_complex(gsl_block_complex *v)
Could construct from a gsl_block_complex.
bool operator!=(block_complex const &v) const
Two block_complex objects are different equal if their elements are not identical.
const_reference operator[](size_t const n) const
Get element at position n by reference ([] operator).
block_complex & operator=(block_complex const &v)
The assignment operator.
block_complex(block_complex const &v)
The copy constructor.
complex_ptr pointer
A container must have a pointer type.
double const * data() const
Give access to the data block.
void reset()
Stop sharing ownership of the shared pointer.
block_complex(std::initializer_list< std::complex< double > > initializer_list)
Could construct from a std::initializer_list in C++11.
gsl_block_complex * ccgsl_pointer
The shared pointer.
iterator_t< true > reverse_iterator
The reverse_iterator type.
complex value_type
A container must have a value_type.
const_iterator_t< false > const_iterator
The const_iterator type.
const_reverse_iterator rend() const
Get iterator pointing beyond last block_complex element.
block_complex(block_complex &&v)
Move constructor.
reverse_iterator rend()
Get iterator pointing beyond last block_complex element.
bool unique() const
Find if this is the only object sharing the gsl_block_complex.
bool operator==(block_complex const &v) const
Two block_complex objects are identically equal if their elements are identical.
iterator_t< false > iterator
The iterator type.
complex_ptr const const_pointer
A container must have a constant pointer type.
size_t * count
The shared reference count.
gsl_block_complex * get() const
Get the gsl_block_complex.
bool operator<=(block_complex const &v) const
A container needs to define an ordering for sorting.
iterator begin()
Get iterator pointing to first block_complex element.
double * data()
Give access to the data block.
reference const const_reference
A container must have a constant reference type.
const_iterator begin() const
Get iterator pointing to first block_complex element.
bool operator>(block_complex const &v) const
A container needs to define an ordering for sorting.
block_complex clone() const
The clone function.
size_type max_size() const
The max size (number of elements) of the block_complex.
const_reverse_iterator rbegin() const
Get iterator pointing to first block_complex element.
~block_complex()
The destructor only deletes the pointers if count reaches zero.
void swap(block_complex &v)
Swap two block_complex objects.
block_complex & operator=(block_complex &&v)
Move operator.
This class can be used like a pointer for complex objects so that we can iterate over a vector (for e...
This class can be used like a reference for complex objects so that we can iterate over a vector (for...
This class handles complex numbers.
@ GSL_EFAILED
generic failure
@ GSL_EFAULT
invalid pointer
int min(movstat::end_t const endtype, vector const &x, vector &y, workspace &w)
C++ version of gsl_movstat_min().
size_t n(workspace const &w)
C++ version of gsl_rstat_n().
gsl_sf_result result
Typedef for gsl_sf_result.
The gsl package creates an interface to the GNU Scientific Library for C++.