ccgsl 2.7.2
C++wrappersforGnuScientificLibrary
vector_complex_long_double.hpp
Go to the documentation of this file.
1/*
2 * $Id: vector_complex_long_double.hpp 314 2014-02-22 14:31:16Z jdl3 $
3 * Copyright (C) 2010, 2011, 2012, 2019, 2024 John D Lamb
4 *
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 2 of the License, or (at
8 * your option) any later version.
9 *
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.
14 *
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., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20#ifndef CCGSL_VECTOR_COMPLEX_LONG_DOUBLE_HPP
21#define CCGSL_VECTOR_COMPLEX_LONG_DOUBLE_HPP
22
23#include<gsl/gsl_vector_complex_long_double.h>
24#include<new>
25#include<iterator>
26#ifdef __GXX_EXPERIMENTAL_CXX0X__
27#include<complex>
28#endif
29
30#include"exception.hpp"
33
34// This file is a template
35#define CCGSL_MTY 2
36
37namespace gsl {
38 // declare matrix_complex_long_double class
39 class matrix_complex_long_double;
47 public:
52 owns_data = false;
53 ccgsl_pointer = 0;
54 count = 0; // initially nullptr will do
55 }
56 // Refines random access container
57 // Refines assignable
62 explicit vector_complex_long_double( size_t const n )
63 : owns_data(true) {
64 if( n > 0 ) ccgsl_pointer = gsl_vector_complex_long_double_alloc( n );
65 else { ccgsl_pointer = new gsl_vector_complex_long_double; ccgsl_pointer->size = 0; ccgsl_pointer->data = 0; }
66 // just plausibly we could allocate vector_complex_long_double but not count
67 try { count = new size_t; } catch( std::bad_alloc& e ){
68 // try to tidy up before rethrowing
69 if( n > 0 ) gsl_vector_complex_long_double_free( ccgsl_pointer );
70 else delete ccgsl_pointer;
71 throw e;
72 }
73 *count = 1; // initially there is just one reference to ccgsl_pointer
74 }
75#ifndef DOXYGEN_SKIP
80 explicit vector_complex_long_double( int const n )
81 : owns_data(true) {
82 if( n > 0 ) ccgsl_pointer
83 = gsl_vector_complex_long_double_alloc( static_cast<size_t>( n ) );
84 else if(n<0)
85 gsl_error("failed tring to make a vector of negative length",
86 __FILE__, __LINE__, exception::GSL_EDOM );
87 else { ccgsl_pointer = new gsl_vector_complex_long_double; ccgsl_pointer->size = 0; ccgsl_pointer->data = 0; }
88 // just plausibly we could allocate vector_complex_long_double but not count
89 try { count = new size_t; } catch( std::bad_alloc& e ){
90 // try to tidy up before rethrowing
91 if( n > 0 ) gsl_vector_complex_long_double_free( ccgsl_pointer );
92 else delete ccgsl_pointer;
93 throw e;
94 }
95 *count = 1; // initially there is just one reference to ccgsl_pointer
96 }
97#endif // DOXYGEN_SKIP
103 explicit vector_complex_long_double( gsl_vector_complex_long_double* v )
104 : owns_data(true) {
105 ccgsl_pointer = v;
106 // just plausibly we could fail to allocate count: no further action needed.
107 count = new size_t;
108 *count = 1; // initially there is just one reference to ccgsl_pointer
109 }
110 // copy constructor
111#ifdef __GXX_EXPERIMENTAL_CXX0X__
116 vector_complex_long_double( std::initializer_list<std::complex<long double> > initializer_list )
117 : owns_data(true){
118 size_t const n = initializer_list.size();
119 ccgsl_pointer = gsl_vector_complex_long_double_alloc( n );
120 // just plausibly we could allocate vector but not count
121 try { count = new size_t; } catch( std::bad_alloc& e ){
122 // try to tidy up before rethrowing
123 if( n > 0 ) gsl_vector_complex_long_double_free( ccgsl_pointer );
124 else delete ccgsl_pointer;
125 throw e;
126 }
127 *count = 1; // initially there is just one reference to ccgsl_pointer
128 // now copy
129 auto p = begin();
130 for( auto x : initializer_list ){
131 *p = complex_long_double( std::move( x ) ); ++p;
132 }
133 }
134#endif
135 // copy constructor
141 : owns_data(v.owns_data),
143 if( count != 0 ) ++*count; // vector_complex_long_double is now shared.
144 }
145 // assignment operator
151 // first, possibly delete anything pointed to by @c this
152 if( count == 0 or --*count == 0 ){
153 if( ccgsl_pointer != 0 ){
154 if( ccgsl_pointer->size > 0 ) gsl_vector_complex_long_double_free( ccgsl_pointer );
155 else delete ccgsl_pointer; }
156 delete count;
157 }
158 // Then copy
161 count = v.count;
162 if( count != 0 ) ++*count; // block_complex_long_double is now shared.
163 return *this;
164 }
165 // clone()
173 // Now copy
174 gsl_vector_complex_long_double_memcpy( copy.get(), get() );
175 // return new object
176 return copy;
177 }
178 // destructor
183 if( --*count == 0 ){
184 // could have allocated null pointer
185 if( ccgsl_pointer != 0 and owns_data ){
186 if( ccgsl_pointer->size > 0 ) gsl_vector_complex_long_double_free( ccgsl_pointer );
187 else delete ccgsl_pointer; }
188 delete count;
189 }
190 }
199 void wrap_gsl_vector_complex_long_double_without_ownership( gsl_vector_complex_long_double* v ){
200 if( count != 0 and --*count == 0 ){
201 // could have allocated null pointer
202 if( ccgsl_pointer != 0 ){
203 if( ccgsl_pointer->size != 0 ) gsl_vector_complex_long_double_free( ccgsl_pointer );
204 else delete ccgsl_pointer; }
205 }
206 ccgsl_pointer = v;
207 if(0 == count) count = new size_t;
208 *count = 1;
209 owns_data = false; // should never be able to delete ccgsl_pointer
210 }
211 // Refines equality comparable
212 // == operator
219 bool operator==( vector_complex_long_double const& v ) const {
220 // trivially equal if gsl_vector_complex_long_double*s are identical
221 if( ccgsl_pointer == v.ccgsl_pointer ) return true;
222 // trivially not equal if one is zero: != should be same as xor here
223 if( (ccgsl_pointer == 0) != (v.ccgsl_pointer == 0 ) ) return false;
224 // trivially not equal if sizes are different
225 if( ccgsl_pointer->size != v.ccgsl_pointer->size ) return false;
226 // check elementwise for equality
227 for( size_t i = 0; i < CCGSL_MTY * ccgsl_pointer->size; ++i )
228 if( *(ccgsl_pointer->data + i) != *(v.ccgsl_pointer->data + i) )
229 return false;
230 return true;
231 }
235 void reset(){ vector_complex_long_double().swap( *this ); }
236#ifdef __GXX_EXPERIMENTAL_CXX0X__
242 : owns_data (v.owns_data),
243 ccgsl_pointer( v.ccgsl_pointer ), count( nullptr ){
244 std::swap( count, v.count );
245 v.ccgsl_pointer = nullptr;
246 }
253 vector_complex_long_double( std::move( v ) ).swap( *this );
254 return *this;
255 }
256#endif
257 // != operator
264 bool operator!=( vector_complex_long_double const& v ) const { return not operator==( v ); }
265 // Refines forward container
266 // Refines less than comparable
267 // operator<
276 bool operator<( vector_complex_long_double const& v ) const {
277 // null vector_complex_long_double comes first
278 if( ccgsl_pointer == 0 ) return v.ccgsl_pointer != 0;
279 // if v is null then this > v
280 if( v.ccgsl_pointer == 0 ) return false;
281 // Now compare elementwise
282 size_t const size = ccgsl_pointer->size;
283 size_t const v_size = v.ccgsl_pointer->size;
284 size_t const min = size > v_size ? size : v_size;
285 for( size_t i = 0; i < min; ++i ){
286 complex_long_double const t = gsl_vector_complex_long_double_get( ccgsl_pointer, i );
287 complex_long_double const u =gsl_vector_complex_long_double_get( v.ccgsl_pointer, i );
288 if( t < u ) return true;
289 if( u < t ) return false;
290 }
291 // elements match.
292 return size < v_size;
293 }
294 // operator>
303 bool operator>( vector_complex_long_double const& v ) const {
304 // null vector_complex_long_double comes first
305 if( ccgsl_pointer == 0 ) return false;
306 // if v is null then this > v
307 if( v.ccgsl_pointer == 0 ) return true;
308 // Now compare elementwise
309 size_t const size = ccgsl_pointer->size;
310 size_t const v_size = v.ccgsl_pointer->size;
311 size_t const min = size > v_size ? size : v_size;
312 for( size_t i = 0; i < min; ++i ){
313 complex_long_double const t = gsl_vector_complex_long_double_get( ccgsl_pointer, i );
314 complex_long_double const u =gsl_vector_complex_long_double_get( v.ccgsl_pointer, i );
315 if( t > u ) return true;
316 if( u > t ) return false;
317 }
318 // elements match.
319 return size > v_size;
320 }
321 // operator<=
330 bool operator<=( vector_complex_long_double const& v ) const {
331 return operator<( v ) or operator==( v );
332 }
333 // operator>=
342 bool operator>=( vector_complex_long_double const& v ) const {
343 return operator>( v ) or operator==( v );
344 }
345 // Refines container
346 // type value_type
351 // type reference
356 // type const_reference
361 // type pointer
366 // type const_pointer
371 // type iterator
372 private:
377 template<typename container, typename content,bool reverse_t>
380 public:
396 typedef std::random_access_iterator_tag iterator_category;
397 // // type iterator_traits<block_complex_long_double>::difference_type
401 typedef ptrdiff_t difference_type;
402 public:
403 // // operator*
409 // First check that iterator is initialised.
410 if( v == 0 ){
411 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
412 return complex_long_double_ref( 0 );
413 } else if( v->ccgsl_pointer == 0 ){
414 gsl_error( "vector_complex_long_double not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
415 return complex_long_double_ref( 0 );
416 }
417 // Check that position make sense
418 if( position >= static_cast<difference_type>( v->size() ) ){
419 gsl_error( "trying to dereference beyond rbegin()", __FILE__, __LINE__, exception::GSL_EFAILED );
420 return complex_long_double_ref( 0 );
421 }
422 if( position <= -1 ){
423 gsl_error( "trying to dereference beyond begin()", __FILE__, __LINE__, exception::GSL_EFAILED );
424 return complex_long_double_ref( 0 );
425 }
426 // position and v are valid: return data
427 return complex_long_double_ref( v->ccgsl_pointer->data + CCGSL_MTY * position * v->ccgsl_pointer->stride );
428 }
429 // // operator->
435 // First check that iterator is initialised.
436 if( v == 0 ){
437 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
438 return pointer( 0 );
439 } else if( v->ccgsl_pointer == 0 ){
440 gsl_error( "vector_complex_long_double not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
441 return pointer( 0 );
442 }
443 // Check that position make sense
444 if( position >= static_cast<difference_type>( v->size() ) ){
445 gsl_error( "trying to dereference end()", __FILE__, __LINE__, exception::GSL_EFAILED );
446 return pointer( 0 );
447 }
448 if( position <= -1 ){
449 gsl_error( "trying to dereference rend()", __FILE__, __LINE__, exception::GSL_EFAILED );
450 return pointer( 0 );
451 }
452 // position and v are valid: return data
453 return pointer( v->ccgsl_pointer->data + CCGSL_MTY * position * v->ccgsl_pointer->stride );
454 }
455 // // operator[]
462 // First check that iterator is initialised.
463 if( v == 0 ){
464 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
465 return reference( 0 );
466 } else if( v->ccgsl_pointer == 0 ){
467 gsl_error( "vector_complex_long_double not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
468 return reference( 0 );
469 }
470 // Check that position make sense
471 difference_type const p = reverse_t ? position - n : position + n;
472 if( p >= static_cast<difference_type>( v->size() ) ){
473 gsl_error( "trying to dereference beyond rbegin()", __FILE__, __LINE__, exception::GSL_EFAILED );
474 return reference( 0 );
475 }
476 if( p <= -1 ){
477 gsl_error( "trying to dereference beyond begin()", __FILE__, __LINE__, exception::GSL_EFAILED );
478 return reference( 0 );
479 }
480 // p is a valid position
481 return reference( v->ccgsl_pointer->data + CCGSL_MTY * p * v->ccgsl_pointer->stride );
482 }
483 // // operator-: find distance between two iterators
490 // Warn if either iterator undefined
491 if( v == 0 or i.v == 0 ){
492 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
493 return 0;
494 } else if( v->ccgsl_pointer == 0 or i.v->ccgsl_pointer == 0 ){
495 gsl_error( "vector_complex_long_double not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
496 return 0;
497 }
498 // Warn if iterators do not point to same vector_complex_long_double
499 if( v->ccgsl_pointer != i.v->ccgsl_pointer ){
500 gsl_error( "trying to take difference of iterators for different vector_complex_long_double objects", __FILE__, __LINE__,
502 return 0;
503 }
504 return reverse_t ? i.position - position : position - i.position;
505 }
506 // // operator!=
507 // // operator<
514 return this->v == i.v and this->position == i.position;
515 }
522 return not this->operator==( i );
523 }
532 // Warn if either iterator undefined
533 if( v == 0 or i.v == 0 ){
534 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
535 return false;
536 }
537 // Warn if iterators do not point to same vector_complex_long_double
538 if( v->ccgsl_pointer != i.v->ccgsl_pointer ){
539 gsl_error( "trying to take difference of iterators for different vector_complex_long_double objects", __FILE__, __LINE__,
541 return false;
542 }
543 return reverse_t ? i.position < position : position < i.position;
544 }
545 protected:
550 void increment(){
551 // Only makes sense if v points to a vector_complex_long_double
552 if( v == 0 ){
553 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
554 return;
555 } else if( v->ccgsl_pointer == 0 ){
556 gsl_error( "vector_complex_long_double not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
557 return;
558 }
559 // increment position and check against size
560 if( reverse_t ){ if( position >= 0 ) --position; }
561 else { if( position < static_cast<difference_type>( v->size() ) ) ++position; }
562 }
567 void decrement(){
568 // Only makes sense if v points to a vector_complex_long_double
569 if( v == 0 ){
570 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
571 return;
572 } else if( v->ccgsl_pointer == 0 ){
573 gsl_error( "vector_complex_long_double not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
574 return;
575 }
576 // decrement position and check against size
577 if( reverse_t ){ if( position < static_cast<difference_type>( v->size() ) ) ++position; }
578 else { if( position >= 0 ) --position; }
579 }
584 void shift( difference_type const n ){
585 // Warn if iterator undefined
586 if( v == 0 ){
587 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
588 return;
589 } else if( v->ccgsl_pointer == 0 ){
590 gsl_error( "vector_complex_long_double not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
591 return;
592 }
593 position += reverse_t ? -n : n;
594 }
598 iterator_base(){ v = 0; }
605 : v( v ), position( position ){}
609 container* v;
614 };
615 // Need to know about const_iterator_t
616 template<bool reverse_t> class const_iterator_t;
620 template<bool reverse_t> class iterator_t : public iterator_base<vector_complex_long_double,long double,reverse_t>{
621 public:
622 // // Refines output iterator
623 // // operator=
631 return *this;
632 }
633 // // Refines forward iterator
634 // // operator++ (both)
641 return *this;
642 }
648 // return value
651 return result;
652 }
653 // // Refines bidirectional iterator
654 // // operator-- (both)
661 return *this;
662 }
668 // return value
671 return result;
672 }
678 // // operator+=
685 this->shift( n );
686 return *this;
687 }
688 // // operator-=
695 this->shift( -n );
696 return *this;
697 }
698 // // operator+ (n+i)(i+n)
707 result.shift( n );
708 return result;
709 }
710 // // operator- (n-i)(i-n)(i-j)
719 result.shift( -n );
720 return result;
721 }
729 }
736 // Warn if either iterator undefined
737 if( this->v == 0 or i.v == 0 ){
738 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
739 return 0;
740 } else if( this->v->ccgsl_pointer == 0 or i.v->ccgsl_pointer == 0 ){
741 gsl_error( "vector_complex_long_double not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
742 return 0;
743 }
744 // Warn if iterators do not point to same vector_complex_long_double
745 if( this->v->ccgsl_pointer != i.v->ccgsl_pointer ){
746 gsl_error( "trying to take difference of iterators for different vector_complex_long_double objects", __FILE__, __LINE__,
748 return 0;
749 }
750 return reverse_t ? i.position - this->position : this->position - i.position;
751 }
758 return this->v == i.v and this->position == i.position;
759 }
766 return not this->operator==( i );
767 }
773 bool operator<( const_iterator_t<reverse_t> const& i ) const {
774 // Warn if either iterator undefined
775 if( this->v == 0 or i.v == 0 ){
776 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
777 return false;
778 }
779 // Warn if iterators do not point to same vector_complex_long_double
780 if( this->v->ccgsl_pointer != i.v->ccgsl_pointer ){
781 gsl_error( "trying to take difference of iterators for different vector_complex_long_double objects", __FILE__, __LINE__,
783 return false;
784 }
785 return reverse_t ? i.position < this->position : this->position < i.position;
786 }
791 protected:
793 // We need a constructor for vector_complex_long_double
800 : iterator_base<vector_complex_long_double,long double,reverse_t>( v, position ){}
801 };
805 template<bool reverse_t> class const_iterator_t
806 : public iterator_base<vector_complex_long_double const,long double,reverse_t>{
807 public:
808 // // Refines output iterator
809 // // operator=
817 return *this;
818 }
819 // // Refines forward iterator
820 // // operator++ (both)
827 return *this;
828 }
834 // return value
837 return result;
838 }
839 // // Refines bidirectional iterator
840 // // operator-- (both)
847 return *this;
848 }
854 // return value
857 return result;
858 }
864 // // operator+=
871 this->shift( n );
872 return *this;
873 }
874 // // operator-=
881 this->shift( -n );
882 return *this;
883 }
884 // // operator+ (n+i)(i+n)
893 result += n;
894 return result;
895 }
896 // // operator- (n-i)(i-n)(i-j)
905 result -= n;
906 return result;
907 }
915 }
922 // Warn if either iterator undefined
923 if( this->v == 0 or i.v == 0 ){
924 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
925 return 0;
926 } else if( this->v->ccgsl_pointer == 0 or i.v->ccgsl_pointer == 0 ){
927 gsl_error( "vector_complex_long_double not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
928 return 0;
929 }
930 // Warn if iterators do not point to same vector_complex_long_double
931 if( this->v->ccgsl_pointer != i.v->ccgsl_pointer ){
932 gsl_error( "trying to take difference of iterators for different vector_complex_long_double objects", __FILE__, __LINE__,
934 return 0;
935 }
936 return reverse_t ? i.position - this->position : this->position - i.position;
937 }
949 }
955 bool operator==( iterator_t<reverse_t> const& i ) const {
956 return this->v == i.v and this->position == i.position;
957 }
963 bool operator!=( iterator_t<reverse_t> const& i ) const {
964 return not this->operator==( i );
965 }
971 bool operator<( iterator_t<reverse_t> const& i ) const {
972 // Warn if either iterator undefined
973 if( this->v == 0 or i.v == 0 ){
974 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
975 return false;
976 }
977 // Warn if iterators do not point to same vector_complex_long_double
978 if( this->v->ccgsl_pointer != i.v->ccgsl_pointer ){
979 gsl_error( "trying to take difference of iterators for different vector_complex_long_double objects", __FILE__, __LINE__,
981 return false;
982 }
983 return reverse_t ? i.position < this->position : this->position < i.position;
984 }
991 return this->v == i.v and this->position == i.position;
992 }
999 return not this->operator==( i );
1000 }
1007 // Warn if either iterator undefined
1008 if( this->v == 0 or i.v == 0 ){
1009 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
1010 return false;
1011 }
1012 // Warn if iterators do not point to same vector_complex
1013 if( this->v->ccgsl_pointer != i.v->ccgsl_pointer ){
1014 gsl_error( "trying to take difference of iterators for different vector_complex objects", __FILE__, __LINE__,
1016 return false;
1017 }
1018 return reverse_t ? i.position < this->position : this->position < i.position;
1019 }
1020 protected:
1021 // We need a constructor for vector_complex_long_double
1029 : iterator_base<vector_complex_long_double const,long double,reverse_t>( v, position ){}
1030 };
1031 public:
1048 // type difference_type
1053 // type size_type
1057 typedef size_t size_type;
1058 // begin()
1064 return iterator( this, 0 );
1065 }
1071 return const_iterator( this, 0 );
1072 }
1073 // end()
1079 if( ccgsl_pointer == 0 ) return iterator( this, 0 );
1080 return iterator( this, size() );
1081 }
1087 if( ccgsl_pointer == 0 ) return const_iterator( this, 0 );
1088 return const_iterator( this, size() );
1089 }
1090 // size()
1095 size_type size() const { return ccgsl_pointer == 0 ? 0 : ccgsl_pointer->size; }
1103 long double* data() {
1104 if( ccgsl_pointer == 0 ) gsl_error( "null vector", __FILE__, __LINE__, GSL_EFAULT );
1105#ifndef GSL_RANGE_CHECK_OFF
1106 if( ccgsl_pointer->stride != 1 )
1107 gsl_error( "vector does not have stride of size 1", __FILE__, __LINE__, GSL_EBADLEN );
1108#endif
1109 return ccgsl_pointer->data; }
1117 long double const* data() const {
1118 if( ccgsl_pointer == 0 ) gsl_error( "null vector", __FILE__, __LINE__, GSL_EFAULT );
1119#ifndef GSL_RANGE_CHECK_OFF
1120 if( ccgsl_pointer->stride != 1 )
1121 gsl_error( "vector does not have stride of size 1", __FILE__, __LINE__, GSL_EBADLEN );
1122#endif
1123 return ccgsl_pointer->data; }
1124 // max_size()
1130 size_type max_size() const { return ccgsl_pointer == 0 ? 0 : ccgsl_pointer->size; }
1131 // empty()
1136 bool empty() const { return ccgsl_pointer == 0 or ccgsl_pointer->size == 0; }
1137 // swap() --- should work even if sizes don't match
1144 gsl_vector_complex_long_double* tmp = ccgsl_pointer; ccgsl_pointer = v.ccgsl_pointer; v.ccgsl_pointer = tmp;
1145 size_t* tmp2 = count; count = v.count; v.count = tmp2;
1146 }
1147 // Refines reversible container
1148 // rbegin()
1154 if( ccgsl_pointer ==0 ) return reverse_iterator( this, 0 );
1155 return reverse_iterator( this, size() - 1 );
1156 }
1162 if( ccgsl_pointer ==0 ) return const_reverse_iterator( this, 0 );
1163 return const_reverse_iterator( this, size() - 1 );
1164 }
1165 // rend()
1171 return reverse_iterator( this, -1 );
1172 }
1178 return const_reverse_iterator( this, -1 );
1179 }
1180 // operator[]
1187 // First check that iterator is initialised.
1188 if( ccgsl_pointer == 0 ){
1189 gsl_error( "vector_complex_long_double is null", __FILE__, __LINE__, exception::GSL_EFAILED );
1190 return complex_long_double_ref( 0 );
1191 }
1192#ifndef GSL_RANGE_CHECK_OFF
1193 // Check that position make sense
1194 if( n >= size() ){
1195 gsl_error( "trying to read beyond end of vector_complex_long_double", __FILE__, __LINE__, exception::GSL_EFAILED );
1196 return complex_long_double_ref( 0 );
1197 }
1198 // n is a valid position
1199#endif
1200 return complex_long_double_ref( ccgsl_pointer->data + CCGSL_MTY * n * ccgsl_pointer->stride );
1201 }
1207 complex_long_double_ref const operator[]( size_t const n ) const {
1208 // First check that iterator is initialised.
1209 if( ccgsl_pointer == 0 ){
1210 gsl_error( "vector_complex_long_double is null", __FILE__, __LINE__, exception::GSL_EFAILED );
1211 return complex_long_double_ref( 0 );
1212 }
1213#ifndef GSL_RANGE_CHECK_OFF
1214 // Check that position make sense
1215 if( n >= size() ){
1216 gsl_error( "trying to read beyond end of vector_complex_long_double", __FILE__, __LINE__, exception::GSL_EFAILED );
1217 return complex_long_double_ref( 0 );
1218 }
1219 // n is a valid position
1220#endif
1221 return complex_long_double_ref( ccgsl_pointer->data + n * ccgsl_pointer->stride );
1222 }
1223 private:
1231 gsl_vector_complex_long_double* ccgsl_pointer;
1235 size_t* count;
1236 public:
1237 // shared reference functions
1242 gsl_vector_complex_long_double* get() { return ccgsl_pointer; }
1247 gsl_vector_complex_long_double const* get() const { return ccgsl_pointer; }
1253 bool unique() const { return count != 0 and *count == 1; }
1258 size_t use_count() const { return count == 0 ? 0 : *count; }
1264#ifdef __GXX_EXPERIMENTAL_CXX0X__
1265 explicit
1266#endif
1267 operator bool() const { return ccgsl_pointer != 0; }
1268
1269 // GSL functions
1276 static vector_complex_long_double calloc( size_t const n ){ return vector_complex_long_double( gsl_vector_complex_long_double_calloc( n ) ); }
1280 void set_zero(){ gsl_vector_complex_long_double_set_zero( get() ); }
1285 void set_all( complex_long_double x ){ gsl_vector_complex_long_double_set_all( get(), x ); }
1291 int set_basis( size_t i ){ return gsl_vector_complex_long_double_set_basis( get(), i ); }
1297 int memcpy( vector_complex_long_double const& src ){ return gsl_vector_complex_long_double_memcpy( get(), src.get() ); }
1302 int reverse(){ return gsl_vector_complex_long_double_reverse( get() ); }
1309 int swap_elements( size_t const i, size_t const j ){
1310 return gsl_vector_complex_long_double_swap_elements( get(), i, j ); }
1316 int add( vector_complex_long_double const& b ){ return gsl_vector_complex_long_double_add( get(), b.get() ); }
1322 int sub( vector_complex_long_double const& b ){ return gsl_vector_complex_long_double_sub( get(), b.get() ); }
1328 int mul( vector_complex_long_double const& b ){ return gsl_vector_complex_long_double_mul( get(), b.get() ); }
1334 int div( vector_complex_long_double const& b ){ return gsl_vector_complex_long_double_div( get(), b.get() ); }
1340 int scale( complex_long_double const x ){ return gsl_vector_complex_long_double_scale( get(), x ); }
1346 int add_constant( complex_long_double const x ){ return gsl_vector_complex_long_double_add_constant( get(), x ); }
1355 complex_long_double const beta ){
1356 return gsl_vector_complex_long_double_axpby( alpha, x.get(), beta, get() );
1357 }
1362 int isnull() const { return gsl_vector_complex_long_double_isnull( get() ); }
1367 int ispos() const { return gsl_vector_complex_long_double_ispos( get() ); }
1372 int isneg() const { return gsl_vector_complex_long_double_isneg( get() ); }
1377 int isnonneg() const { return gsl_vector_complex_long_double_isnonneg( get() ); }
1383 complex_long_double get( size_t const i ) const { return gsl_vector_complex_long_double_get( get(), i ); }
1389 void set( size_t const i, complex_long_double x ){ gsl_vector_complex_long_double_set( get(), i, x ); }
1395 complex_long_double_ptr ptr( size_t const i ){
1396 if( i >= ccgsl_pointer->size )
1397 gsl_error( "Index out of range", __FILE__, __LINE__, exception::GSL_EINVAL );
1398 return complex_long_double_ptr( ccgsl_pointer->data + CCGSL_MTY * i ); }
1404 complex_long_double_ptr const const_ptr( size_t const i ){
1405 if( i >= ccgsl_pointer->size )
1406 gsl_error( "Index out of range", __FILE__, __LINE__, exception::GSL_EINVAL );
1407 return complex_long_double_ptr( ccgsl_pointer->data + CCGSL_MTY * i ); }
1413 int fread( FILE* stream ){ return gsl_vector_complex_long_double_fread( stream, get() ); }
1419 int fwrite( FILE* stream ) const { return gsl_vector_complex_long_double_fwrite( stream, get() ); }
1425 int fscanf( FILE* stream ){ return gsl_vector_complex_long_double_fscanf( stream, get() ); }
1432 int fprintf( FILE* stream, char const* format ) const {
1433 return gsl_vector_complex_long_double_fprintf( stream, get(), format ); }
1441 vector_complex_long_double( block_complex_long_double& b, size_t const offset, size_t const n, size_t const stride = 1 ){
1442 ccgsl_pointer = gsl_vector_complex_long_double_alloc_from_block( b.get(), offset, n, stride );
1443 // just plausibly we could allocate vector_complex_long_double but not count
1444 try { count = new size_t; } catch( std::bad_alloc& e ){
1445 // try to tidy up before rethrowing
1446 gsl_vector_complex_long_double_free( ccgsl_pointer );
1447 throw e;
1448 }
1449 *count = 1; // initially there is just one reference to ccgsl_pointer
1450 }
1458 vector_complex_long_double( vector_complex_long_double& v, size_t const offset, size_t const n, size_t const stride = 1 ){
1459 ccgsl_pointer = gsl_vector_complex_long_double_alloc_from_vector( v.get(), offset, n, stride );
1460 // just plausibly we could allocate vector_complex_long_double but not count
1461 try { count = new size_t; } catch( std::bad_alloc& e ){
1462 // try to tidy up before rethrowing
1463 gsl_vector_complex_long_double_free( ccgsl_pointer );
1464 throw e;
1465 }
1466 *count = 1; // initially there is just one reference to ccgsl_pointer
1467 }
1522 static vector_complex_long_double view_array( long double* v, size_t n ){
1523 gsl_vector_complex_long_double* w = static_cast<gsl_vector_complex_long_double*>( malloc( sizeof( gsl_vector_complex_long_double ) ) );
1524 *w = gsl_vector_complex_long_double_view_array( v, n ).vector;
1525 return vector_complex_long_double( w );
1526 }
1527
1528
1536 static vector_complex_long_double view_array_with_stride( long double* base, size_t stride, size_t n ){
1537 gsl_vector_complex_long_double* w = static_cast<gsl_vector_complex_long_double*>( malloc( sizeof( gsl_vector_complex_long_double ) ) );
1538 *w = gsl_vector_complex_long_double_view_array_with_stride( base, stride, n ).vector;
1539 return vector_complex_long_double( w );
1540 }
1541
1542
1549 static vector_complex_long_double const const_view_array( long double const* v, size_t n ){
1550 gsl_vector_complex_long_double* w = static_cast<gsl_vector_complex_long_double *>( malloc( sizeof( gsl_vector_complex_long_double ) ) );
1551 *w = gsl_vector_complex_long_double_const_view_array( v, n ).vector;
1552 return vector_complex_long_double( w );
1553 }
1554
1555
1563 static vector_complex_long_double const const_view_array_with_stride( long double const* base, size_t stride, size_t n ){
1564 gsl_vector_complex_long_double* w = static_cast<gsl_vector_complex_long_double*>( malloc( sizeof( gsl_vector_complex_long_double ) ) );
1565 *w = gsl_vector_complex_long_double_const_view_array_with_stride( base, stride, n ).vector;
1566 return vector_complex_long_double( w );
1567 }
1568
1569
1570#ifndef DOXYGEN_SKIP
1577 static vector_complex_long_double const view_array( long double const* v, size_t n ){
1578 gsl_vector_complex_long_double* w = static_cast<gsl_vector_complex_long_double*>( malloc( sizeof( gsl_vector_complex_long_double ) ) );
1579 *w = gsl_vector_complex_long_double_const_view_array( v, n ).vector;
1580 return vector_complex_long_double( w );
1581 }
1582#endif //DOXYGEN_SKIP
1583
1584
1585#ifndef DOXYGEN_SKIP
1593 static vector_complex_long_double const view_array_with_stride( long double const* base, size_t stride, size_t n ){
1594 gsl_vector_complex_long_double* w = static_cast<gsl_vector_complex_long_double*>( malloc( sizeof( gsl_vector_complex_long_double ) ) );
1595 *w = gsl_vector_complex_long_double_const_view_array_with_stride( base, stride, n ).vector;
1596 return vector_complex_long_double( w );
1597 }
1598#endif //DOXYGEN_SKIP
1599
1600
1608 gsl_vector_complex_long_double* w = static_cast<gsl_vector_complex_long_double*>( malloc( sizeof( gsl_vector_complex_long_double ) ) );
1609 *w = gsl_vector_complex_long_double_subvector( get(), i, n ).vector;
1610 return vector_complex_long_double( w );
1611 }
1612
1613
1621 vector_complex_long_double subvector_with_stride( size_t i, size_t stride, size_t n ){
1622 gsl_vector_complex_long_double* w = static_cast<gsl_vector_complex_long_double*>( malloc( sizeof( gsl_vector_complex_long_double ) ) );
1623 *w = gsl_vector_complex_long_double_subvector_with_stride( get(), i, stride, n ).vector;
1624 return vector_complex_long_double( w );
1625 }
1626
1627
1634 vector_complex_long_double const const_subvector( size_t i, size_t n ) const {
1635 gsl_vector_complex_long_double* w = static_cast<gsl_vector_complex_long_double*>( malloc( sizeof( gsl_vector_complex_long_double ) ) );
1636 *w = gsl_vector_complex_long_double_const_subvector( get(), i, n ).vector;
1637 return vector_complex_long_double( w );
1638 }
1639
1640
1648 vector_complex_long_double const const_subvector_with_stride( size_t i, size_t stride, size_t n ) const {
1649 gsl_vector_complex_long_double* w = static_cast<gsl_vector_complex_long_double*>( malloc( sizeof( gsl_vector_complex_long_double ) ) );
1650 *w = gsl_vector_complex_long_double_const_subvector_with_stride( get(), i, stride, n ).vector;
1651 return vector_complex_long_double( w );
1652 }
1653
1654
1655#ifndef DOXYGEN_SKIP
1662 vector_complex_long_double const subvector( size_t i, size_t n ) const {
1663 gsl_vector_complex_long_double* w = static_cast<gsl_vector_complex_long_double*>( malloc( sizeof( gsl_vector_complex_long_double ) ) );
1664 *w = gsl_vector_complex_long_double_const_subvector( get(), i, n ).vector;
1665 return vector_complex_long_double( w );
1666 }
1667#endif //DOXYGEN_SKIP
1668
1669
1670#ifndef DOXYGEN_SKIP
1678 vector_complex_long_double const subvector_with_stride( size_t i, size_t stride, size_t n ) const {
1679 gsl_vector_complex_long_double* w = static_cast<gsl_vector_complex_long_double*>( malloc( sizeof( gsl_vector_complex_long_double ) ) );
1680 *w = gsl_vector_complex_long_double_const_subvector_with_stride( get(), i, stride, n ).vector;
1681 return vector_complex_long_double( w );
1682 }
1683#endif //DOXYGEN_SKIP
1684
1685
1692 template<typename ARRAY>
1693 static vector_complex_long_double view_array( ARRAY& v, size_t n = 0 ){
1694 if(n > v.size())
1695 gsl_error( "n is too big", __FILE__, __LINE__, exception::GSL_EBADLEN );
1696 if(0 == n)
1697 n = v.size();
1698 gsl_vector_complex_long_double* w = static_cast<gsl_vector_complex_long_double*>( malloc( sizeof( gsl_vector_complex_long_double ) ) );
1699 *w = gsl_vector_complex_long_double_view_array( v.data(), n ).vector;
1700 return vector_complex_long_double( w );
1701 }
1702
1703
1711 template<typename ARRAY>
1712 static vector_complex_long_double view_array_with_stride( ARRAY& base, size_t stride, size_t n=0 ){
1713 if(0 == n)
1714 n = base.size()/stride;
1715 if((n-1)*stride > base.size())
1716 gsl_error( "n is too big", __FILE__, __LINE__, exception::GSL_EBADLEN );
1717 gsl_vector_complex_long_double* w = static_cast<gsl_vector_complex_long_double*>( malloc( sizeof( gsl_vector_complex_long_double ) ) );
1718 *w = gsl_vector_complex_long_double_view_array_with_stride( base.data(), stride, n ).vector;
1719 return vector_complex_long_double( w );
1720 }
1721
1722
1729 template<typename ARRAY>
1730 static vector_complex_long_double const const_view_array( ARRAY const& v, size_t n=0 ){
1731 if(n > v.size())
1732 gsl_error( "n is too big", __FILE__, __LINE__, exception::GSL_EBADLEN );
1733 if(0 == n)
1734 n = v.size();
1735 gsl_vector_complex_long_double* w = static_cast<gsl_vector_complex_long_double *>( malloc( sizeof( gsl_vector_complex_long_double ) ) );
1736 *w = gsl_vector_complex_long_double_const_view_array( v.data(), n ).vector;
1737 return vector_complex_long_double( w );
1738 }
1739
1740
1748 template<typename ARRAY>
1749 static vector_complex_long_double const const_view_array_with_stride( ARRAY const& base, size_t stride, size_t n=0 ){
1750 if(0 == n)
1751 n = base.size()/stride;
1752 if((n-1)*stride > base.size())
1753 gsl_error( "n is too big", __FILE__, __LINE__, exception::GSL_EBADLEN );
1754 gsl_vector_complex_long_double* w = static_cast<gsl_vector_complex_long_double*>( malloc( sizeof( gsl_vector_complex_long_double ) ) );
1755 *w = gsl_vector_complex_long_double_const_view_array_with_stride( base.data(), stride, n ).vector;
1756 return vector_complex_long_double( w );
1757 }
1758
1759
1760#ifndef DOXYGEN_SKIP
1767 template<typename ARRAY>
1768 static vector_complex_long_double const view_array( ARRAY const& v, size_t n=0 ){
1769 if(n > v.size())
1770 gsl_error( "n is too big", __FILE__, __LINE__, exception::GSL_EBADLEN );
1771 if(0 == n)
1772 n = v.size();
1773 gsl_vector_complex_long_double* w = static_cast<gsl_vector_complex_long_double*>( malloc( sizeof( gsl_vector_complex_long_double ) ) );
1774 *w = gsl_vector_complex_long_double_const_view_array( v.data(), n ).vector;
1775 return vector_complex_long_double( w );
1776 }
1777#endif //DOXYGEN_SKIP
1778
1779
1780#ifndef DOXYGEN_SKIP
1788 template<typename ARRAY>
1789 static vector_complex_long_double const view_array_with_stride( ARRAY const& base, size_t stride, size_t n ){
1790 if(0 == n)
1791 n = base.size()/stride;
1792 if((n-1)*stride > base.size())
1793 gsl_error( "n is too big", __FILE__, __LINE__, exception::GSL_EBADLEN );
1794 gsl_vector_complex_long_double* w = static_cast<gsl_vector_complex_long_double*>( malloc( sizeof( gsl_vector_complex_long_double ) ) );
1795 *w = gsl_vector_complex_long_double_const_view_array_with_stride( base.data(), stride, n ).vector;
1796 return vector_complex_long_double( w );
1797 }
1798#endif //DOXYGEN_SKIP
1799
1800 // Extra allocators from matrix_complex_long_double objects. The definition must come after matrix_complex_long_double.
1815 };
1816
1825
1834
1843 return i + n; }
1844
1853 return i + n; }
1854
1855}
1856#undef CCGSL_MTY
1857#endif
This class handles vector_complex_long_doubles as shared handles.
This class can be used like a pointer for complex_long_double objects so that we can iterate over a v...
This class can be used like a reference for complex_long_double objects so that we can iterate over a...
This class handles complex_long_double numbers.
@ GSL_EDOM
input domain error, e.g sqrt(-1)
Definition: exception.hpp:472
@ GSL_EFAILED
generic failure
Definition: exception.hpp:476
@ GSL_EINVAL
invalid argument supplied by user
Definition: exception.hpp:475
@ GSL_EBADLEN
matrix, vector lengths are not conformant
Definition: exception.hpp:490
This class handles matrix_complex_long_double objects as shared handles.
bool operator<(const_iterator_t< reverse_t > const &i) const
Comparison with const iterator.
const_iterator_t & operator=(const_iterator_t< reverse_t > const &i)
We can assign one output iterator from another.
bool operator!=(iterator_t< reverse_t > const &i) const
Comparison with non-const iterator.
const_iterator_t< reverse_t > & operator++()
The prefix ++ operator.
const_iterator_t< reverse_t > & operator+=(difference_type const n)
The += operator.
bool operator!=(const_iterator_t< reverse_t > const &i) const
Comparison with const iterator.
const_iterator_t(vector_complex_long_double const *v, difference_type position)
This constructor allows vector_complex_long_double to create non-default iterators.
const_iterator_t< reverse_t > & operator-=(difference_type const n)
The -= operator.
bool operator==(iterator_t< reverse_t > const &i) const
Comparison with non-const iterator.
difference_type operator-(iterator_t< reverse_t > const &i) const
The - operator: find distance between two iterators.
bool operator<(iterator_t< reverse_t > const &i) const
Comparison with non-const iterator.
const_iterator_t< reverse_t > & operator--()
The prefix – operator.
const_iterator_t< reverse_t > operator++(int)
The postfix ++ operator.
const_iterator_t< reverse_t > operator-(difference_type const n) const
The - operator: subtract distance from iterator.
bool operator==(const_iterator_t< reverse_t > const &i) const
Comparison with const iterator.
difference_type operator-(const_iterator_t< reverse_t > const &i) const
The - operator: find distance between two iterators.
const_iterator_t(iterator_t< reverse_t > const &i)
A copy constructor.
iterator_base< vector_complex_long_doubleconst, longdouble, reverse_t >::difference_type difference_type
Difference type.
const_iterator_t< reverse_t > operator--(int)
The postfix – operator.
const_iterator_t< reverse_t > operator+(difference_type const n) const
The + operator.
bool operator==(iterator_base< container, content, reverse_t > const &i) const
The == operator.
iterator_base(container *v, difference_type position)
This constructor allows vector_complex_long_double to create non-default iterators.
iterator_base()
The iterator is default constructible.
void shift(difference_type const n)
Shift iterator n places.
reference operator[](difference_type const n) const
Get element at i + n by reference ([] operator).
complex_long_double value_type
An iterator must have a value_type.
difference_type operator-(iterator_base< container, content, reverse_t > const &i) const
The - operator: find distance between two iterators.
reference operator*() const
Dereference the pointer.
difference_type position
Mark position of iterator within vector_complex_long_double.
ptrdiff_t difference_type
An iterator must have a difference_type.
bool operator!=(iterator_base< container, content, reverse_t > const &i) const
The != operator.
bool operator<(iterator_base< container, content, reverse_t > const &i) const
The < operator is used to compare iterators.
complex_long_double_ref reference
An iterator must have a reference type.
complex_long_double_ptr pointer
An iterator must have a pointer type.
pointer operator->() const
Dereference the pointer.
container * v
Store a pointer to a vector_complex_long_double we can iterate over: 0 if no vector_complex_long_doub...
std::random_access_iterator_tag iterator_category
An iterator must have a pointer type.
A class template for the two non-const iterators.
bool operator!=(const_iterator_t< reverse_t > const &i) const
Comparison with const iterator.
bool operator<(const_iterator_t< reverse_t > const &i) const
Comparison with const iterator.
iterator_t< reverse_t > operator-(difference_type const n) const
The - operator: subtract distance from iterator.
iterator_base< vector_complex_long_double, longdouble, reverse_t >::difference_type difference_type
Difference type.
iterator_t< reverse_t > operator--(int)
The postfix – operator.
iterator_t< reverse_t > operator++(int)
The postfix ++ operator.
iterator_t(vector_complex_long_double *v, difference_type position)
This constructor allows vector_complex_long_double to create non-default iterators.
iterator_t< reverse_t > & operator-=(difference_type const n)
The -= operator.
iterator_t< reverse_t > & operator++()
The prefix ++ operator.
iterator_t< reverse_t > & operator+=(difference_type const n)
The += operator.
difference_type operator-(iterator_t< reverse_t > const &i) const
The - operator: find distance between two iterators.
difference_type operator-(const_iterator_t< reverse_t > const &i) const
The - operator: find distance between two iterators.
bool operator==(const_iterator_t< reverse_t > const &i) const
Comparison with const iterator.
iterator_t< reverse_t > & operator=(iterator_t< reverse_t > const &i)
We can assign one output iterator from another.
iterator_t< reverse_t > & operator--()
The prefix – operator.
iterator_t< reverse_t > operator+(difference_type const n) const
The + operator.
This class handles vector_complex_long_double objects as shared handles.
int fprintf(FILE *stream, char const *format) const
C++ version of gsl_vector_complex_long_double_fprintf().
reference const const_reference
A container must have a constant reference type.
vector_complex_long_double(vector_complex_long_double &&v)
Move constructor.
complex_long_double get(size_t const i) const
C++ version of gsl_vector_complex_long_double_get().
bool unique() const
Find if this is the only object sharing the gsl_vector_complex_long_double.
complex_long_double_ref reference
A container must have a reference type.
complex_long_double_ref operator[](size_t const n)
Get element at position n by reference ([] operator).
complex_long_double value_type
A container must have a value_type.
vector_complex_long_double(std::initializer_list< std::complex< long double > > initializer_list)
Could construct from a std::initializer_list in C++11.
int reverse()
C++ version of gsl_vector_complex_long_double_reverse().
int memcpy(vector_complex_long_double const &src)
C++ version of gsl_vector_complex_long_double_memcpy().
complex_long_double_ptr ptr(size_t const i)
C++ version of gsl_vector_complex_long_double_ptr().
gsl::vector_long_double const real() const
Another C++ version of gsl_vector_complex_const_real().
int ispos() const
C++ version of gsl_vector_complex_long_double_ispos().
size_type max_size() const
The max size (number of elements) of the vector_complex_long_double.
const_iterator_t< false > const_iterator
The const_iterator type.
void set_zero()
C++ version of gsl_vector_complex_long_double_set_zero().
int mul(vector_complex_long_double const &b)
C++ version of gsl_vector_complex_long_double_mul().
static vector_complex_long_double const const_view_array(ARRAY const &v, size_t n=0)
C++ version of gsl_vector_complex_long_double _const_view_array().
complex_long_double_ptr pointer
A container must have a pointer type.
complex_long_double_ptr const const_pointer
A container must have a constant pointer type.
const_iterator begin() const
Get iterator pointing to first vector_complex_long_double element.
bool operator>=(vector_complex_long_double const &v) const
A container needs to define an ordering for sorting.
vector_complex_long_double & operator=(vector_complex_long_double &&v)
Move operator.
static vector_complex_long_double alloc_col_from_matrix(matrix_complex_long_double &m, size_t const j)
C++ version of gsl_vector_complex_long_double_alloc_col_from_matrix().
int scale(complex_long_double const x)
C++ version of gsl_vector_complex_long_double_scale().
int div(vector_complex_long_double const &b)
C++ version of gsl_vector_complex_long_double_div().
static vector_complex_long_double const const_view_array(long double const *v, size_t n)
C++ version of gsl_vector_complex_long_double _const_view_array().
vector_complex_long_double(vector_complex_long_double &v, size_t const offset, size_t const n, size_t const stride=1)
C++ version of gsl_vector_complex_long_double_alloc_from_vector().
int isneg() const
C++ version of gsl_vector_complex_long_double_isneg().
int swap_elements(size_t const i, size_t const j)
C++ version of gsl_vector_complex_long_double_swap_elements().
int sub(vector_complex_long_double const &b)
C++ version of gsl_vector_complex_long_double_sub().
vector_complex_long_double const const_subvector(size_t i, size_t n) const
C++ version of gsl_vector_complex_long_double_const_subvector().
bool operator!=(vector_complex_long_double const &v) const
Two vector_complex_long_double objects are different equal if their elements are not identical.
vector_complex_long_double(block_complex_long_double &b, size_t const offset, size_t const n, size_t const stride=1)
C++ version of gsl_vector_complex_long_double_alloc_from_block().
int set_basis(size_t i)
C++ version of gsl_vector_complex_long_double_set_basis().
vector_complex_long_double(size_t const n)
The default constructor creates a new vector_complex_long_double with n elements.
const_iterator::difference_type difference_type
A container must have a difference_type.
reverse_iterator rend()
Get iterator pointing beyond last vector_complex_long_double element.
gsl_vector_complex_long_double const * get() const
Get the gsl_vector_complex_long_double.
gsl::vector_long_double real()
C++ version of gsl_vector_complex_real().
vector_complex_long_double const const_subvector_with_stride(size_t i, size_t stride, size_t n) const
C++ version of gsl_vector_complex_long_double_const_subvector_with_stride().
iterator begin()
Get iterator pointing to first vector_complex_long_double element.
iterator_t< true > reverse_iterator
The reverse_iterator type.
vector_complex_long_double & operator=(vector_complex_long_double const &v)
The assignment operator.
const_iterator end() const
Get iterator pointing beyond last vector_complex_long_double element.
complex_long_double_ref const operator[](size_t const n) const
Get element at position n by reference ([] operator).
long double * data()
Give access to the data block.
void swap(vector_complex_long_double &v)
Swap two vector_complex_long_double objects.
static vector_complex_long_double view_array(ARRAY &v, size_t n=0)
C++ version of gsl_vector_complex_long_double_view_array().
bool operator>(vector_complex_long_double const &v) const
A container needs to define an ordering for sorting.
int fwrite(FILE *stream) const
C++ version of gsl_vector_complex_long_double_fwrite().
static vector_complex_long_double view_array_with_stride(long double *base, size_t stride, size_t n)
C++ version of gsl_vector_complex_long_double_view_array_with_stride().
vector_complex_long_double()
The default constructor is only really useful for assigning to.
int isnull() const
C++ version of gsl_vector_complex_long_double_isnull().
size_t use_count() const
Find how many vector_complex_long_double objects share this pointer.
static vector_complex_long_double const const_view_array_with_stride(ARRAY const &base, size_t stride, size_t n=0)
C++ version of gsl_vector_complex_long_double_const_view_array_with_stride().
vector_complex_long_double subvector(size_t i, size_t n)
C++ version of gsl_vector_complex_long_double_subvector().
reverse_iterator rbegin()
Get iterator pointing to first vector_complex_long_double element.
void reset()
Stop sharing ownership of the shared pointer.
const_iterator_t< true > const_reverse_iterator
The const_reverse_t type.
vector_complex_long_double(vector_complex_long_double const &v)
The copy constructor.
gsl::vector_long_double imag()
C++ version of gsl_vector_complex_imag().
gsl::vector_long_double const const_real() const
C++ version of gsl_vector_complex_const_real().
bool operator<(vector_complex_long_double const &v) const
A container needs to define an ordering for sorting.
bool operator<=(vector_complex_long_double const &v) const
A container needs to define an ordering for sorting.
size_t * count
The shared reference count.
int add(vector_complex_long_double const &b)
C++ version of gsl_vector_complex_long_double_add().
int fread(FILE *stream)
C++ version of gsl_vector_complex_long_double_fread().
bool empty() const
Find if the vector_complex_long_double is empty.
static vector_complex_long_double alloc_row_from_matrix(matrix_complex_long_double &m, size_t const i)
C++ version of gsl_vector_complex_long_double_alloc_row_from_matrix().
int add_constant(complex_long_double const x)
C++ version of gsl_vector_complex_long_double_add_constant().
iterator end()
Get iterator pointing beyond last vector_complex_long_double element.
int fscanf(FILE *stream)
C++ version of gsl_vector_complex_long_double_fscanf().
bool owns_data
Used to allow a vector that does not own its data.
int axpby(complex_long_double const alpha, vector_complex_long_double const &x, complex_long_double const beta)
C++ version of gsl_vector_complex_long_double_axpby().
const_reverse_iterator rend() const
Get iterator pointing beyond last vector_complex_long_double element.
complex_long_double_ptr const const_ptr(size_t const i)
C++ version of gsl_vector_complex_long_double_const_ptr().
gsl_vector_complex_long_double * get()
Get the gsl_vector_complex_long_double.
vector_complex_long_double subvector_with_stride(size_t i, size_t stride, size_t n)
C++ version of gsl_vector_complex_long_double_subvector_with_stride().
vector_complex_long_double clone() const
The clone function.
size_type size() const
The size (number of elements) of the vector_complex_long_double.
gsl::vector_long_double const imag() const
Another C++ version of gsl_vector_complex_const_imag().
gsl_vector_complex_long_double * ccgsl_pointer
The shared pointer.
size_t size_type
A container must have a size_type.
int isnonneg() const
C++ version of gsl_vector_complex_long_double_isnonneg().
~vector_complex_long_double()
The destructor only deletes the pointers if count reaches zero.
const_reverse_iterator rbegin() const
Get iterator pointing to first vector_complex_long_double element.
gsl::vector_long_double const const_imag() const
C++ version of gsl_vector_complex_const_imag().
iterator_t< false > iterator
The iterator type.
long double const * data() const
Give access to the data block.
void wrap_gsl_vector_complex_long_double_without_ownership(gsl_vector_complex_long_double *v)
This function is intended mainly for internal use.
static vector_complex_long_double calloc(size_t const n)
C++ version of gsl_vector_complex_long_double_calloc().
void set_all(complex_long_double x)
C++ version of gsl_vector_complex_long_double_set_all().
bool operator==(vector_complex_long_double const &v) const
Two vector_complex_long_double objects are identically equal if their elements are identical.
static vector_complex_long_double const const_view_array_with_stride(long double const *base, size_t stride, size_t n)
C++ version of gsl_vector_complex_long_double_const_view_array_with_stride().
void set(size_t const i, complex_long_double x)
C++ version of gsl_vector_complex_long_double_set().
static vector_complex_long_double view_array(long double *v, size_t n)
C++ version of gsl_vector_complex_long_double_view_array().
static vector_complex_long_double view_array_with_stride(ARRAY &base, size_t stride, size_t n=0)
C++ version of gsl_vector_complex_long_double_view_array_with_stride().
This class handles vector_long_double objects as shared handles.
static vector_long_double view_array_with_stride(long double *base, size_t stride, size_t n)
C++ version of gsl_vector_long_double_view_array_with_stride().
static vector_long_double const const_view_array_with_stride(long double const *base, size_t stride, size_t n)
C++ version of gsl_vector_long_double_const_view_array_with_stride().
int min(movstat::end_t const endtype, vector const &x, vector &y, workspace &w)
C++ version of gsl_movstat_min().
Definition: movstat.hpp:581
double beta(rng const &r, double const a, double const b)
C++ version of gsl_ran_beta().
Definition: randist.hpp:262
size_t n(workspace const &w)
C++ version of gsl_rstat_n().
Definition: rstat.hpp:299
double b(int order, double qq)
C++ version of gsl_sf_mathieu_b().
Definition: sf_mathieu.hpp:298
gsl_sf_result result
Typedef for gsl_sf_result.
Definition: sf_result.hpp:30
The gsl package creates an interface to the GNU Scientific Library for C++.
Definition: blas.hpp:34
#define CCGSL_MTY