ccgsl 2.7.2
C++wrappersforGnuScientificLibrary
vector_long_double.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2010, 2011, 2012, 2019, 2020, 2021, 2024 John D Lamb
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or (at
7 * your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18
19#ifndef CCGSL_VECTOR_LONG_DOUBLE_HPP
20#define CCGSL_VECTOR_LONG_DOUBLE_HPP
21
22#include<gsl/gsl_vector_long_double.h>
23#include<new>
24#include<iterator>
25
26#include"exception.hpp"
28
29// This file is autogenerated
30
31namespace gsl {
32 // declare matrix_long_double class
33 class matrix_long_double;
46 public:
51 owns_data = false;
52 ccgsl_pointer = 0;
53 count = 0; // initially nullptr will do
54 }
55 // Refines random access container
56 // Refines assignable
61 explicit vector_long_double( size_t const n ) : owns_data(true){
62 if( n > 0 ) ccgsl_pointer = gsl_vector_long_double_alloc( n );
63 else { ccgsl_pointer = new gsl_vector_long_double; ccgsl_pointer->size = 0; ccgsl_pointer->data = 0; }
64 // just plausibly we could allocate vector_long_double but not count
65 try { count = new size_t; } catch( std::bad_alloc& e ){
66 // try to tidy up before rethrowing
67 if( n > 0 ) gsl_vector_long_double_free( ccgsl_pointer );
68 else delete ccgsl_pointer;
69 throw e;
70 }
71 *count = 1; // initially there is just one reference to ccgsl_pointer
72 }
73#ifndef DOXYGEN_SKIP
78 explicit vector_long_double( int const n ) : owns_data(true){
79 if( n > 0 ) ccgsl_pointer = gsl_vector_long_double_alloc( static_cast<size_t>( n ) );
80 else if(n<0)
81 gsl_error("failed tring to make a vector of negative length",
82 __FILE__, __LINE__, exception::GSL_EDOM );
83 else { ccgsl_pointer = new gsl_vector_long_double; ccgsl_pointer->size = 0; ccgsl_pointer->data = 0; }
84 // just plausibly we could allocate vector_long_double but not count
85 try { count = new size_t; } catch( std::bad_alloc& e ){
86 // try to tidy up before rethrowing
87 if( n > 0 ) gsl_vector_long_double_free( ccgsl_pointer );
88 else delete ccgsl_pointer;
89 throw e;
90 }
91 *count = 1; // initially there is just one reference to ccgsl_pointer
92 }
93#endif // DOXYGEN_SKIP
99 explicit vector_long_double( gsl_vector_long_double* v ) : owns_data(true){
100 ccgsl_pointer = v;
101 // just plausibly we could fail to allocate count: no further action needed.
102 count = new size_t;
103 *count = 1; // initially there is just one reference to ccgsl_pointer
104 }
105#ifdef __GXX_EXPERIMENTAL_CXX0X__
110 vector_long_double( std::initializer_list<long double> initializer_list ) : owns_data(true){
111 size_t const n = initializer_list.size();
112 ccgsl_pointer = gsl_vector_long_double_alloc( n );
113 // just plausibly we could allocate vector_long_double but not count
114 try { count = new size_t; } catch( std::bad_alloc& e ){
115 // try to tidy up before rethrowing
116 if( n > 0 ) gsl_vector_long_double_free( ccgsl_pointer );
117 else delete ccgsl_pointer;
118 throw e;
119 }
120 *count = 1; // initially there is just one reference to ccgsl_pointer
121 // now copy
122 auto p = begin();
123 for( auto x : initializer_list ){ *p = x; ++p; }
124 }
125#endif
126 // copy constructor
131 vector_long_double( vector_long_double const& v ) : owns_data( v.owns_data ),
132 ccgsl_pointer( v.ccgsl_pointer ), count( v.count ){
133 if( count != 0 ) ++*count; // vector_long_double is now shared.
134 }
139 vector_long_double( vector_long_double& v ) : owns_data( v.owns_data ),
140 ccgsl_pointer( v.ccgsl_pointer ), count( v.count ){
141 if( count != 0 ) ++*count; // vector_long_double is now shared.
142 }
143 // assignment operator
149 // first, possibly delete anything pointed to by @c this
150 if( count == 0 or --*count == 0 ){
151 if( ccgsl_pointer != 0 ){
152 if( ccgsl_pointer->size > 0 ) gsl_vector_long_double_free( ccgsl_pointer );
153 else delete ccgsl_pointer; }
154 delete count;
155 }
156 // Then copy
157 owns_data = v.owns_data;
158 ccgsl_pointer = v.ccgsl_pointer;
159 count = v.count;
160 if( count != 0 ) ++*count; // block_long_double is now shared.
161 return *this;
162 }
175 template<typename V> vector_long_double( V& v, size_t const stride = 1 ){
176 size_t const n = v.size() / stride;
177 ccgsl_pointer = static_cast<gsl_vector_long_double*>( malloc( sizeof( gsl_vector_long_double ) ) );
178 ccgsl_pointer->size = n;
179 ccgsl_pointer->stride = stride;
180 ccgsl_pointer->data = v.data();
181 ccgsl_pointer->block = 0;
182 ccgsl_pointer->owner = 0;
183 // just plausibly we could allocate vector_long_double but not count
184 try { count = new size_t; } catch( std::bad_alloc& e ){
185 // try to tidy up before rethrowing
186 if( n > 0 ) gsl_vector_long_double_free( ccgsl_pointer );
187 else delete ccgsl_pointer;
188 throw e;
189 }
190 *count = 1; // initially there is just one reference to ccgsl_pointer
191 }
192 // clone()
199 vector_long_double copy( get()->size );
200 // Now copy
201 gsl_vector_long_double_memcpy( copy.get(), get() );
202 // return new object
203 return copy;
204 }
205 // destructor
210 if( count != 0 and --*count == 0 ){
211 // could have allocated null pointer
212 if( ccgsl_pointer != 0 ){
213 if( ccgsl_pointer->size > 0 ) gsl_vector_long_double_free( ccgsl_pointer );
214 else delete ccgsl_pointer; }
215 delete count;
216 }
217 }
218
219 // Allow possibility of assigning from gsl_vector_long_double without sharing
228 void wrap_gsl_vector_long_double_without_ownership( gsl_vector_long_double* v ){
229 if( count != 0 and --*count == 0 ){
230 // could have allocated null pointer
231 if( ccgsl_pointer != 0 ){
232 if( ccgsl_pointer->size != 0 ) gsl_vector_long_double_free( ccgsl_pointer );
233 else delete ccgsl_pointer; }
234 }
235 ccgsl_pointer = v;
236 if(0 == count) count = new size_t;
237 *count = 2; // should never be able to delete ccgsl_pointer
238 }
239 // Refines equality comparable
240 // == operator
247 bool operator==( vector_long_double const& v ) const {
248 // trivially equal if gsl_vector_long_double*s are identical
249 if( ccgsl_pointer == v.ccgsl_pointer ) return true;
250 // trivially not equal if one is zero: != should be same as xor here
251 if( (ccgsl_pointer == 0) != (v.ccgsl_pointer == 0 ) ) return false;
252 // trivially not equal if sizes are different
253 if( ccgsl_pointer->size != v.ccgsl_pointer->size ) return false;
254 // check elementwise for equality
255 for( size_t i = 0; i < ccgsl_pointer->size; ++i )
256 if( gsl_vector_long_double_get( ccgsl_pointer, i ) != gsl_vector_long_double_get( v.ccgsl_pointer, i ) ) return false;
257 return true;
258 }
262 void reset(){ vector_long_double().swap( *this ); }
263#ifdef __GXX_EXPERIMENTAL_CXX0X__
268 vector_long_double( vector_long_double&& v ) : owns_data {v.owns_data},
269 ccgsl_pointer( v.ccgsl_pointer ), count( nullptr ){
270 std::swap( count, v.count );
271 v.ccgsl_pointer = nullptr;
272 }
279 vector_long_double( std::move( v ) ).swap( *this );
280 return *this;
281 }
282#endif
283 // != operator
290 bool operator!=( vector_long_double const& v ) const { return not operator==( v ); }
291 // Refines forward container
292 // Refines less than comparable
293 // operator<
302 bool operator<( vector_long_double const& v ) const {
303 // null vector_long_double comes first
304 if( ccgsl_pointer == 0 ) return v.ccgsl_pointer != 0;
305 // if v is null then this > v
306 if( v.ccgsl_pointer == 0 ) return false;
307 // Now compare elementwise
308 size_t const size = ccgsl_pointer->size;
309 size_t const v_size = v.ccgsl_pointer->size;
310 size_t const min = size > v_size ? size : v_size;
311 for( size_t i = 0; i < min; ++i ){
312 long double const t = gsl_vector_long_double_get( ccgsl_pointer, i );
313 long double const u =gsl_vector_long_double_get( v.ccgsl_pointer, i );
314 if( t < u ) return true;
315 if( u < t ) return false;
316 }
317 // elements match.
318 return size < v_size;
319 }
320 // operator>
329 bool operator>( vector_long_double const& v ) const {
330 // null vector_long_double comes first
331 if( ccgsl_pointer == 0 ) return false;
332 // if v is null then this > v
333 if( v.ccgsl_pointer == 0 ) return true;
334 // Now compare elementwise
335 size_t const size = ccgsl_pointer->size;
336 size_t const v_size = v.ccgsl_pointer->size;
337 size_t const min = size > v_size ? size : v_size;
338 for( size_t i = 0; i < min; ++i ){
339 long double const t = gsl_vector_long_double_get( ccgsl_pointer, i );
340 long double const u =gsl_vector_long_double_get( v.ccgsl_pointer, i );
341 if( t > u ) return true;
342 if( u > t ) return false;
343 }
344 // elements match.
345 return size > v_size;
346 }
347 // operator<=
356 bool operator<=( vector_long_double const& v ) const {
357 return operator<( v ) or operator==( v );
358 }
359 // operator>=
368 bool operator>=( vector_long_double const& v ) const {
369 return operator>( v ) or operator==( v );
370 }
371 // Refines container
372 // type value_type
376 typedef long double value_type;
377 // type reference
382 // type const_reference
387 // type pointer
392 // type const_pointer
396 typedef value_type const* const_pointer;
397 // type iterator
398 private:
403 template<typename container, typename content,bool reverse_t> class iterator_base {
404 friend class vector_long_double;
405 public:
409 typedef std::random_access_iterator_tag iterator_category;
413 typedef long double value_type;
422 // // type iterator_traits<vector_long_double>::difference_type
426 typedef ptrdiff_t difference_type;
427 public:
428 // // operator*
434 // Always try to return something
435 static content something = 0;
436 // First check that iterator is initialised.
437 if( v == 0 ){
438 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
439 return something;
440 } else if( v->ccgsl_pointer == 0 ){
441 gsl_error( "vector_long_double not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
442 return something;
443 }
444 // Check that position make sense
445 if( position >= static_cast<difference_type>( v->size() ) ){
446 gsl_error( "trying to dereference beyond rbegin()", __FILE__, __LINE__, exception::GSL_EFAILED );
447 return something;
448 }
449 if( position <= -1 ){
450 gsl_error( "trying to dereference beyond begin()", __FILE__, __LINE__, exception::GSL_EFAILED );
451 return something;
452 }
453 // position and v are valid: return data
454 return *(v->ccgsl_pointer->data + position * v->ccgsl_pointer->stride);
455 }
456 // // 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 0;
466 } else if( v->ccgsl_pointer == 0 ){
467 gsl_error( "vector_long_double not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
468 return 0;
469 }
470 // Check that position make sense
471 if( position >= static_cast<difference_type>( v->size() ) ){
472 gsl_error( "trying to dereference end()", __FILE__, __LINE__, exception::GSL_EFAILED );
473 return 0;
474 }
475 if( position <= -1 ){
476 gsl_error( "trying to dereference rend()", __FILE__, __LINE__, exception::GSL_EFAILED );
477 return 0;
478 }
479 // position and v are valid: return data
480 return v->ccgsl_pointer->data + position * v->ccgsl_pointer->stride;
481 }
482 // // operator[]
489 // Always try to return something
490 static content something = 0;
491 // First check that iterator is initialised.
492 if( v == 0 ){
493 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
494 return something;
495 } else if( v->ccgsl_pointer == 0 ){
496 gsl_error( "vector_long_double not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
497 return something;
498 }
499 // Check that position make sense
500 difference_type const p = reverse_t ? position - n : position + n;
501 if( p >= static_cast<difference_type>( v->size() ) ){
502 gsl_error( "trying to dereference beyond rbegin()", __FILE__, __LINE__, exception::GSL_EFAILED );
503 return something;
504 }
505 if( p <= -1 ){
506 gsl_error( "trying to dereference beyond begin()", __FILE__, __LINE__, exception::GSL_EFAILED );
507 return something;
508 }
509 // p is a valid position
510 return *(v->ccgsl_pointer->data + p * v->ccgsl_pointer->stride);
511 }
512 // // operator-: find distance between two iterators
519 // Warn if either iterator undefined
520 if( v == 0 or i.v == 0 ){
521 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
522 return 0;
523 } else if( v->ccgsl_pointer == 0 or i.v->ccgsl_pointer == 0 ){
524 gsl_error( "vector_long_double not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
525 return 0;
526 }
527 // Warn if iterators do not point to same vector_long_double
528 if( v->ccgsl_pointer != i.v->ccgsl_pointer ){
529 gsl_error( "trying to take difference of iterators for different vector_long_double objects", __FILE__, __LINE__,
531 return 0;
532 }
533 return reverse_t ? i.position - position : position - i.position;
534 }
535 // // operator!=
536 // // operator<
543 return this->v == i.v and this->position == i.position;
544 }
551 return not this->operator==( i );
552 }
561 // Warn if either iterator undefined
562 if( v == 0 or i.v == 0 ){
563 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
564 return false;
565 }
566 // Warn if iterators do not point to same vector_long_double
567 if( v->ccgsl_pointer != i.v->ccgsl_pointer ){
568 gsl_error( "trying to take difference of iterators for different vector_long_double objects", __FILE__, __LINE__,
570 return false;
571 }
572 return reverse_t ? i.position < position : position < i.position;
573 }
574 protected:
579 void increment(){
580 // Only makes sense if v points to a vector_long_double
581 if( v == 0 ){
582 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
583 return;
584 } else if( v->ccgsl_pointer == 0 ){
585 gsl_error( "vector_long_double not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
586 return;
587 }
588 // increment position and check against size
589 if( reverse_t ){ if( position >= 0 ) --position; }
590 else { if( position < static_cast<difference_type>( v->size() ) ) ++position; }
591 }
596 void decrement(){
597 // Only makes sense if v points to a vector_long_double
598 if( v == 0 ){
599 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
600 return;
601 } else if( v->ccgsl_pointer == 0 ){
602 gsl_error( "vector_long_double not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
603 return;
604 }
605 // decrement position and check against size
606 if( reverse_t ){ if( position < static_cast<difference_type>( v->size() ) ) ++position; }
607 else { if( position >= 0 ) --position; }
608 }
613 void shift( difference_type const n ){
614 // Warn if iterator undefined
615 if( v == 0 ){
616 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
617 return;
618 } else if( v->ccgsl_pointer == 0 ){
619 gsl_error( "vector_long_double not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
620 return;
621 }
622 position += reverse_t ? -n : n;
623 }
627 iterator_base(){ v = 0; }
634 : v( v ), position( position ){}
638 container* v;
643 };
644 // Need to know about const_iterator_t
645 template<bool reverse_t> class const_iterator_t;
649 template<bool reverse_t> class iterator_t : public iterator_base<vector_long_double,long double,reverse_t>{
650 public:
651 // // Refines output iterator
652 // // operator=
660 return *this;
661 }
662 // // Refines forward iterator
663 // // operator++ (both)
670 return *this;
671 }
677 // return value
680 return result;
681 }
682 // // Refines bidirectional iterator
683 // // operator-- (both)
690 return *this;
691 }
697 // return value
700 return result;
701 }
707 // // operator+=
714 this->shift( n );
715 return *this;
716 }
717 // // operator-=
724 this->shift( -n );
725 return *this;
726 }
727 // // operator+ (n+i)(i+n)
736 result.shift( n );
737 return result;
738 }
739 // // operator- (n-i)(i-n)(i-j)
748 result.shift( -n );
749 return result;
750 }
758 }
765 // Warn if either iterator undefined
766 if( this->v == 0 or i.v == 0 ){
767 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
768 return 0;
769 } else if( this->v->ccgsl_pointer == 0 or i.v->ccgsl_pointer == 0 ){
770 gsl_error( "vector_long_double not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
771 return 0;
772 }
773 // Warn if iterators do not point to same vector_long_double
774 if( this->v->ccgsl_pointer != i.v->ccgsl_pointer ){
775 gsl_error( "trying to take difference of iterators for different vector_long_double objects", __FILE__, __LINE__,
777 return 0;
778 }
779 return reverse_t ? i.position - this->position : this->position - i.position;
780 }
787 return this->v == i.v and this->position == i.position;
788 }
795 return not this->operator==( i );
796 }
802 bool operator<( const_iterator_t<reverse_t> const& i ) const {
803 // Warn if either iterator undefined
804 if( this->v == 0 or i.v == 0 ){
805 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
806 return false;
807 }
808 // Warn if iterators do not point to same vector_long_double
809 if( this->v->ccgsl_pointer != i.v->ccgsl_pointer ){
810 gsl_error( "trying to take difference of iterators for different vector_long_double objects", __FILE__, __LINE__,
812 return false;
813 }
814 return reverse_t ? i.position < this->position : this->position < i.position;
815 }
819 iterator_t() : iterator_base<vector_long_double,long double,reverse_t>(){}
820 protected:
821 friend class vector_long_double;
822 // We need a constructor for vector_long_double
829 : iterator_base<vector_long_double,long double,reverse_t>( v, position ){}
830 };
834 template<bool reverse_t> class const_iterator_t
835 : public iterator_base<vector_long_double const,long double,reverse_t>{
836 public:
837 // // Refines output iterator
838 // // operator=
846 return *this;
847 }
848 // // Refines forward iterator
849 // // operator++ (both)
856 return *this;
857 }
863 // return value
866 return result;
867 }
868 // // Refines bidirectional iterator
869 // // operator-- (both)
876 return *this;
877 }
883 // return value
886 return result;
887 }
893 // // operator+=
900 this->shift( n );
901 return *this;
902 }
903 // // operator-=
910 this->shift( -n );
911 return *this;
912 }
913 // // operator+ (n+i)(i+n)
922 result += n;
923 return result;
924 }
925 // // operator- (n-i)(i-n)(i-j)
934 result -= n;
935 return result;
936 }
944 }
951 // Warn if either iterator undefined
952 if( this->v == 0 or i.v == 0 ){
953 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
954 return 0;
955 } else if( this->v->ccgsl_pointer == 0 or i.v->ccgsl_pointer == 0 ){
956 gsl_error( "vector_long_double not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
957 return 0;
958 }
959 // Warn if iterators do not point to same vector_long_double
960 if( this->v->ccgsl_pointer != i.v->ccgsl_pointer ){
961 gsl_error( "trying to take difference of iterators for different vector_long_double objects", __FILE__, __LINE__,
963 return 0;
964 }
965 return reverse_t ? i.position - this->position : this->position - i.position;
966 }
970 const_iterator_t() : iterator_base<vector_long_double,long double,reverse_t>(){}
978 }
984 bool operator==( iterator_t<reverse_t> const& i ) const {
985 return this->v == i.v and this->position == i.position;
986 }
992 bool operator!=( iterator_t<reverse_t> const& i ) const {
993 return not this->operator==( i );
994 }
1000 bool operator<( iterator_t<reverse_t> const& i ) const {
1001 // Warn if either iterator undefined
1002 if( this->v == 0 or i.v == 0 ){
1003 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
1004 return false;
1005 }
1006 // Warn if iterators do not point to same vector_long_double
1007 if( this->v->ccgsl_pointer != i.v->ccgsl_pointer ){
1008 gsl_error( "trying to take difference of iterators for different vector_long_double objects", __FILE__, __LINE__,
1010 return false;
1011 }
1012 return reverse_t ? i.position < this->position : this->position < i.position;
1013 }
1020 return this->v == i.v and this->position == i.position;
1021 }
1028 return not this->operator==( i );
1029 }
1036 // Warn if either iterator undefined
1037 if( this->v == 0 or i.v == 0 ){
1038 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
1039 return false;
1040 }
1041 // Warn if iterators do not point to same vector_long_double
1042 if( this->v->ccgsl_pointer != i.v->ccgsl_pointer ){
1043 gsl_error( "trying to take difference of iterators for different vector_long_double objects", __FILE__, __LINE__,
1045 return false;
1046 }
1047 return reverse_t ? i.position < this->position : this->position < i.position;
1048 }
1049 protected:
1050 // We need a constructor for vector_long_double
1058 : iterator_base<vector_long_double const,long double,reverse_t>( v, position ){}
1059 };
1060 public:
1077 // type difference_type
1082 // type size_type
1086 typedef size_t size_type;
1087 // begin()
1093 return iterator( this, 0 );
1094 }
1100 return const_iterator( this, 0 );
1101 }
1102 // end()
1108 if( ccgsl_pointer == 0 ) return iterator( this, 0 );
1109 return iterator( this, size() );
1110 }
1116 if( ccgsl_pointer == 0 ) return const_iterator( this, 0 );
1117 return const_iterator( this, size() );
1118 }
1119 // size()
1124 size_type size() const { return ccgsl_pointer == 0 ? 0 : ccgsl_pointer->size; }
1132 long double* data() {
1133 if( ccgsl_pointer == 0 ) gsl_error( "null vector_long_double", __FILE__, __LINE__, GSL_EFAULT );
1134#ifndef GSL_RANGE_CHECK_OFF
1135 if( ccgsl_pointer->stride != 1 )
1136 gsl_error( "vector_long_double does not have stride of size 1", __FILE__, __LINE__, GSL_EBADLEN );
1137#endif
1138 return ccgsl_pointer->data; }
1146 long double const* data() const {
1147 if( ccgsl_pointer == 0 ) gsl_error( "null vector_long_double", __FILE__, __LINE__, GSL_EFAULT );
1148#ifndef GSL_RANGE_CHECK_OFF
1149 if( ccgsl_pointer->stride != 1 )
1150 gsl_error( "vector_long_double does not have stride of size 1", __FILE__, __LINE__, GSL_EBADLEN );
1151#endif
1152 return ccgsl_pointer->data; }
1153 // max_size()
1159 size_type max_size() const { return ccgsl_pointer == 0 ? 0 : ccgsl_pointer->size; }
1160 // empty()
1165 bool empty() const { return ccgsl_pointer == 0 or ccgsl_pointer->size == 0; }
1166 // swap() --- should work even if sizes don't match
1173 std::swap( ccgsl_pointer, v.ccgsl_pointer );
1174 std::swap( count, v.count );
1175 }
1176 // Refines reversible container
1177 // rbegin()
1183 if( ccgsl_pointer ==0 ) return reverse_iterator( this, 0 );
1184 return reverse_iterator( this, size() - 1 );
1185 }
1191 if( ccgsl_pointer ==0 ) return const_reverse_iterator( this, 0 );
1192 return const_reverse_iterator( this, size() - 1 );
1193 }
1194 // rend()
1200 return reverse_iterator( this, -1 );
1201 }
1207 return const_reverse_iterator( this, -1 );
1208 }
1209 // operator[]
1215 long double& operator[]( size_t const n ){
1216 // Always try to return something
1217 static long double something = 0;
1218 // First check that iterator is initialised.
1219 if( ccgsl_pointer == 0 ){
1220 gsl_error( "vector_long_double is null", __FILE__, __LINE__, exception::GSL_EFAULT );
1221 return something;
1222 }
1223#ifndef GSL_RANGE_CHECK_OFF
1224 // Check that position make sense
1225 if( n >= size() ){
1226 gsl_error( "trying to read beyond end of vector_long_double", __FILE__, __LINE__, exception::GSL_EINVAL );
1227 return something;
1228 }
1229 // n is a valid position
1230#endif
1231 return *(ccgsl_pointer->data + n * ccgsl_pointer->stride);
1232 }
1238 long double const& operator[]( size_t const n ) const {
1239 // Always try to return something
1240 static long double something = 0;
1241 // First check that iterator is initialised.
1242 if( ccgsl_pointer == 0 ){
1243 gsl_error( "vector_long_double is null", __FILE__, __LINE__, exception::GSL_EFAULT );
1244 return something;
1245 }
1246#ifndef GSL_RANGE_CHECK_OFF
1247 // Check that position make sense
1248 if( n >= size() ){
1249 gsl_error( "trying to read beyond end of vector_long_double", __FILE__, __LINE__, exception::GSL_EINVAL );
1250 return something;
1251 }
1252 // n is a valid position
1253#endif
1254 return *(ccgsl_pointer->data + n * ccgsl_pointer->stride);
1255 }
1256 private:
1264 gsl_vector_long_double* ccgsl_pointer;
1268 size_t* count;
1269 public:
1270 // shared reference functions
1275 gsl_vector_long_double* get() { return ccgsl_pointer; }
1280 gsl_vector_long_double const* get() const { return ccgsl_pointer; }
1286 bool unique() const { return count != 0 and *count == 1; }
1291 size_t use_count() const { return count == 0 ? 0 : *count; }
1297#ifdef __GXX_EXPERIMENTAL_CXX0X__
1298 explicit
1299#endif
1300 operator bool() const { return ccgsl_pointer != 0; }
1301
1302 // GSL functions
1309 static vector_long_double calloc( size_t const n ){ return vector_long_double( gsl_vector_long_double_calloc( n ) ); }
1313 void set_zero(){ gsl_vector_long_double_set_zero( get() ); }
1318 void set_all( long double x ){ gsl_vector_long_double_set_all( get(), x ); }
1324 int set_basis( size_t i ){ return gsl_vector_long_double_set_basis( get(), i ); }
1330 int memcpy( vector_long_double const& src ){ return gsl_vector_long_double_memcpy( get(), src.get() ); }
1335 int reverse(){ return gsl_vector_long_double_reverse( get() ); }
1342 int swap_elements( size_t const i, size_t const j ){
1343 return gsl_vector_long_double_swap_elements( get(), i, j ); }
1348 long double max() const { return gsl_vector_long_double_max( get() ); }
1353 long double min() const { return gsl_vector_long_double_min( get() ); }
1359 void minmax( long double* min_out, long double* max_out ) const {
1360 gsl_vector_long_double_minmax( get(), min_out, max_out ); }
1366 void minmax( long double& min_out, long double& max_out ) const {
1367 gsl_vector_long_double_minmax( get(), &min_out, &max_out ); }
1372 size_t max_index() const { return gsl_vector_long_double_max_index( get() ); }
1377 size_t min_index() const { return gsl_vector_long_double_min_index( get() ); }
1383 void minmax_index( size_t* imin, size_t* imax ) const {
1384 gsl_vector_long_double_minmax_index( get(), imin, imax ); }
1390 int add( vector_long_double const& b ){ return gsl_vector_long_double_add( get(), b.get() ); }
1396 int sub( vector_long_double const& b ){ return gsl_vector_long_double_sub( get(), b.get() ); }
1402 int mul( vector_long_double const& b ){ return gsl_vector_long_double_mul( get(), b.get() ); }
1408 int div( vector_long_double const& b ){ return gsl_vector_long_double_div( get(), b.get() ); }
1414 int scale( long double const x ){ return gsl_vector_long_double_scale( get(), x ); }
1420 int add_constant( long double const x ){ return gsl_vector_long_double_add_constant( get(), x ); }
1428 int axpby( long double const alpha, vector_long_double const& x,
1429 long double const beta ){
1430 return gsl_vector_long_double_axpby( alpha, x.get(), beta, get() );
1431 }
1437 long double sum( vector_long_double const& a ) const { return gsl_vector_long_double_sum( a.get() ); }
1442 int isnull() const { return gsl_vector_long_double_isnull( get() ); }
1447 int ispos() const { return gsl_vector_long_double_ispos( get() ); }
1452 int isneg() const { return gsl_vector_long_double_isneg( get() ); }
1457 int isnonneg() const { return gsl_vector_long_double_isnonneg( get() ); }
1463 long double get( size_t const i ) const { return gsl_vector_long_double_get( get(), i ); }
1469 void set( size_t const i, long double x ){ gsl_vector_long_double_set( get(), i, x ); }
1475 long double* ptr( size_t const i ){ return gsl_vector_long_double_ptr( get(), i ); }
1481 long double const* const_ptr( size_t const i ) const { return gsl_vector_long_double_const_ptr( get(), i ); }
1487 int fread( FILE* stream ){ return gsl_vector_long_double_fread( stream, get() ); }
1493 int fwrite( FILE* stream ) const { return gsl_vector_long_double_fwrite( stream, get() ); }
1499 int fscanf( FILE* stream ){ return gsl_vector_long_double_fscanf( stream, get() ); }
1506 int fprintf( FILE* stream, char const* format ) const {
1507 return gsl_vector_long_double_fprintf( stream, get(), format ); }
1515 vector_long_double( block_long_double& b, size_t const offset, size_t const n, size_t const stride = 1 ){
1516 ccgsl_pointer = gsl_vector_long_double_alloc_from_block( b.get(), offset, n, stride );
1517 // just plausibly we could allocate vector_long_double but not count
1518 try { count = new size_t; } catch( std::bad_alloc& e ){
1519 // try to tidy up before rethrowing
1520 gsl_vector_long_double_free( ccgsl_pointer );
1521 throw e;
1522 }
1523 *count = 1; // initially there is just one reference to ccgsl_pointer
1524 }
1532 vector_long_double( vector_long_double& v, size_t const offset, size_t const n, size_t const stride = 1 ){
1533 ccgsl_pointer = gsl_vector_long_double_alloc_from_vector( v.get(), offset, n, stride );
1534 // just plausibly we could allocate vector_long_double but not count
1535 try { count = new size_t; } catch( std::bad_alloc& e ){
1536 // try to tidy up before rethrowing
1537 gsl_vector_long_double_free( ccgsl_pointer );
1538 throw e;
1539 }
1540 *count = 1; // initially there is just one reference to ccgsl_pointer
1541 }
1548 static vector_long_double view_array( long double* v, size_t n ){
1549 gsl_vector_long_double* w = static_cast<gsl_vector_long_double*>( malloc( sizeof( gsl_vector_long_double ) ) );
1550 *w = gsl_vector_long_double_view_array( v, n ).vector;
1551 return vector_long_double( w );
1552 }
1553
1554
1562 static vector_long_double view_array_with_stride( long double* base, size_t stride, size_t n ){
1563 gsl_vector_long_double* w = static_cast<gsl_vector_long_double*>( malloc( sizeof( gsl_vector_long_double ) ) );
1564 *w = gsl_vector_long_double_view_array_with_stride( base, stride, n ).vector;
1565 return vector_long_double( w );
1566 }
1567
1568
1575 static vector_long_double const const_view_array( long double const* v, size_t n ){
1576 gsl_vector_long_double* w = static_cast<gsl_vector_long_double *>( malloc( sizeof( gsl_vector_long_double ) ) );
1577 *w = gsl_vector_long_double_const_view_array( v, n ).vector;
1578 return vector_long_double( w );
1579 }
1580
1581
1589 static vector_long_double const const_view_array_with_stride( long double const* base, size_t stride, size_t n ){
1590 gsl_vector_long_double* w = static_cast<gsl_vector_long_double*>( malloc( sizeof( gsl_vector_long_double ) ) );
1591 *w = gsl_vector_long_double_const_view_array_with_stride( base, stride, n ).vector;
1592 return vector_long_double( w );
1593 }
1594
1595
1596#ifndef DOXYGEN_SKIP
1603 static vector_long_double const view_array( long double const* v, size_t n ){
1604 gsl_vector_long_double* w = static_cast<gsl_vector_long_double*>( malloc( sizeof( gsl_vector_long_double ) ) );
1605 *w = gsl_vector_long_double_const_view_array( v, n ).vector;
1606 return vector_long_double( w );
1607 }
1608#endif //DOXYGEN_SKIP
1609
1610
1611#ifndef DOXYGEN_SKIP
1619 static vector_long_double const view_array_with_stride( long double const* base, size_t stride, size_t n ){
1620 gsl_vector_long_double* w = static_cast<gsl_vector_long_double*>( malloc( sizeof( gsl_vector_long_double ) ) );
1621 *w = gsl_vector_long_double_const_view_array_with_stride( base, stride, n ).vector;
1622 return vector_long_double( w );
1623 }
1624#endif //DOXYGEN_SKIP
1625
1626
1633 vector_long_double subvector( size_t i, size_t n ){
1634 gsl_vector_long_double* w = static_cast<gsl_vector_long_double*>( malloc( sizeof( gsl_vector_long_double ) ) );
1635 *w = gsl_vector_long_double_subvector( get(), i, n ).vector;
1636 return vector_long_double( w );
1637 }
1638
1639
1647 vector_long_double subvector_with_stride( size_t i, size_t stride, size_t n ){
1648 gsl_vector_long_double* w = static_cast<gsl_vector_long_double*>( malloc( sizeof( gsl_vector_long_double ) ) );
1649 *w = gsl_vector_long_double_subvector_with_stride( get(), i, stride, n ).vector;
1650 return vector_long_double( w );
1651 }
1652
1653
1660 vector_long_double const const_subvector( size_t i, size_t n ) const {
1661 gsl_vector_long_double* w = static_cast<gsl_vector_long_double*>( malloc( sizeof( gsl_vector_long_double ) ) );
1662 *w = gsl_vector_long_double_const_subvector( get(), i, n ).vector;
1663 return vector_long_double( w );
1664 }
1665
1666
1674 vector_long_double const const_subvector_with_stride( size_t i, size_t stride, size_t n ) const {
1675 gsl_vector_long_double* w = static_cast<gsl_vector_long_double*>( malloc( sizeof( gsl_vector_long_double ) ) );
1676 *w = gsl_vector_long_double_const_subvector_with_stride( get(), i, stride, n ).vector;
1677 return vector_long_double( w );
1678 }
1679
1680
1681#ifndef DOXYGEN_SKIP
1688 vector_long_double const subvector( size_t i, size_t n ) const {
1689 gsl_vector_long_double* w = static_cast<gsl_vector_long_double*>( malloc( sizeof( gsl_vector_long_double ) ) );
1690 *w = gsl_vector_long_double_const_subvector( get(), i, n ).vector;
1691 return vector_long_double( w );
1692 }
1693#endif //DOXYGEN_SKIP
1694
1695
1696#ifndef DOXYGEN_SKIP
1704 vector_long_double const subvector_with_stride( size_t i, size_t stride, size_t n ) const {
1705 gsl_vector_long_double* w = static_cast<gsl_vector_long_double*>( malloc( sizeof( gsl_vector_long_double ) ) );
1706 *w = gsl_vector_long_double_const_subvector_with_stride( get(), i, stride, n ).vector;
1707 return vector_long_double( w );
1708 }
1709#endif //DOXYGEN_SKIP
1710
1711
1718 template<typename ARRAY>
1719 static vector_long_double view_array( ARRAY& v, size_t n = 0 ){
1720 if(n > v.size())
1721 gsl_error( "n is too big", __FILE__, __LINE__, exception::GSL_EBADLEN );
1722 if(0 == n)
1723 n = v.size();
1724 gsl_vector_long_double* w = static_cast<gsl_vector_long_double*>( malloc( sizeof( gsl_vector_long_double ) ) );
1725 *w = gsl_vector_long_double_view_array( v.data(), n ).vector;
1726 return vector_long_double( w );
1727 }
1728
1729
1737 template<typename ARRAY>
1738 static vector_long_double view_array_with_stride( ARRAY& base, size_t stride, size_t n=0 ){
1739 if(0 == n)
1740 n = base.size()/stride;
1741 if((n-1)*stride > base.size())
1742 gsl_error( "n is too big", __FILE__, __LINE__, exception::GSL_EBADLEN );
1743 gsl_vector_long_double* w = static_cast<gsl_vector_long_double*>( malloc( sizeof( gsl_vector_long_double ) ) );
1744 *w = gsl_vector_long_double_view_array_with_stride( base.data(), stride, n ).vector;
1745 return vector_long_double( w );
1746 }
1747
1748
1755 template<typename ARRAY>
1756 static vector_long_double const const_view_array( ARRAY const& v, size_t n=0 ){
1757 if(n > v.size())
1758 gsl_error( "n is too big", __FILE__, __LINE__, exception::GSL_EBADLEN );
1759 if(0 == n)
1760 n = v.size();
1761 gsl_vector_long_double* w = static_cast<gsl_vector_long_double *>( malloc( sizeof( gsl_vector_long_double ) ) );
1762 *w = gsl_vector_long_double_const_view_array( v.data(), n ).vector;
1763 return vector_long_double( w );
1764 }
1765
1766
1774 template<typename ARRAY>
1775 static vector_long_double const const_view_array_with_stride( ARRAY const& base, size_t stride, size_t n=0 ){
1776 if(0 == n)
1777 n = base.size()/stride;
1778 if((n-1)*stride > base.size())
1779 gsl_error( "n is too big", __FILE__, __LINE__, exception::GSL_EBADLEN );
1780 gsl_vector_long_double* w = static_cast<gsl_vector_long_double*>( malloc( sizeof( gsl_vector_long_double ) ) );
1781 *w = gsl_vector_long_double_const_view_array_with_stride( base.data(), stride, n ).vector;
1782 return vector_long_double( w );
1783 }
1784
1785
1786#ifndef DOXYGEN_SKIP
1793 template<typename ARRAY>
1794 static vector_long_double const view_array( ARRAY const& v, size_t n=0 ){
1795 if(n > v.size())
1796 gsl_error( "n is too big", __FILE__, __LINE__, exception::GSL_EBADLEN );
1797 if(0 == n)
1798 n = v.size();
1799 gsl_vector_long_double* w = static_cast<gsl_vector_long_double*>( malloc( sizeof( gsl_vector_long_double ) ) );
1800 *w = gsl_vector_long_double_const_view_array( v.data(), n ).vector;
1801 return vector_long_double( w );
1802 }
1803#endif //DOXYGEN_SKIP
1804
1805
1806#ifndef DOXYGEN_SKIP
1814 template<typename ARRAY>
1815 static vector_long_double const view_array_with_stride( ARRAY const& base, size_t stride, size_t n ){
1816 if(0 == n)
1817 n = base.size()/stride;
1818 if((n-1)*stride > base.size())
1819 gsl_error( "n is too big", __FILE__, __LINE__, exception::GSL_EBADLEN );
1820 gsl_vector_long_double* w = static_cast<gsl_vector_long_double*>( malloc( sizeof( gsl_vector_long_double ) ) );
1821 *w = gsl_vector_long_double_const_view_array_with_stride( base.data(), stride, n ).vector;
1822 return vector_long_double( w );
1823 }
1824#endif //DOXYGEN_SKIP
1825
1826 // Extra allocators from matrix_long_double objects. The definition must come after matrix_long_double.
1841 };
1842
1851
1860
1869 return i + n; }
1870
1879 return i + n; }
1880
1881}
1882#endif
This class handles vector_long_doubles as shared handles.
@ 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
@ GSL_EFAULT
invalid pointer
Definition: exception.hpp:474
This class handles matrix_long_double objects as shared handles.
A class template for the const iterators.
bool operator!=(iterator_t< reverse_t > const &i) const
Comparison with non-const iterator.
const_iterator_t< reverse_t > operator-(difference_type const n) const
The - operator: subtract distance from iterator.
difference_type operator-(const_iterator_t< reverse_t > const &i) const
The - operator: find distance between two iterators.
const_iterator_t< reverse_t > & operator++()
The prefix ++ operator.
bool operator!=(const_iterator_t< reverse_t > const &i) const
Comparison with const iterator.
const_iterator_t(vector_long_double const *v, difference_type position)
This constructor allows vector_long_double to create non-default iterators.
const_iterator_t< reverse_t > & operator=(const_iterator_t< reverse_t > const &i)
We can assign one output iterator from another.
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.
const_iterator_t(iterator_t< reverse_t > const &i)
A copy constructor.
iterator_base< vector_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)
The += operator.
bool operator==(const_iterator_t< reverse_t > const &i) const
Comparison with const iterator.
difference_type operator-(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.
const_iterator_t< reverse_t > operator--(int)
The postfix – operator.
bool operator==(iterator_t< reverse_t > const &i) const
Comparison with non-const iterator.
const_iterator_t< reverse_t > operator+(difference_type const n) const
The + operator.
const_iterator_t< reverse_t > & operator--()
The prefix – operator.
The container must have iterator types.
void decrement()
Decrement the iterator.
iterator_base()
The iterator is default constructible.
ptrdiff_t difference_type
An iterator must have a difference_type.
container * v
Store a pointer to a vector_long_double we can iterate over: 0 if no vector_long_double.
std::random_access_iterator_tag iterator_category
An iterator must have an iterator category.
reference operator[](difference_type const n) const
Get element at i + n by reference ([] operator).
bool operator!=(iterator_base< container, content, reverse_t > const &i) const
The != operator.
pointer operator->() const
Dereference the pointer.
value_type & reference
An iterator must have a reference type.
difference_type position
Mark position of iterator within vector_long_double.
long double value_type
An iterator must have a value type.
iterator_base(container *v, difference_type position)
This constructor allows vector_long_double to create non-default iterators.
reference operator*() const
Dereference the pointer.
difference_type operator-(iterator_base< container, content, reverse_t > const &i) const
The - operator: find distance between two iterators.
void increment()
Increment the iterator.
bool operator<(iterator_base< container, content, reverse_t > const &i) const
The < operator is used to compare iterators.
void shift(difference_type const n)
Shift iterator n places.
bool operator==(iterator_base< container, content, reverse_t > const &i) const
The == operator.
value_type * pointer
An iterator must have a pointer typea.
A class template for the two non-const iterators.
difference_type operator-(const_iterator_t< reverse_t > const &i) const
The - operator: find distance between two iterators.
iterator_t< reverse_t > & operator++()
The prefix ++ operator.
iterator_t< reverse_t > operator++(int)
The postfix ++ operator.
iterator_t< reverse_t > operator+(difference_type const n) const
The + operator.
difference_type operator-(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_base< vector_long_double, longdouble, reverse_t >::difference_type difference_type
Difference type.
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.
iterator_t< reverse_t > operator-(difference_type const n) const
The - operator: subtract distance from 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--(int)
The postfix – operator.
bool operator==(const_iterator_t< reverse_t > const &i) const
Comparison with const iterator.
iterator_t< reverse_t > & operator-=(difference_type const n)
The -= operator.
iterator_t(vector_long_double *v, difference_type position)
This constructor allows vector_long_double to create non-default iterators.
iterator_t< reverse_t > & operator--()
The prefix – operator.
This class handles vector_long_double objects as shared handles.
int sub(vector_long_double const &b)
C++ version of gsl_vector_long_double_sub().
long double const * data() const
Give access to the data block_long_double.
bool operator<(vector_long_double const &v) const
A container needs to define an ordering for sorting.
vector_long_double(std::initializer_list< long double > initializer_list)
Could construct from a std::initializer_list in C++11.
const_iterator end() const
Get iterator pointing beyond last vector_long_double element.
size_t size_type
A container must have a size_type.
vector_long_double(vector_long_double &&v)
Move constructor.
vector_long_double & operator=(vector_long_double &&v)
Move operator.
static vector_long_double alloc_col_from_matrix(matrix_long_double &m, size_t const j)
C++ version of gsl_vector_long_double_alloc_col_from_matrix().
int reverse()
C++ version of gsl_vector_long_double_reverse().
static vector_long_double view_array(long double *v, size_t n)
C++ version of gsl_vector_long_double_view_array().
int set_basis(size_t i)
C++ version of gsl_vector_long_double_set_basis().
bool unique() const
Find if this is the only object sharing the gsl_vector_long_double.
long double const & operator[](size_t const n) const
Get element at position n by reference ([] operator).
int isnull() const
C++ version of gsl_vector_long_double_isnull().
vector_long_double const const_subvector(size_t i, size_t n) const
C++ version of gsl_vector_long_double_const_subvector().
vector_long_double(vector_long_double &v)
The copy constructor.
static vector_long_double calloc(size_t const n)
C++ version of gsl_vector_long_double_calloc().
size_type max_size() const
The max size (number of elements) of the vector_long_double.
int axpby(long double const alpha, vector_long_double const &x, long double const beta)
C++ version of gsl_vector_long_double_axpby().
value_type const * const_pointer
A container must have a constant pointer type.
static vector_long_double const const_view_array_with_stride(ARRAY const &base, size_t stride, size_t n=0)
C++ version of gsl_vector_long_double_const_view_array_with_stride().
const_iterator_t< true > const_reverse_iterator
The const_reverse_t type.
long double * ptr(size_t const i)
C++ version of gsl_vector_long_double_ptr().
iterator_t< false > iterator
The iterator type.
void minmax_index(size_t *imin, size_t *imax) const
C++ version of gsl_vector_long_double_minmax_index().
int mul(vector_long_double const &b)
C++ version of gsl_vector_long_double_mul().
int fread(FILE *stream)
C++ version of gsl_vector_long_double_fread().
const_iterator::difference_type difference_type
A container must have a difference_type.
void set_all(long double x)
C++ version of gsl_vector_long_double_set_all().
gsl_vector_long_double * ccgsl_pointer
The shared pointer.
value_type & reference
A container must have a reference type.
long double get(size_t const i) const
C++ version of gsl_vector_long_double_get().
iterator end()
Get iterator pointing beyond last vector_long_double element.
const_reverse_iterator rbegin() const
Get iterator pointing to first vector_long_double element.
long double * data()
Give access to the data block_long_double.
bool operator<=(vector_long_double const &v) const
A container needs to define an ordering for sorting.
static vector_long_double view_array_with_stride(ARRAY &base, size_t stride, size_t n=0)
C++ version of gsl_vector_long_double_view_array_with_stride().
bool operator!=(vector_long_double const &v) const
Two vector_long_double objects are different equal if their elements are not identical.
value_type * pointer
A container must have a pointer type.
static vector_long_double alloc_row_from_matrix(matrix_long_double &m, size_t const i)
C++ version of gsl_vector_long_double_alloc_row_from_matrix().
int isneg() const
C++ version of gsl_vector_long_double_isneg().
size_t use_count() const
Find how many vector_long_double objects share this pointer.
void set(size_t const i, long double x)
C++ version of gsl_vector_long_double_set().
gsl_vector_long_double const * get() const
Get the gsl_vector_long_double.
static vector_long_double const const_view_array(long double const *v, size_t n)
C++ version of gsl_vector_long_double _const_view_array().
size_t min_index() const
C++ version of gsl_vector_long_double_min_index().
int memcpy(vector_long_double const &src)
C++ version of gsl_vector_long_double_memcpy().
const_iterator_t< false > const_iterator
The const_iterator type.
iterator begin()
Get iterator pointing to first vector_long_double element.
int ispos() const
C++ version of gsl_vector_long_double_ispos().
static vector_long_double view_array(ARRAY &v, size_t n=0)
C++ version of gsl_vector_long_double_view_array().
vector_long_double clone() const
The clone function.
void set_zero()
C++ version of gsl_vector_long_double_set_zero().
size_t max_index() const
C++ version of gsl_vector_long_double_max_index().
size_type size() const
The size (number of elements) of the vector_long_double.
vector_long_double & operator=(vector_long_double const &v)
The assignment operator.
void swap(vector_long_double &v)
Swap two vector_long_double objects.
int isnonneg() const
C++ version of gsl_vector_long_double_isnonneg().
iterator_t< true > reverse_iterator
The reverse_iterator type.
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().
long double max() const
C++ version of gsl_vector_long_double_max().
vector_long_double const const_subvector_with_stride(size_t i, size_t stride, size_t n) const
C++ version of gsl_vector_long_double_const_subvector_with_stride().
void reset()
Stop sharing ownership of the shared pointer.
long double value_type
A container must have a value_type.
gsl_vector_long_double * get()
Get the gsl_vector_long_double.
int add(vector_long_double const &b)
C++ version of gsl_vector_long_double_add().
long double & operator[](size_t const n)
Get element at position n by reference ([] operator).
int add_constant(long double const x)
C++ version of gsl_vector_long_double_add_constant().
vector_long_double()
The default constructor is only really useful for assigning to.
vector_long_double(V &v, size_t const stride=1)
Construct from an object that implements data() and size().
long double sum(vector_long_double const &a) const
C++ version of gsl_vector_long_double_sum().
bool operator==(vector_long_double const &v) const
Two vector_long_double objects are identically equal if their elements are identical.
int fprintf(FILE *stream, char const *format) const
C++ version of gsl_vector_long_double_fprintf().
vector_long_double subvector_with_stride(size_t i, size_t stride, size_t n)
C++ version of gsl_vector_long_double_subvector_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().
~vector_long_double()
The destructor only deletes the pointers if count reaches zero.
reverse_iterator rend()
Get iterator pointing beyond last vector_long_double element.
long double const * const_ptr(size_t const i) const
C++ version of gsl_vector_long_double_const_ptr().
value_type const & const_reference
A container must have a constant reference type.
int fwrite(FILE *stream) const
C++ version of gsl_vector_long_double_fwrite().
const_iterator begin() const
Get iterator pointing to first vector_long_double element.
void minmax(long double &min_out, long double &max_out) const
C++ version of gsl_vector_long_double_minmax().
int div(vector_long_double const &b)
C++ version of gsl_vector_long_double_div().
int fscanf(FILE *stream)
C++ version of gsl_vector_long_double_fscanf().
vector_long_double(vector_long_double const &v)
The copy constructor.
bool empty() const
Find if the vector_long_double is empty.
void minmax(long double *min_out, long double *max_out) const
C++ version of gsl_vector_long_double_minmax().
vector_long_double(size_t const n)
The default constructor creates a new vector_long_double with n elements.
void wrap_gsl_vector_long_double_without_ownership(gsl_vector_long_double *v)
This function is intended mainly for internal use.
const_reverse_iterator rend() const
Get iterator pointing beyond last vector_long_double element.
vector_long_double(block_long_double &b, size_t const offset, size_t const n, size_t const stride=1)
C++ version of gsl_vector_long_double_alloc_from_block().
vector_long_double(vector_long_double &v, size_t const offset, size_t const n, size_t const stride=1)
C++ version of gsl_vector_long_double_alloc_from_vector().
static vector_long_double const const_view_array(ARRAY const &v, size_t n=0)
C++ version of gsl_vector_long_double _const_view_array().
long double min() const
C++ version of gsl_vector_long_double_min().
bool operator>(vector_long_double const &v) const
A container needs to define an ordering for sorting.
int swap_elements(size_t const i, size_t const j)
C++ version of gsl_vector_long_double_swap_elements().
bool operator>=(vector_long_double const &v) const
A container needs to define an ordering for sorting.
bool owns_data
Used to allow a vector that does not own its data.
int scale(long double const x)
C++ version of gsl_vector_long_double_scale().
vector_long_double subvector(size_t i, size_t n)
C++ version of gsl_vector_long_double_subvector().
size_t * count
The shared reference count.
reverse_iterator rbegin()
Get iterator pointing to first vector_long_double element.
gsl_vector * ccgsl_pointer
The shared pointer.
Definition: vector.hpp:1309
size_t size(series const &cs)
C++ version of gsl_cheb_size().
Definition: chebyshev.hpp:287
int min(movstat::end_t const endtype, vector const &x, vector &y, workspace &w)
C++ version of gsl_movstat_min().
Definition: movstat.hpp:581
vector position(workspace const &w)
C++ version of gsl_multifit_nlinear_position().
double beta(rng const &r, double const a, double const b)
C++ version of gsl_ran_beta().
Definition: randist.hpp:262
double get(quantile_workspace &w)
C++ version of gsl_rstat_quantile_get().
Definition: rstat.hpp:626
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
double a(int order, double qq)
C++ version of gsl_sf_mathieu_a().
Definition: sf_mathieu.hpp:272
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