ccgsl 2.7.2
C++wrappersforGnuScientificLibrary
vector_uint.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_UINT_HPP
20#define CCGSL_VECTOR_UINT_HPP
21
22#include<gsl/gsl_vector_uint.h>
23#include<new>
24#include<iterator>
25
26#include"exception.hpp"
27#include"block_uint.hpp"
28
29// This file is autogenerated
30
31namespace gsl {
32 // declare matrix_uint class
33 class matrix_uint;
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_uint( size_t const n ) : owns_data(true){
62 if( n > 0 ) ccgsl_pointer = gsl_vector_uint_alloc( n );
63 else { ccgsl_pointer = new gsl_vector_uint; ccgsl_pointer->size = 0; ccgsl_pointer->data = 0; }
64 // just plausibly we could allocate vector_uint 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_uint_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_uint( int const n ) : owns_data(true){
79 if( n > 0 ) ccgsl_pointer = gsl_vector_uint_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_uint; ccgsl_pointer->size = 0; ccgsl_pointer->data = 0; }
84 // just plausibly we could allocate vector_uint 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_uint_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_uint( gsl_vector_uint* 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_uint( std::initializer_list<unsigned int> initializer_list ){
111 size_t const n = initializer_list.size();
112 ccgsl_pointer = gsl_vector_uint_alloc( n );
113 // just plausibly we could allocate vector_uint 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_uint_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_uint( vector_uint const& v ) : owns_data( v.owns_data ),
132 ccgsl_pointer( v.ccgsl_pointer ), count( v.count ){
133 if( count != 0 ) ++*count; // vector_uint is now shared.
134 }
139 vector_uint( vector_uint& v ) : owns_data( v.owns_data ),
140 ccgsl_pointer( v.ccgsl_pointer ), count( v.count ){
141 if( count != 0 ) ++*count; // vector_uint 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_uint_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_uint is now shared.
161 return *this;
162 }
175 template<typename V> vector_uint( V& v, size_t const stride = 1 ) : owns_data(true){
176 size_t const n = v.size() / stride;
177 ccgsl_pointer = static_cast<gsl_vector_uint*>( malloc( sizeof( gsl_vector_uint ) ) );
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_uint 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_uint_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_uint copy( get()->size );
200 // Now copy
201 gsl_vector_uint_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 and owns_data ){
213 if( ccgsl_pointer->size > 0 ) gsl_vector_uint_free( ccgsl_pointer );
214 else delete ccgsl_pointer; }
215 delete count;
216 }
217 }
218
219 // Allow possibility of assigning from gsl_vector_uint without sharing
228 void wrap_gsl_vector_uint_without_ownership( gsl_vector_uint* 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_uint_free( ccgsl_pointer );
233 else delete ccgsl_pointer; }
234 }
235 ccgsl_pointer = v;
236 if(0 == count) count = new size_t;
237 *count = 1;
238 owns_data = false; // should never be able to delete ccgsl_pointer
239 }
240 // Refines equality comparable
241 // == operator
248 bool operator==( vector_uint const& v ) const {
249 // trivially equal if gsl_vector_uint*s are identical
250 if( ccgsl_pointer == v.ccgsl_pointer ) return true;
251 // trivially not equal if one is zero: != should be same as xor here
252 if( (ccgsl_pointer == 0) != (v.ccgsl_pointer == 0 ) ) return false;
253 // trivially not equal if sizes are different
254 if( ccgsl_pointer->size != v.ccgsl_pointer->size ) return false;
255 // check elementwise for equality
256 for( size_t i = 0; i < ccgsl_pointer->size; ++i )
257 if( gsl_vector_uint_get( ccgsl_pointer, i ) != gsl_vector_uint_get( v.ccgsl_pointer, i ) ) return false;
258 return true;
259 }
263 void reset(){ vector_uint().swap( *this ); }
264#ifdef __GXX_EXPERIMENTAL_CXX0X__
269 vector_uint( vector_uint&& v ) : owns_data{v.owns_data},
270 ccgsl_pointer( v.ccgsl_pointer ), count( nullptr ){
271 std::swap( count, v.count );
272 v.ccgsl_pointer = nullptr;
273 }
280 vector_uint( std::move( v ) ).swap( *this );
281 return *this;
282 }
283#endif
284 // != operator
291 bool operator!=( vector_uint const& v ) const { return not operator==( v ); }
292 // Refines forward container
293 // Refines less than comparable
294 // operator<
303 bool operator<( vector_uint const& v ) const {
304 // null vector_uint comes first
305 if( ccgsl_pointer == 0 ) return v.ccgsl_pointer != 0;
306 // if v is null then this > v
307 if( v.ccgsl_pointer == 0 ) return false;
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 unsigned int const t = gsl_vector_uint_get( ccgsl_pointer, i );
314 unsigned int const u =gsl_vector_uint_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_uint const& v ) const {
331 // null vector_uint comes first
332 if( ccgsl_pointer == 0 ) return false;
333 // if v is null then this > v
334 if( v.ccgsl_pointer == 0 ) return true;
335 // Now compare elementwise
336 size_t const size = ccgsl_pointer->size;
337 size_t const v_size = v.ccgsl_pointer->size;
338 size_t const min = size > v_size ? size : v_size;
339 for( size_t i = 0; i < min; ++i ){
340 unsigned int const t = gsl_vector_uint_get( ccgsl_pointer, i );
341 unsigned int const u =gsl_vector_uint_get( v.ccgsl_pointer, i );
342 if( t > u ) return true;
343 if( u > t ) return false;
344 }
345 // elements match.
346 return size > v_size;
347 }
348 // operator<=
357 bool operator<=( vector_uint const& v ) const {
358 return operator<( v ) or operator==( v );
359 }
360 // operator>=
369 bool operator>=( vector_uint const& v ) const {
370 return operator>( v ) or operator==( v );
371 }
372 // Refines container
373 // type value_type
377 typedef unsigned int value_type;
378 // type reference
383 // type const_reference
388 // type pointer
393 // type const_pointer
397 typedef value_type const* const_pointer;
398 // type iterator
399 private:
404 template<typename container, typename content,bool reverse_t> class iterator_base {
405 friend class vector_uint;
406 public:
410 typedef std::random_access_iterator_tag iterator_category;
414 typedef unsigned int value_type;
423 // // type iterator_traits<vector_uint>::difference_type
427 typedef ptrdiff_t difference_type;
428 public:
429 // // operator*
435 // Always try to return something
436 static content something = 0;
437 // First check that iterator is initialised.
438 if( v == 0 ){
439 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
440 return something;
441 } else if( v->ccgsl_pointer == 0 ){
442 gsl_error( "vector_uint not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
443 return something;
444 }
445 // Check that position make sense
446 if( position >= static_cast<difference_type>( v->size() ) ){
447 gsl_error( "trying to dereference beyond rbegin()", __FILE__, __LINE__, exception::GSL_EFAILED );
448 return something;
449 }
450 if( position <= -1 ){
451 gsl_error( "trying to dereference beyond begin()", __FILE__, __LINE__, exception::GSL_EFAILED );
452 return something;
453 }
454 // position and v are valid: return data
455 return *(v->ccgsl_pointer->data + position * v->ccgsl_pointer->stride);
456 }
457 // // operator->
463 // First check that iterator is initialised.
464 if( v == 0 ){
465 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
466 return 0;
467 } else if( v->ccgsl_pointer == 0 ){
468 gsl_error( "vector_uint not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
469 return 0;
470 }
471 // Check that position make sense
472 if( position >= static_cast<difference_type>( v->size() ) ){
473 gsl_error( "trying to dereference end()", __FILE__, __LINE__, exception::GSL_EFAILED );
474 return 0;
475 }
476 if( position <= -1 ){
477 gsl_error( "trying to dereference rend()", __FILE__, __LINE__, exception::GSL_EFAILED );
478 return 0;
479 }
480 // position and v are valid: return data
481 return v->ccgsl_pointer->data + position * v->ccgsl_pointer->stride;
482 }
483 // // operator[]
490 // Always try to return something
491 static content something = 0;
492 // First check that iterator is initialised.
493 if( v == 0 ){
494 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
495 return something;
496 } else if( v->ccgsl_pointer == 0 ){
497 gsl_error( "vector_uint not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
498 return something;
499 }
500 // Check that position make sense
501 difference_type const p = reverse_t ? position - n : position + n;
502 if( p >= static_cast<difference_type>( v->size() ) ){
503 gsl_error( "trying to dereference beyond rbegin()", __FILE__, __LINE__, exception::GSL_EFAILED );
504 return something;
505 }
506 if( p <= -1 ){
507 gsl_error( "trying to dereference beyond begin()", __FILE__, __LINE__, exception::GSL_EFAILED );
508 return something;
509 }
510 // p is a valid position
511 return *(v->ccgsl_pointer->data + p * v->ccgsl_pointer->stride);
512 }
513 // // operator-: find distance between two iterators
520 // Warn if either iterator undefined
521 if( v == 0 or i.v == 0 ){
522 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
523 return 0;
524 } else if( v->ccgsl_pointer == 0 or i.v->ccgsl_pointer == 0 ){
525 gsl_error( "vector_uint not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
526 return 0;
527 }
528 // Warn if iterators do not point to same vector_uint
529 if( v->ccgsl_pointer != i.v->ccgsl_pointer ){
530 gsl_error( "trying to take difference of iterators for different vector_uint objects", __FILE__, __LINE__,
532 return 0;
533 }
534 return reverse_t ? i.position - position : position - i.position;
535 }
536 // // operator!=
537 // // operator<
544 return this->v == i.v and this->position == i.position;
545 }
552 return not this->operator==( i );
553 }
562 // Warn if either iterator undefined
563 if( v == 0 or i.v == 0 ){
564 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
565 return false;
566 }
567 // Warn if iterators do not point to same vector_uint
568 if( v->ccgsl_pointer != i.v->ccgsl_pointer ){
569 gsl_error( "trying to take difference of iterators for different vector_uint objects", __FILE__, __LINE__,
571 return false;
572 }
573 return reverse_t ? i.position < position : position < i.position;
574 }
575 protected:
580 void increment(){
581 // Only makes sense if v points to a vector_uint
582 if( v == 0 ){
583 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
584 return;
585 } else if( v->ccgsl_pointer == 0 ){
586 gsl_error( "vector_uint not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
587 return;
588 }
589 // increment position and check against size
590 if( reverse_t ){ if( position >= 0 ) --position; }
591 else { if( position < static_cast<difference_type>( v->size() ) ) ++position; }
592 }
597 void decrement(){
598 // Only makes sense if v points to a vector_uint
599 if( v == 0 ){
600 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
601 return;
602 } else if( v->ccgsl_pointer == 0 ){
603 gsl_error( "vector_uint not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
604 return;
605 }
606 // decrement position and check against size
607 if( reverse_t ){ if( position < static_cast<difference_type>( v->size() ) ) ++position; }
608 else { if( position >= 0 ) --position; }
609 }
614 void shift( difference_type const n ){
615 // Warn if iterator undefined
616 if( v == 0 ){
617 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
618 return;
619 } else if( v->ccgsl_pointer == 0 ){
620 gsl_error( "vector_uint not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
621 return;
622 }
623 position += reverse_t ? -n : n;
624 }
628 iterator_base(){ v = 0; }
635 : v( v ), position( position ){}
639 container* v;
644 };
645 // Need to know about const_iterator_t
646 template<bool reverse_t> class const_iterator_t;
650 template<bool reverse_t> class iterator_t : public iterator_base<vector_uint,unsigned int,reverse_t>{
651 public:
652 // // Refines output iterator
653 // // operator=
661 return *this;
662 }
663 // // Refines forward iterator
664 // // operator++ (both)
671 return *this;
672 }
678 // return value
681 return result;
682 }
683 // // Refines bidirectional iterator
684 // // operator-- (both)
691 return *this;
692 }
698 // return value
701 return result;
702 }
708 // // operator+=
715 this->shift( n );
716 return *this;
717 }
718 // // operator-=
725 this->shift( -n );
726 return *this;
727 }
728 // // operator+ (n+i)(i+n)
737 result.shift( n );
738 return result;
739 }
740 // // operator- (n-i)(i-n)(i-j)
749 result.shift( -n );
750 return result;
751 }
759 }
766 // Warn if either iterator undefined
767 if( this->v == 0 or i.v == 0 ){
768 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
769 return 0;
770 } else if( this->v->ccgsl_pointer == 0 or i.v->ccgsl_pointer == 0 ){
771 gsl_error( "vector_uint not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
772 return 0;
773 }
774 // Warn if iterators do not point to same vector_uint
775 if( this->v->ccgsl_pointer != i.v->ccgsl_pointer ){
776 gsl_error( "trying to take difference of iterators for different vector_uint objects", __FILE__, __LINE__,
778 return 0;
779 }
780 return reverse_t ? i.position - this->position : this->position - i.position;
781 }
788 return this->v == i.v and this->position == i.position;
789 }
796 return not this->operator==( i );
797 }
803 bool operator<( const_iterator_t<reverse_t> const& i ) const {
804 // Warn if either iterator undefined
805 if( this->v == 0 or i.v == 0 ){
806 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
807 return false;
808 }
809 // Warn if iterators do not point to same vector_uint
810 if( this->v->ccgsl_pointer != i.v->ccgsl_pointer ){
811 gsl_error( "trying to take difference of iterators for different vector_uint objects", __FILE__, __LINE__,
813 return false;
814 }
815 return reverse_t ? i.position < this->position : this->position < i.position;
816 }
820 iterator_t() : iterator_base<vector_uint,unsigned int,reverse_t>(){}
821 protected:
822 friend class vector_uint;
823 // We need a constructor for vector_uint
830 : iterator_base<vector_uint,unsigned int,reverse_t>( v, position ){}
831 };
835 template<bool reverse_t> class const_iterator_t
836 : public iterator_base<vector_uint const,unsigned int,reverse_t>{
837 public:
838 // // Refines output iterator
839 // // operator=
847 return *this;
848 }
849 // // Refines forward iterator
850 // // operator++ (both)
857 return *this;
858 }
864 // return value
867 return result;
868 }
869 // // Refines bidirectional iterator
870 // // operator-- (both)
877 return *this;
878 }
884 // return value
887 return result;
888 }
894 // // operator+=
901 this->shift( n );
902 return *this;
903 }
904 // // operator-=
911 this->shift( -n );
912 return *this;
913 }
914 // // operator+ (n+i)(i+n)
923 result += n;
924 return result;
925 }
926 // // operator- (n-i)(i-n)(i-j)
935 result -= n;
936 return result;
937 }
945 }
952 // Warn if either iterator undefined
953 if( this->v == 0 or i.v == 0 ){
954 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
955 return 0;
956 } else if( this->v->ccgsl_pointer == 0 or i.v->ccgsl_pointer == 0 ){
957 gsl_error( "vector_uint not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
958 return 0;
959 }
960 // Warn if iterators do not point to same vector_uint
961 if( this->v->ccgsl_pointer != i.v->ccgsl_pointer ){
962 gsl_error( "trying to take difference of iterators for different vector_uint objects", __FILE__, __LINE__,
964 return 0;
965 }
966 return reverse_t ? i.position - this->position : this->position - i.position;
967 }
971 const_iterator_t() : iterator_base<vector_uint,unsigned int,reverse_t>(){}
979 }
985 bool operator==( iterator_t<reverse_t> const& i ) const {
986 return this->v == i.v and this->position == i.position;
987 }
993 bool operator!=( iterator_t<reverse_t> const& i ) const {
994 return not this->operator==( i );
995 }
1001 bool operator<( iterator_t<reverse_t> const& i ) const {
1002 // Warn if either iterator undefined
1003 if( this->v == 0 or i.v == 0 ){
1004 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
1005 return false;
1006 }
1007 // Warn if iterators do not point to same vector_uint
1008 if( this->v->ccgsl_pointer != i.v->ccgsl_pointer ){
1009 gsl_error( "trying to take difference of iterators for different vector_uint objects", __FILE__, __LINE__,
1011 return false;
1012 }
1013 return reverse_t ? i.position < this->position : this->position < i.position;
1014 }
1021 return this->v == i.v and this->position == i.position;
1022 }
1029 return not this->operator==( i );
1030 }
1037 // Warn if either iterator undefined
1038 if( this->v == 0 or i.v == 0 ){
1039 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
1040 return false;
1041 }
1042 // Warn if iterators do not point to same vector_uint
1043 if( this->v->ccgsl_pointer != i.v->ccgsl_pointer ){
1044 gsl_error( "trying to take difference of iterators for different vector_uint objects", __FILE__, __LINE__,
1046 return false;
1047 }
1048 return reverse_t ? i.position < this->position : this->position < i.position;
1049 }
1050 protected:
1051 // We need a constructor for vector_uint
1052 friend class vector_uint;
1059 : iterator_base<vector_uint const,unsigned int,reverse_t>( v, position ){}
1060 };
1061 public:
1078 // type difference_type
1083 // type size_type
1087 typedef size_t size_type;
1088 // begin()
1094 return iterator( this, 0 );
1095 }
1101 return const_iterator( this, 0 );
1102 }
1103 // end()
1109 if( ccgsl_pointer == 0 ) return iterator( this, 0 );
1110 return iterator( this, size() );
1111 }
1117 if( ccgsl_pointer == 0 ) return const_iterator( this, 0 );
1118 return const_iterator( this, size() );
1119 }
1120 // size()
1125 size_type size() const { return ccgsl_pointer == 0 ? 0 : ccgsl_pointer->size; }
1133 unsigned int* data() {
1134 if( ccgsl_pointer == 0 ) gsl_error( "null vector_uint", __FILE__, __LINE__, GSL_EFAULT );
1135#ifndef GSL_RANGE_CHECK_OFF
1136 if( ccgsl_pointer->stride != 1 )
1137 gsl_error( "vector_uint does not have stride of size 1", __FILE__, __LINE__, GSL_EBADLEN );
1138#endif
1139 return ccgsl_pointer->data; }
1147 unsigned int const* data() const {
1148 if( ccgsl_pointer == 0 ) gsl_error( "null vector_uint", __FILE__, __LINE__, GSL_EFAULT );
1149#ifndef GSL_RANGE_CHECK_OFF
1150 if( ccgsl_pointer->stride != 1 )
1151 gsl_error( "vector_uint does not have stride of size 1", __FILE__, __LINE__, GSL_EBADLEN );
1152#endif
1153 return ccgsl_pointer->data; }
1154 // max_size()
1160 size_type max_size() const { return ccgsl_pointer == 0 ? 0 : ccgsl_pointer->size; }
1161 // empty()
1166 bool empty() const { return ccgsl_pointer == 0 or ccgsl_pointer->size == 0; }
1167 // swap() --- should work even if sizes don't match
1173 void swap( vector_uint& v ){
1174 std::swap( ccgsl_pointer, v.ccgsl_pointer );
1175 std::swap( count, v.count );
1176 }
1177 // Refines reversible container
1178 // rbegin()
1184 if( ccgsl_pointer ==0 ) return reverse_iterator( this, 0 );
1185 return reverse_iterator( this, size() - 1 );
1186 }
1192 if( ccgsl_pointer ==0 ) return const_reverse_iterator( this, 0 );
1193 return const_reverse_iterator( this, size() - 1 );
1194 }
1195 // rend()
1201 return reverse_iterator( this, -1 );
1202 }
1208 return const_reverse_iterator( this, -1 );
1209 }
1210 // operator[]
1216 unsigned int& operator[]( size_t const n ){
1217 // Always try to return something
1218 static unsigned int something = 0;
1219 // First check that iterator is initialised.
1220 if( ccgsl_pointer == 0 ){
1221 gsl_error( "vector_uint is null", __FILE__, __LINE__, exception::GSL_EFAULT );
1222 return something;
1223 }
1224#ifndef GSL_RANGE_CHECK_OFF
1225 // Check that position make sense
1226 if( n >= size() ){
1227 gsl_error( "trying to read beyond end of vector_uint", __FILE__, __LINE__, exception::GSL_EINVAL );
1228 return something;
1229 }
1230 // n is a valid position
1231#endif
1232 return *(ccgsl_pointer->data + n * ccgsl_pointer->stride);
1233 }
1239 unsigned int const& operator[]( size_t const n ) const {
1240 // Always try to return something
1241 static unsigned int something = 0;
1242 // First check that iterator is initialised.
1243 if( ccgsl_pointer == 0 ){
1244 gsl_error( "vector_uint is null", __FILE__, __LINE__, exception::GSL_EFAULT );
1245 return something;
1246 }
1247#ifndef GSL_RANGE_CHECK_OFF
1248 // Check that position make sense
1249 if( n >= size() ){
1250 gsl_error( "trying to read beyond end of vector_uint", __FILE__, __LINE__, exception::GSL_EINVAL );
1251 return something;
1252 }
1253 // n is a valid position
1254#endif
1255 return *(ccgsl_pointer->data + n * ccgsl_pointer->stride);
1256 }
1257 private:
1265 gsl_vector_uint* ccgsl_pointer;
1269 size_t* count;
1270 public:
1271 // shared reference functions
1276 gsl_vector_uint* get() { return ccgsl_pointer; }
1281 gsl_vector_uint const* get() const { return ccgsl_pointer; }
1287 bool unique() const { return count != 0 and *count == 1; }
1292 size_t use_count() const { return count == 0 ? 0 : *count; }
1298#ifdef __GXX_EXPERIMENTAL_CXX0X__
1299 explicit
1300#endif
1301 operator bool() const { return ccgsl_pointer != 0; }
1302
1303 // GSL functions
1310 static vector_uint calloc( size_t const n ){ return vector_uint( gsl_vector_uint_calloc( n ) ); }
1314 void set_zero(){ gsl_vector_uint_set_zero( get() ); }
1319 void set_all( unsigned int x ){ gsl_vector_uint_set_all( get(), x ); }
1325 int set_basis( size_t i ){ return gsl_vector_uint_set_basis( get(), i ); }
1331 int memcpy( vector_uint const& src ){ return gsl_vector_uint_memcpy( get(), src.get() ); }
1336 int reverse(){ return gsl_vector_uint_reverse( get() ); }
1343 int swap_elements( size_t const i, size_t const j ){
1344 return gsl_vector_uint_swap_elements( get(), i, j ); }
1349 unsigned int max() const { return gsl_vector_uint_max( get() ); }
1354 unsigned int min() const { return gsl_vector_uint_min( get() ); }
1360 void minmax( unsigned int* min_out, unsigned int* max_out ) const {
1361 gsl_vector_uint_minmax( get(), min_out, max_out ); }
1367 void minmax( unsigned int& min_out, unsigned int& max_out ) const {
1368 gsl_vector_uint_minmax( get(), &min_out, &max_out ); }
1373 size_t max_index() const { return gsl_vector_uint_max_index( get() ); }
1378 size_t min_index() const { return gsl_vector_uint_min_index( get() ); }
1384 void minmax_index( size_t* imin, size_t* imax ) const {
1385 gsl_vector_uint_minmax_index( get(), imin, imax ); }
1391 int add( vector_uint const& b ){ return gsl_vector_uint_add( get(), b.get() ); }
1397 int sub( vector_uint const& b ){ return gsl_vector_uint_sub( get(), b.get() ); }
1403 int mul( vector_uint const& b ){ return gsl_vector_uint_mul( get(), b.get() ); }
1409 int div( vector_uint const& b ){ return gsl_vector_uint_div( get(), b.get() ); }
1415 int scale( unsigned int const x ){ return gsl_vector_uint_scale( get(), x ); }
1421 int add_constant( unsigned int const x ){ return gsl_vector_uint_add_constant( get(), x ); }
1429 int axpby( unsigned int const alpha, vector_uint const& x,
1430 unsigned int const beta ){
1431 return gsl_vector_uint_axpby( alpha, x.get(), beta, get() ); }
1437 unsigned int sum( vector_uint const& a ) const { return gsl_vector_uint_sum( a.get() ); }
1442 int isnull() const { return gsl_vector_uint_isnull( get() ); }
1447 int ispos() const { return gsl_vector_uint_ispos( get() ); }
1452 int isneg() const { return gsl_vector_uint_isneg( get() ); }
1457 int isnonneg() const { return gsl_vector_uint_isnonneg( get() ); }
1463 unsigned int get( size_t const i ) const { return gsl_vector_uint_get( get(), i ); }
1469 void set( size_t const i, unsigned int x ){ gsl_vector_uint_set( get(), i, x ); }
1475 unsigned int* ptr( size_t const i ){ return gsl_vector_uint_ptr( get(), i ); }
1481 unsigned int const* const_ptr( size_t const i ) const { return gsl_vector_uint_const_ptr( get(), i ); }
1487 int fread( FILE* stream ){ return gsl_vector_uint_fread( stream, get() ); }
1493 int fwrite( FILE* stream ) const { return gsl_vector_uint_fwrite( stream, get() ); }
1499 int fscanf( FILE* stream ){ return gsl_vector_uint_fscanf( stream, get() ); }
1506 int fprintf( FILE* stream, char const* format ) const {
1507 return gsl_vector_uint_fprintf( stream, get(), format ); }
1515 vector_uint( block_uint& b, size_t const offset, size_t const n, size_t const stride = 1 ){
1516 ccgsl_pointer = gsl_vector_uint_alloc_from_block( b.get(), offset, n, stride );
1517 // just plausibly we could allocate vector_uint but not count
1518 try { count = new size_t; } catch( std::bad_alloc& e ){
1519 // try to tidy up before rethrowing
1520 gsl_vector_uint_free( ccgsl_pointer );
1521 throw e;
1522 }
1523 *count = 1; // initially there is just one reference to ccgsl_pointer
1524 }
1532 vector_uint( vector_uint& v, size_t const offset, size_t const n, size_t const stride = 1 ){
1533 ccgsl_pointer = gsl_vector_uint_alloc_from_vector( v.get(), offset, n, stride );
1534 // just plausibly we could allocate vector_uint but not count
1535 try { count = new size_t; } catch( std::bad_alloc& e ){
1536 // try to tidy up before rethrowing
1537 gsl_vector_uint_free( ccgsl_pointer );
1538 throw e;
1539 }
1540 *count = 1; // initially there is just one reference to ccgsl_pointer
1541 }
1548 static vector_uint view_array( unsigned int* v, size_t n ){
1549 gsl_vector_uint* w = static_cast<gsl_vector_uint*>( malloc( sizeof( gsl_vector_uint ) ) );
1550 *w = gsl_vector_uint_view_array( v, n ).vector;
1551 return vector_uint( w );
1552 }
1553
1554
1562 static vector_uint view_array_with_stride( unsigned int* base, size_t stride, size_t n ){
1563 gsl_vector_uint* w = static_cast<gsl_vector_uint*>( malloc( sizeof( gsl_vector_uint ) ) );
1564 *w = gsl_vector_uint_view_array_with_stride( base, stride, n ).vector;
1565 return vector_uint( w );
1566 }
1567
1568
1575 static vector_uint const const_view_array( unsigned int const* v, size_t n ){
1576 gsl_vector_uint* w = static_cast<gsl_vector_uint *>( malloc( sizeof( gsl_vector_uint ) ) );
1577 *w = gsl_vector_uint_const_view_array( v, n ).vector;
1578 return vector_uint( w );
1579 }
1580
1581
1589 static vector_uint const const_view_array_with_stride( unsigned int const* base, size_t stride, size_t n ){
1590 gsl_vector_uint* w = static_cast<gsl_vector_uint*>( malloc( sizeof( gsl_vector_uint ) ) );
1591 *w = gsl_vector_uint_const_view_array_with_stride( base, stride, n ).vector;
1592 return vector_uint( w );
1593 }
1594
1595
1596#ifndef DOXYGEN_SKIP
1603 static vector_uint const view_array( unsigned int const* v, size_t n ){
1604 gsl_vector_uint* w = static_cast<gsl_vector_uint*>( malloc( sizeof( gsl_vector_uint ) ) );
1605 *w = gsl_vector_uint_const_view_array( v, n ).vector;
1606 return vector_uint( w );
1607 }
1608#endif //DOXYGEN_SKIP
1609
1610
1611#ifndef DOXYGEN_SKIP
1619 static vector_uint const view_array_with_stride( unsigned int const* base, size_t stride, size_t n ){
1620 gsl_vector_uint* w = static_cast<gsl_vector_uint*>( malloc( sizeof( gsl_vector_uint ) ) );
1621 *w = gsl_vector_uint_const_view_array_with_stride( base, stride, n ).vector;
1622 return vector_uint( w );
1623 }
1624#endif //DOXYGEN_SKIP
1625
1626
1633 vector_uint subvector( size_t i, size_t n ){
1634 gsl_vector_uint* w = static_cast<gsl_vector_uint*>( malloc( sizeof( gsl_vector_uint ) ) );
1635 *w = gsl_vector_uint_subvector( get(), i, n ).vector;
1636 return vector_uint( w );
1637 }
1638
1639
1647 vector_uint subvector_with_stride( size_t i, size_t stride, size_t n ){
1648 gsl_vector_uint* w = static_cast<gsl_vector_uint*>( malloc( sizeof( gsl_vector_uint ) ) );
1649 *w = gsl_vector_uint_subvector_with_stride( get(), i, stride, n ).vector;
1650 return vector_uint( w );
1651 }
1652
1653
1660 vector_uint const const_subvector( size_t i, size_t n ) const {
1661 gsl_vector_uint* w = static_cast<gsl_vector_uint*>( malloc( sizeof( gsl_vector_uint ) ) );
1662 *w = gsl_vector_uint_const_subvector( get(), i, n ).vector;
1663 return vector_uint( w );
1664 }
1665
1666
1674 vector_uint const const_subvector_with_stride( size_t i, size_t stride, size_t n ) const {
1675 gsl_vector_uint* w = static_cast<gsl_vector_uint*>( malloc( sizeof( gsl_vector_uint ) ) );
1676 *w = gsl_vector_uint_const_subvector_with_stride( get(), i, stride, n ).vector;
1677 return vector_uint( w );
1678 }
1679
1680
1681#ifndef DOXYGEN_SKIP
1688 vector_uint const subvector( size_t i, size_t n ) const {
1689 gsl_vector_uint* w = static_cast<gsl_vector_uint*>( malloc( sizeof( gsl_vector_uint ) ) );
1690 *w = gsl_vector_uint_const_subvector( get(), i, n ).vector;
1691 return vector_uint( w );
1692 }
1693#endif //DOXYGEN_SKIP
1694
1695
1696#ifndef DOXYGEN_SKIP
1704 vector_uint const subvector_with_stride( size_t i, size_t stride, size_t n ) const {
1705 gsl_vector_uint* w = static_cast<gsl_vector_uint*>( malloc( sizeof( gsl_vector_uint ) ) );
1706 *w = gsl_vector_uint_const_subvector_with_stride( get(), i, stride, n ).vector;
1707 return vector_uint( w );
1708 }
1709#endif //DOXYGEN_SKIP
1710
1711
1718 template<typename ARRAY>
1719 static vector_uint 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_uint* w = static_cast<gsl_vector_uint*>( malloc( sizeof( gsl_vector_uint ) ) );
1725 *w = gsl_vector_uint_view_array( v.data(), n ).vector;
1726 return vector_uint( w );
1727 }
1728
1729
1737 template<typename ARRAY>
1738 static vector_uint 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_uint* w = static_cast<gsl_vector_uint*>( malloc( sizeof( gsl_vector_uint ) ) );
1744 *w = gsl_vector_uint_view_array_with_stride( base.data(), stride, n ).vector;
1745 return vector_uint( w );
1746 }
1747
1748
1755 template<typename ARRAY>
1756 static vector_uint 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_uint* w = static_cast<gsl_vector_uint *>( malloc( sizeof( gsl_vector_uint ) ) );
1762 *w = gsl_vector_uint_const_view_array( v.data(), n ).vector;
1763 return vector_uint( w );
1764 }
1765
1766
1774 template<typename ARRAY>
1775 static vector_uint 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_uint* w = static_cast<gsl_vector_uint*>( malloc( sizeof( gsl_vector_uint ) ) );
1781 *w = gsl_vector_uint_const_view_array_with_stride( base.data(), stride, n ).vector;
1782 return vector_uint( w );
1783 }
1784
1785
1786#ifndef DOXYGEN_SKIP
1793 template<typename ARRAY>
1794 static vector_uint 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_uint* w = static_cast<gsl_vector_uint*>( malloc( sizeof( gsl_vector_uint ) ) );
1800 *w = gsl_vector_uint_const_view_array( v.data(), n ).vector;
1801 return vector_uint( w );
1802 }
1803#endif //DOXYGEN_SKIP
1804
1805
1806#ifndef DOXYGEN_SKIP
1814 template<typename ARRAY>
1815 static vector_uint 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_uint* w = static_cast<gsl_vector_uint*>( malloc( sizeof( gsl_vector_uint ) ) );
1821 *w = gsl_vector_uint_const_view_array_with_stride( base.data(), stride, n ).vector;
1822 return vector_uint( w );
1823 }
1824#endif //DOXYGEN_SKIP
1825
1826 // Extra allocators from matrix_uint objects. The definition must come after matrix_uint.
1833 static vector_uint alloc_row_from_matrix( matrix_uint& m, size_t const i );
1840 static vector_uint alloc_col_from_matrix( matrix_uint& m, size_t const j );
1841 };
1842
1849 inline vector_uint::iterator operator+
1850 ( vector_uint::iterator::difference_type const n, vector_uint::iterator const& i ){ return i + n; }
1851
1860
1869 return i + n; }
1870
1879 return i + n; }
1880
1881}
1882#endif
This class handles vector_uints as shared handles.
Definition: block_uint.hpp:41
@ 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_uint objects as shared handles.
Definition: matrix_uint.hpp:57
A class template for the const iterators.
const_iterator_t(vector_uint const *v, difference_type position)
This constructor allows vector_uint to create non-default iterators.
difference_type operator-(const_iterator_t< reverse_t > const &i) const
The - operator: find distance between two iterators.
iterator_base< vector_uintconst, unsignedint, reverse_t >::difference_type difference_type
Difference type.
bool operator!=(const_iterator_t< reverse_t > const &i) const
Comparison with const iterator.
const_iterator_t< reverse_t > & operator-=(difference_type const n)
The -= operator.
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< reverse_t > operator+(difference_type const n) const
The + operator.
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.
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()
The default constructor.
const_iterator_t< reverse_t > & operator--()
The prefix – operator.
const_iterator_t< reverse_t > operator-(difference_type const n) const
The - operator: subtract distance from iterator.
const_iterator_t< reverse_t > operator++(int)
The postfix ++ operator.
const_iterator_t< reverse_t > operator--(int)
The postfix – operator.
bool operator==(const_iterator_t< reverse_t > const &i) const
Comparison with const iterator.
const_iterator_t(iterator_t< reverse_t > const &i)
A copy constructor.
bool operator!=(iterator_t< reverse_t > const &i) const
Comparison with non-const iterator.
The container must have iterator types.
iterator_base(container *v, difference_type position)
This constructor allows vector_uint to create non-default iterators.
difference_type operator-(iterator_base< container, content, reverse_t > const &i) const
The - operator: find distance between two iterators.
reference operator[](difference_type const n) const
Get element at i + n by reference ([] operator).
ptrdiff_t difference_type
An iterator must have a difference_type.
value_type * pointer
An iterator must have a pointer typea.
bool operator==(iterator_base< container, content, reverse_t > const &i) const
The == operator.
reference operator*() const
Dereference the pointer.
unsigned int value_type
An iterator must have a value type.
iterator_base()
The iterator is default constructible.
bool operator<(iterator_base< container, content, reverse_t > const &i) const
The < operator is used to compare iterators.
value_type & reference
An iterator must have a reference type.
bool operator!=(iterator_base< container, content, reverse_t > const &i) const
The != operator.
void increment()
Increment the iterator.
std::random_access_iterator_tag iterator_category
An iterator must have an iterator category.
container * v
Store a pointer to a vector_uint we can iterate over: 0 if no vector_uint.
difference_type position
Mark position of iterator within vector_uint.
void decrement()
Decrement the iterator.
pointer operator->() const
Dereference the pointer.
void shift(difference_type const n)
Shift iterator n places.
A class template for the two non-const iterators.
iterator_t< reverse_t > operator+(difference_type const n) const
The + operator.
bool operator!=(const_iterator_t< reverse_t > const &i) const
Comparison with const iterator.
iterator_base< vector_uint, unsignedint, reverse_t >::difference_type difference_type
Difference type.
iterator_t< reverse_t > & operator--()
The prefix – operator.
difference_type operator-(iterator_t< reverse_t > const &i) const
The - operator: find distance between two iterators.
iterator_t< reverse_t > & operator-=(difference_type const n)
The -= operator.
iterator_t< reverse_t > & operator++()
The prefix ++ operator.
iterator_t()
The default constructor.
bool operator==(const_iterator_t< reverse_t > const &i) const
Comparison with const iterator.
iterator_t< reverse_t > operator++(int)
The postfix ++ operator.
iterator_t(vector_uint *v, difference_type position)
This constructor allows vector_uint to create non-default iterators.
iterator_t< reverse_t > operator-(difference_type const n) const
The - operator: subtract distance from iterator.
iterator_t< reverse_t > & operator+=(difference_type const n)
The += operator.
difference_type operator-(const_iterator_t< reverse_t > const &i) const
The - operator: find distance between two iterators.
iterator_t< reverse_t > & operator=(iterator_t< reverse_t > const &i)
We can assign one output iterator from another.
bool operator<(const_iterator_t< reverse_t > const &i) const
Comparison with const iterator.
iterator_t< reverse_t > operator--(int)
The postfix – operator.
This class handles vector_uint objects as shared handles.
Definition: vector_uint.hpp:45
const_iterator end() const
Get iterator pointing beyond last vector_uint element.
unsigned int const & operator[](size_t const n) const
Get element at position n by reference ([] operator).
bool operator!=(vector_uint const &v) const
Two vector_uint objects are different equal if their elements are not identical.
int div(vector_uint const &b)
C++ version of gsl_vector_uint_div().
int add(vector_uint const &b)
C++ version of gsl_vector_uint_add().
unsigned int & operator[](size_t const n)
Get element at position n by reference ([] operator).
vector_uint(std::initializer_list< unsigned int > initializer_list)
Could construct from a std::initializer_list in C++11.
unsigned int max() const
C++ version of gsl_vector_uint_max().
vector_uint & operator=(vector_uint const &v)
The assignment operator.
int axpby(unsigned int const alpha, vector_uint const &x, unsigned int const beta)
C++ version of gsl_vector_uint_axpby().
void minmax_index(size_t *imin, size_t *imax) const
C++ version of gsl_vector_uint_minmax_index().
static vector_uint alloc_col_from_matrix(matrix_uint &m, size_t const j)
C++ version of gsl_vector_uint_alloc_col_from_matrix().
int reverse()
C++ version of gsl_vector_uint_reverse().
gsl_vector_uint const * get() const
Get the gsl_vector_uint.
bool operator<(vector_uint const &v) const
A container needs to define an ordering for sorting.
int fwrite(FILE *stream) const
C++ version of gsl_vector_uint_fwrite().
vector_uint clone() const
The clone function.
void set_zero()
C++ version of gsl_vector_uint_set_zero().
vector_uint(block_uint &b, size_t const offset, size_t const n, size_t const stride=1)
C++ version of gsl_vector_uint_alloc_from_block().
vector_uint const const_subvector(size_t i, size_t n) const
C++ version of gsl_vector_uint_const_subvector().
static vector_uint view_array_with_stride(unsigned int *base, size_t stride, size_t n)
C++ version of gsl_vector_uint_view_array_with_stride().
size_t min_index() const
C++ version of gsl_vector_uint_min_index().
void minmax(unsigned int *min_out, unsigned int *max_out) const
C++ version of gsl_vector_uint_minmax().
bool operator==(vector_uint const &v) const
Two vector_uint objects are identically equal if their elements are identical.
vector_uint subvector_with_stride(size_t i, size_t stride, size_t n)
C++ version of gsl_vector_uint_subvector_with_stride().
int sub(vector_uint const &b)
C++ version of gsl_vector_uint_sub().
~vector_uint()
The destructor only deletes the pointers if count reaches zero.
int isnull() const
C++ version of gsl_vector_uint_isnull().
unsigned int * ptr(size_t const i)
C++ version of gsl_vector_uint_ptr().
value_type const * const_pointer
A container must have a constant pointer type.
vector_uint(V &v, size_t const stride=1)
Construct from an object that implements data() and size().
bool unique() const
Find if this is the only object sharing the gsl_vector_uint.
int fprintf(FILE *stream, char const *format) const
C++ version of gsl_vector_uint_fprintf().
static vector_uint const const_view_array(ARRAY const &v, size_t n=0)
C++ version of gsl_vector_uint _const_view_array().
int fread(FILE *stream)
C++ version of gsl_vector_uint_fread().
vector_uint(size_t const n)
The default constructor creates a new vector_uint with n elements.
Definition: vector_uint.hpp:61
size_t max_index() const
C++ version of gsl_vector_uint_max_index().
int fscanf(FILE *stream)
C++ version of gsl_vector_uint_fscanf().
unsigned int const * data() const
Give access to the data block_uint.
void swap(vector_uint &v)
Swap two vector_uint objects.
void minmax(unsigned int &min_out, unsigned int &max_out) const
C++ version of gsl_vector_uint_minmax().
static vector_uint const const_view_array(unsigned int const *v, size_t n)
C++ version of gsl_vector_uint _const_view_array().
void set(size_t const i, unsigned int x)
C++ version of gsl_vector_uint_set().
value_type & reference
A container must have a reference type.
bool operator<=(vector_uint const &v) const
A container needs to define an ordering for sorting.
vector_uint const const_subvector_with_stride(size_t i, size_t stride, size_t n) const
C++ version of gsl_vector_uint_const_subvector_with_stride().
const_iterator::difference_type difference_type
A container must have a difference_type.
unsigned int sum(vector_uint const &a) const
C++ version of gsl_vector_uint_sum().
static vector_uint view_array(unsigned int *v, size_t n)
C++ version of gsl_vector_uint_view_array().
int set_basis(size_t i)
C++ version of gsl_vector_uint_set_basis().
iterator begin()
Get iterator pointing to first vector_uint element.
static vector_uint calloc(size_t const n)
C++ version of gsl_vector_uint_calloc().
void reset()
Stop sharing ownership of the shared pointer.
gsl_vector_uint * get()
Get the gsl_vector_uint.
unsigned int const * const_ptr(size_t const i) const
C++ version of gsl_vector_uint_const_ptr().
void wrap_gsl_vector_uint_without_ownership(gsl_vector_uint *v)
This function is intended mainly for internal use.
vector_uint()
The default constructor is only really useful for assigning to.
Definition: vector_uint.hpp:50
unsigned int value_type
A container must have a value_type.
gsl_vector_uint * ccgsl_pointer
The shared pointer.
vector_uint(vector_uint &v)
The copy constructor.
iterator_t< false > iterator
The iterator type.
const_reverse_iterator rbegin() const
Get iterator pointing to first vector_uint element.
bool operator>=(vector_uint const &v) const
A container needs to define an ordering for sorting.
vector_uint(vector_uint &&v)
Move constructor.
size_type max_size() const
The max size (number of elements) of the vector_uint.
int isneg() const
C++ version of gsl_vector_uint_isneg().
unsigned int * data()
Give access to the data block_uint.
bool empty() const
Find if the vector_uint is empty.
vector_uint(vector_uint &v, size_t const offset, size_t const n, size_t const stride=1)
C++ version of gsl_vector_uint_alloc_from_vector().
const_iterator_t< false > const_iterator
The const_iterator type.
vector_uint & operator=(vector_uint &&v)
Move operator.
int ispos() const
C++ version of gsl_vector_uint_ispos().
size_type size() const
The size (number of elements) of the vector_uint.
unsigned int get(size_t const i) const
C++ version of gsl_vector_uint_get().
size_t * count
The shared reference count.
value_type * pointer
A container must have a pointer type.
int add_constant(unsigned int const x)
C++ version of gsl_vector_uint_add_constant().
reverse_iterator rbegin()
Get iterator pointing to first vector_uint element.
void set_all(unsigned int x)
C++ version of gsl_vector_uint_set_all().
iterator end()
Get iterator pointing beyond last vector_uint element.
int isnonneg() const
C++ version of gsl_vector_uint_isnonneg().
static vector_uint view_array_with_stride(ARRAY &base, size_t stride, size_t n=0)
C++ version of gsl_vector_uint_view_array_with_stride().
vector_uint subvector(size_t i, size_t n)
C++ version of gsl_vector_uint_subvector().
const_iterator_t< true > const_reverse_iterator
The const_reverse_t type.
iterator_t< true > reverse_iterator
The reverse_iterator type.
int mul(vector_uint const &b)
C++ version of gsl_vector_uint_mul().
int swap_elements(size_t const i, size_t const j)
C++ version of gsl_vector_uint_swap_elements().
static vector_uint alloc_row_from_matrix(matrix_uint &m, size_t const i)
C++ version of gsl_vector_uint_alloc_row_from_matrix().
unsigned int min() const
C++ version of gsl_vector_uint_min().
static vector_uint view_array(ARRAY &v, size_t n=0)
C++ version of gsl_vector_uint_view_array().
size_t size_type
A container must have a size_type.
bool operator>(vector_uint 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.
vector_uint(vector_uint const &v)
The copy constructor.
const_iterator begin() const
Get iterator pointing to first vector_uint element.
static vector_uint const const_view_array_with_stride(ARRAY const &base, size_t stride, size_t n=0)
C++ version of gsl_vector_uint_const_view_array_with_stride().
int memcpy(vector_uint const &src)
C++ version of gsl_vector_uint_memcpy().
reverse_iterator rend()
Get iterator pointing beyond last vector_uint element.
size_t use_count() const
Find how many vector_uint objects share this pointer.
value_type const & const_reference
A container must have a constant reference type.
int scale(unsigned int const x)
C++ version of gsl_vector_uint_scale().
const_reverse_iterator rend() const
Get iterator pointing beyond last vector_uint element.
static vector_uint const const_view_array_with_stride(unsigned int const *base, size_t stride, size_t n)
C++ version of gsl_vector_uint_const_view_array_with_stride().
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