ccgsl 2.7.2
C++wrappersforGnuScientificLibrary
matrix_ulong.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_MATRIX_ULONG_HPP
20#define CCGSL_MATRIX_ULONG_HPP
21
22#include<gsl/gsl_matrix.h>
23#include<new>
24#include<gsl/gsl_permute_matrix_ulong.h>
25
26#include"exception.hpp"
27#include"vector_ulong.hpp"
28#include"permutation.hpp"
29
30// This file is autogenerated
31
32namespace gsl {
58 public:
63 owns_data = false;
64 ccgsl_pointer = 0;
65 count = 0; // initially nullptr will do
66 }
67 // Refines random access container
68 // Refines assignable
74 explicit matrix_ulong( size_t const n1, size_t const n2 ) : owns_data(true){
75 if( n1 > 0 and n2 > 0 ) ccgsl_pointer = gsl_matrix_ulong_alloc( n1, n2 );
76 else { ccgsl_pointer = new gsl_matrix_ulong; ccgsl_pointer->size1 = n1;
77 ccgsl_pointer->size2 = n2; ccgsl_pointer->data = 0; }
78 // just plausibly we could allocate matrix_ulong but not count
79 try { count = new size_t; } catch( std::bad_alloc& e ){
80 // try to tidy up before rethrowing
81 if( n1 > 0 and n2 > 0 ) gsl_matrix_ulong_free( ccgsl_pointer );
82 else delete ccgsl_pointer;
83 throw e;
84 }
85 *count = 1; // initially there is just one reference to ccgsl_pointer
86 }
92 explicit matrix_ulong( gsl_matrix_ulong* v ) : owns_data(true){
93 ccgsl_pointer = v;
94 // just plausibly we could fail to allocate count: no further action needed.
95 count = new size_t;
96 *count = 1; // initially there is just one reference to ccgsl_pointer
97 }
98#ifdef __GXX_EXPERIMENTAL_CXX0X__
103 matrix_ulong( std::initializer_list<std::initializer_list<unsigned long> > initializer_list ) : owns_data(true){
104 size_t const n1 = initializer_list.size();
105 size_t const n2 = initializer_list.begin()->size();
106 for( auto l : initializer_list ){
107 if( l.size() != n2 ){
108 gsl::exception e( "matrix_ulong rows have unequal sizes", __FILE__, __LINE__,
110 throw( e );
111 }
112 }
113 ccgsl_pointer = gsl_matrix_ulong_alloc( n1, n2 );
114 // just plausibly we could allocate matrix_ulong but not count
115 try { count = new size_t; } catch( std::bad_alloc& e ){
116 // try to tidy up before rethrowing
117 if( n1 > 0 and n2 > 0 ) gsl_matrix_ulong_free( ccgsl_pointer );
118 else delete ccgsl_pointer;
119 throw e;
120 }
121 *count = 1; // initially there is just one reference to ccgsl_pointer
122 // now copy
123 int r = 0;
124 for( auto row : initializer_list ){
125 size_t c = 0;
126 for( auto x : row ){ set( r, c, x ); ++c; }
127 ++r;
128 }
129 }
130#endif
131 // copy constructor
138 if( count != 0 ) ++*count; // matrix_ulong is now shared.
139 }
140 // assignment operator
146 // first, possibly delete anything pointed to by this
147 if( count == 0 or --*count == 0 ){
148 if( ccgsl_pointer != 0 and ccgsl_pointer->size1 > 0 and ccgsl_pointer->size2 > 0 ) gsl_matrix_ulong_free( ccgsl_pointer );
149 else delete ccgsl_pointer;
150 delete count;
151 }
152 // Then copy
155 count = v.count;
156 if( count != 0 ) ++*count; // block_ulong is now shared.
157 return *this;
158 }
159 // clone()
166 matrix_ulong copy( get()->size1, get()->size2 );
167 // Now copy
168 gsl_matrix_ulong_memcpy( copy.get(), get() );
169 // return new object
170 return copy;
171 }
172 // destructor
177 if( count != 0 and --*count == 0 ){
178 // could have allocated null pointer
179 if( ccgsl_pointer != 0 and owns_data ){
180 if( ccgsl_pointer->size1 > 0 and ccgsl_pointer->size2 > 0 )
181 gsl_matrix_ulong_free( ccgsl_pointer );
182 else delete ccgsl_pointer; }
183 delete count;
184 }
185 }
186
187 // Allow possibility of assigning from gsl_matrix_ulong without sharing
196 void wrap_gsl_matrix_ulong_without_ownership( gsl_matrix_ulong* v ){
197 if( count != 0 and --*count == 0 ){
198 // could have allocated null pointer
199 if( ccgsl_pointer != 0 ){
200 if( ccgsl_pointer->size1 != 0 and ccgsl_pointer->size1 != 0 )
201 gsl_matrix_ulong_free( ccgsl_pointer );
202 else delete ccgsl_pointer; }
203 }
204 ccgsl_pointer = v;
205 if(0 == count) count = new size_t;
206 *count = 1;
207 owns_data = false; // should never be able to delete ccgsl_pointer
208 }
212 void reset(){ matrix_ulong().swap( *this ); }
213#ifdef __GXX_EXPERIMENTAL_CXX0X__
219 ccgsl_pointer( v.ccgsl_pointer ), count( nullptr ){
220 std::swap( count, v.count );
221 v.ccgsl_pointer = nullptr;
222 }
229 matrix_ulong( std::move( v ) ).swap( *this );
230 return *this;
231 }
232#endif
233 private:
247 vector_ulong& operator*(){ return *this; }
252 vector_ulong* operator->(){ return this; }
253 };
258 template<typename container,typename content,bool reverse_t> class iterator_base {
259 friend class vector_ulong;
260 public:
264 typedef std::bidirectional_iterator_tag iterator_category;
277 public:
278 // // operator*
284 // Always try to return something
285 static content something;
286 // First check that iterator is initialised.
287 if( v == 0 ){
288 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
289 return something;
290 } else if( v->ccgsl_pointer == 0 ){
291 gsl_error( "matrix_ulong not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
292 return something;
293 }
294 // Check that position make sense
295 if( position >= v->size1() ){
296 gsl_error( "trying to dereference end()", __FILE__, __LINE__, exception::GSL_EFAILED );
297 return something;
298 }
299 // position and v are valid: return data
300 return v->row( position );
301 }
302 // // operator->
308 // Always try to return something
309 static content something_base;
310 static vector_ulong_ptr something( something_base );
311 // First check that iterator is initialised.
312 if( v == 0 ){
313 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
314 return something;
315 } else if( v->ccgsl_pointer == 0 ){
316 gsl_error( "matrix_ulong not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
317 return something;
318 }
319 // Check that position make sense
320 if( position >= v->size1() ){
321 gsl_error( "trying to dereference end()", __FILE__, __LINE__, exception::GSL_EFAILED );
322 return something;
323 }
324 // position and v are valid: return data
325 vector_ulong_ptr ptr( v->row( position ) );
326#ifdef __GXX_EXPERIMENTAL_CXX0X__
327 return std::move( ptr );
328#else
329 return ptr;
330#endif
331 }
338 return this->v == i.v and this->position == i.position;
339 }
346 return not this->operator==( i );
347 }
348 protected:
353 void increment(){
354 // Only makes sense if v points to a matrix_ulong
355 if( v == 0 ){
356 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
357 return;
358 } else if( v->ccgsl_pointer == 0 ){
359 gsl_error( "matrix_ulong not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
360 return;
361 }
362 // increment position and check against size
363 if( reverse_t ){ if( position >= 0 ) --position; }
364 else { if( position < v->size1() ) ++position; }
365 }
370 void decrement(){
371 // Only makes sense if v points to a matrix_ulong
372 if( v == 0 ){
373 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
374 return;
375 } else if( v->ccgsl_pointer == 0 ){
376 gsl_error( "matrix_ulong not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
377 return;
378 }
379 // decrement position and check against size
380 if( reverse_t ){ if( position < v->size1() ) ++position; }
381 else { if( position >= 0 ) --position; }
382 }
386 iterator_base(){ v = 0; }
392 iterator_base( container* v, size_t position )
393 : v( v ), position( position ){}
397 container* v;
401 size_t position;
402 };
403 // Need to know about const_iterator_t
404 template<bool reverse_t> class const_iterator_t;
408 template<bool reverse_t> class iterator_t : public iterator_base<matrix_ulong,vector_ulong,reverse_t>{
409 public:
410 // // Refines output iterator
411 // // operator=
419 return *this;
420 }
421 // // Refines forward iterator
422 // // operator++ (both)
429 return *this;
430 }
436 // return value
439 return result;
440 }
441 // // Refines bidirectional iterator
442 // // operator-- (both)
449 return *this;
450 }
456 // return value
459 return result;
460 }
467 return this->v == i.v and this->position == i.position;
468 }
475 return not this->operator==( i );
476 }
481 protected:
482 friend class matrix_ulong;
483 // We need a constructor for matrix_ulong
491 };
495 template<bool reverse_t> class const_iterator_t
496 : public iterator_base<matrix_ulong const,vector_ulong const,reverse_t>{
497 public:
498 // // Refines output iterator
499 // // operator=
507 return *this;
508 }
509 // // Refines forward iterator
510 // // operator++ (both)
517 return *this;
518 }
524 // return value
527 return result;
528 }
529 // // Refines bidirectional iterator
530 // // operator-- (both)
537 return *this;
538 }
544 // return value
547 return result;
548 }
560 }
566 bool operator==( iterator_t<reverse_t> const& i ) const {
567 return this->v == i.v and this->position == i.position;
568 }
574 bool operator!=( iterator_t<reverse_t> const& i ) const {
575 return not this->operator==( i );
576 }
583 return this->v == i.v and this->position == i.position;
584 }
591 return not this->operator==( i );
592 }
593 protected:
594 // We need a constructor for matrix_ulong
595 friend class matrix_ulong;
602 : iterator_base<matrix_ulong const,vector_ulong const,reverse_t>( v, position ){}
603 };
604 public:
624 typedef size_t size_type;
625 // begin()
631 return iterator( this, 0 );
632 }
638 return const_iterator( this, 0 );
639 }
640 // end()
646 if( ccgsl_pointer == 0 ) return iterator( this, 0 );
647 return iterator( this, size1() );
648 }
654 if( ccgsl_pointer == 0 ) return const_iterator( this, 0 );
655 return const_iterator( this, size1() );
656 }
657 // rbegin()
663 if( ccgsl_pointer ==0 ) return reverse_iterator( this, 0 );
664 return reverse_iterator( this, size1() - 1 );
665 }
671 if( ccgsl_pointer == 0 ) return const_reverse_iterator( this, 0 );
672 return const_reverse_iterator( this, size1() - 1 );
673 }
674 // rend()
680 return reverse_iterator( this, -1 );
681 }
687 return const_reverse_iterator( this, -1 );
688 }
689 public:
690 // Sizes
695 size_t size1() const { return ccgsl_pointer == 0 ? 0 : ccgsl_pointer->size1; }
700 size_t size2() const { return ccgsl_pointer == 0 ? 0 : ccgsl_pointer->size2; }
708 unsigned long* data() {
709 if( ccgsl_pointer == 0 ) gsl_error( "null vector_ulong", __FILE__, __LINE__, GSL_EFAULT );
710#ifndef GSL_RANGE_CHECK_OFF
711 if( ccgsl_pointer->size2 != ccgsl_pointer->tda )
712 gsl_error( "matrix_ulong size2 and tda do not match", __FILE__, __LINE__, GSL_EBADLEN );
713#endif
714 return ccgsl_pointer->data; }
722 unsigned long const* data() const {
723 if( ccgsl_pointer == 0 ) gsl_error( "null vector_ulong", __FILE__, __LINE__, GSL_EFAULT );
724#ifndef GSL_RANGE_CHECK_OFF
725 if( ccgsl_pointer->size2 != ccgsl_pointer->tda )
726 gsl_error( "matrix_ulong size2 and tda do not match", __FILE__, __LINE__, GSL_EBADLEN );
727#endif
728 return ccgsl_pointer->data; }
734 void swap( matrix_ulong& m ){
735 std::swap( ccgsl_pointer, m.ccgsl_pointer );
736 std::swap( count, m.count );
737 }
744 void tricpy(CBLAS_UPLO_t Uplo, CBLAS_DIAG_t Diag, matrix_ulong const& src){
745 gsl_matrix_ulong_tricpy( Uplo, Diag, get(), src.get() );
746 }
753 void transpose_tricpy(CBLAS_UPLO_t Uplo, CBLAS_DIAG_t Diag, matrix_ulong const& src){
754 gsl_matrix_ulong_transpose_tricpy( Uplo, Diag, get(), src.get() );
755 }
756 // view operations
765 matrix_ulong submatrix( size_t const i, size_t const j, size_t const n1, size_t const n2 ){
766 gsl_matrix_ulong* m = static_cast<gsl_matrix_ulong*>( malloc( sizeof( gsl_matrix_ulong ) ) );
767 *m = gsl_matrix_ulong_submatrix( get(), i, j, n1, n2 ).matrix;
768 return matrix_ulong( m );
769 }
775 vector_ulong row( size_t const i ){
776 gsl_vector_ulong* w = static_cast<gsl_vector_ulong*>( malloc( sizeof( gsl_vector_ulong ) ) );
777 *w = gsl_matrix_ulong_row( get(), i ).vector;
778 return vector_ulong( w );
779 }
785 vector_ulong column( size_t const j ){
786 gsl_vector_ulong* w = static_cast<gsl_vector_ulong*>( malloc( sizeof( gsl_vector_ulong ) ) );
787 *w = gsl_matrix_ulong_column( get(), j ).vector;
788 return vector_ulong( w );
789 }
795 diagonal(){ gsl_vector_ulong* w = static_cast<gsl_vector_ulong*>( malloc( sizeof( gsl_vector_ulong ) ) );
796 *w = gsl_matrix_ulong_diagonal( get() ).vector;
797 return vector_ulong( w );
798 }
804 vector_ulong subdiagonal( size_t const k ){
805 gsl_vector_ulong* w = static_cast<gsl_vector_ulong*>( malloc( sizeof( gsl_vector_ulong ) ) );
806 *w = gsl_matrix_ulong_subdiagonal( get(), k ).vector;
807 return vector_ulong( w );
808 }
814 vector_ulong superdiagonal( size_t const k ){
815 gsl_vector_ulong* w = static_cast<gsl_vector_ulong*>( malloc( sizeof( gsl_vector_ulong ) ) );
816 *w = gsl_matrix_ulong_superdiagonal( get(), k ).vector;
817 return vector_ulong( w );
818 }
826 vector_ulong subrow( size_t const i, size_t const offset, size_t const n ){
827 gsl_vector_ulong* w = static_cast<gsl_vector_ulong*>( malloc( sizeof( gsl_vector_ulong ) ) );
828 *w = gsl_matrix_ulong_subrow( get(), i, offset, n ).vector;
829 return vector_ulong( w );
830 }
838 vector_ulong subcolumn( size_t const j, size_t const offset, size_t const n ){
839 gsl_vector_ulong* w = static_cast<gsl_vector_ulong*>( malloc( sizeof( gsl_vector_ulong ) ) );
840 *w = gsl_matrix_ulong_subcolumn( get(), j, offset, n ).vector;
841 return vector_ulong( w );
842 }
850 static matrix_ulong view_array( unsigned long* base, size_t const n1, size_t const n2 ){
851 gsl_matrix_ulong* m = static_cast<gsl_matrix_ulong*>( malloc( sizeof( gsl_matrix_ulong ) ) );
852 *m = gsl_matrix_ulong_view_array( base, n1, n2 ).matrix;
853 return matrix_ulong( m );
854 }
863 static matrix_ulong view_array_with_tda( unsigned long* base, size_t const n1, size_t const n2, size_t const tda ){
864 gsl_matrix_ulong* m = static_cast<gsl_matrix_ulong*>( malloc( sizeof( gsl_matrix_ulong ) ) );
865 *m = gsl_matrix_ulong_view_array_with_tda( base, n1, n2, tda ).matrix;
866 return matrix_ulong( m );
867 }
875 static matrix_ulong view_vector( vector_ulong& v, size_t const n1, size_t const n2 ){
876 gsl_matrix_ulong* m = static_cast<gsl_matrix_ulong*>( malloc( sizeof( gsl_matrix_ulong ) ) );
877 *m = gsl_matrix_ulong_view_vector( v.get(), n1, n2 ).matrix;
878 return matrix_ulong( m );
879 }
888 static matrix_ulong view_vector_with_tda( vector_ulong& v, size_t const n1, size_t const n2, size_t const tda ){
889 gsl_matrix_ulong* m = static_cast<gsl_matrix_ulong*>( malloc( sizeof( gsl_matrix_ulong ) ) );
890 *m = gsl_matrix_ulong_view_vector_with_tda( v.get(), n1, n2, tda ).matrix;
891 return matrix_ulong( m );
892 }
893 // const versions ...
902 matrix_ulong const const_submatrix( size_t const i, size_t const j, size_t const n1, size_t const n2 ) const {
903 gsl_matrix_ulong* m = static_cast<gsl_matrix_ulong*>( malloc( sizeof( gsl_matrix_ulong ) ) );
904 *m = gsl_matrix_ulong_const_submatrix( get(), i, j, n1, n2 ).matrix;
905 return matrix_ulong( m );
906 }
912 vector_ulong const const_row( size_t const i ) const {
913 gsl_vector_ulong* w = static_cast<gsl_vector_ulong*>( malloc( sizeof( gsl_vector_ulong ) ) );
914 *w = gsl_matrix_ulong_const_row( get(), i ).vector;
915 return vector_ulong( w );
916 }
922 vector_ulong const const_column( size_t const j ) const {
923 gsl_vector_ulong* w = static_cast<gsl_vector_ulong*>( malloc( sizeof( gsl_vector_ulong ) ) );
924 *w = gsl_matrix_ulong_const_column( get(), j ).vector;
925 return vector_ulong( w );
926 }
932 gsl_vector_ulong* w = static_cast<gsl_vector_ulong*>( malloc( sizeof( gsl_vector_ulong ) ) );
933 *w = gsl_matrix_ulong_const_diagonal( get() ).vector;
934 return vector_ulong( w );
935 }
941 vector_ulong const const_subdiagonal( size_t const k ) const {
942 gsl_vector_ulong* w = static_cast<gsl_vector_ulong*>( malloc( sizeof( gsl_vector_ulong ) ) );
943 *w = gsl_matrix_ulong_const_subdiagonal( get(), k ).vector;
944 return vector_ulong( w );
945 }
951 vector_ulong const const_superdiagonal( size_t const k ) const {
952 gsl_vector_ulong* w = static_cast<gsl_vector_ulong*>( malloc( sizeof( gsl_vector_ulong ) ) );
953 *w = gsl_matrix_ulong_const_superdiagonal( get(), k ).vector;
954 return vector_ulong( w );
955 }
963 vector_ulong const const_subrow( size_t const i, size_t const offset, size_t const n ) const {
964 gsl_vector_ulong* w = static_cast<gsl_vector_ulong*>( malloc( sizeof( gsl_vector_ulong ) ) );
965 *w = gsl_matrix_ulong_const_subrow( get(), i, offset, n ).vector;
966 return vector_ulong( w );
967 }
975 vector_ulong const const_subcolumn( size_t const j, size_t const offset, size_t const n ) const {
976 gsl_vector_ulong* w = static_cast<gsl_vector_ulong*>( malloc( sizeof( gsl_vector_ulong ) ) );
977 *w = gsl_matrix_ulong_const_subcolumn( get(), j, offset, n ).vector;
978 return vector_ulong( w );
979 }
988 matrix_ulong const submatrix( size_t const i, size_t const j, size_t const n1, size_t const n2 ) const {
989 gsl_matrix_ulong* m = static_cast<gsl_matrix_ulong*>( malloc( sizeof( gsl_matrix_ulong ) ) );
990 *m = gsl_matrix_ulong_const_submatrix( get(), i, j, n1, n2 ).matrix;
991 return matrix_ulong( m );
992 }
998 vector_ulong const row( size_t const i ) const {
999 gsl_vector_ulong* w = static_cast<gsl_vector_ulong*>( malloc( sizeof( gsl_vector_ulong ) ) );
1000 *w = gsl_matrix_ulong_const_row( get(), i ).vector;
1001 return vector_ulong( w );
1002 }
1008 vector_ulong const column( size_t const j ) const {
1009 gsl_vector_ulong* w = static_cast<gsl_vector_ulong*>( malloc( sizeof( gsl_vector_ulong ) ) );
1010 *w = gsl_matrix_ulong_const_column( get(), j ).vector;
1011 return vector_ulong( w );
1012 }
1017 vector_ulong const diagonal() const {
1018 gsl_vector_ulong* w = static_cast<gsl_vector_ulong*>( malloc( sizeof( gsl_vector_ulong ) ) );
1019 *w = gsl_matrix_ulong_const_diagonal( get() ).vector;
1020 return vector_ulong( w );
1021 }
1027 vector_ulong const subdiagonal( size_t const k ) const {
1028 gsl_vector_ulong* w = static_cast<gsl_vector_ulong*>( malloc( sizeof( gsl_vector_ulong ) ) );
1029 *w = gsl_matrix_ulong_const_subdiagonal( get(), k ).vector;
1030 return vector_ulong( w );
1031 }
1037 vector_ulong const superdiagonal( size_t const k ) const {
1038 gsl_vector_ulong* w = static_cast<gsl_vector_ulong*>( malloc( sizeof( gsl_vector_ulong ) ) );
1039 *w = gsl_matrix_ulong_const_superdiagonal( get(), k ).vector;
1040 return vector_ulong( w );
1041 }
1049 vector_ulong const subrow( size_t const i, size_t const offset, size_t const n ) const {
1050 gsl_vector_ulong* w = static_cast<gsl_vector_ulong*>( malloc( sizeof( gsl_vector_ulong ) ) );
1051 *w = gsl_matrix_ulong_const_subrow( get(), i, offset, n ).vector;
1052 return vector_ulong( w );
1053 }
1061 vector_ulong const subcolumn( size_t const j, size_t const offset, size_t const n ) const {
1062 gsl_vector_ulong* w = static_cast<gsl_vector_ulong*>( malloc( sizeof( gsl_vector_ulong ) ) );
1063 *w = gsl_matrix_ulong_const_subcolumn( get(), j, offset, n ).vector;
1064 return vector_ulong( w );
1065 }
1073 static matrix_ulong const const_view_array( unsigned long const* base, size_t const n1, size_t const n2 ){
1074 gsl_matrix_ulong* m = static_cast<gsl_matrix_ulong*>( malloc( sizeof( gsl_matrix_ulong ) ) );
1075 *m = gsl_matrix_ulong_const_view_array( base, n1, n2 ).matrix;
1076 return matrix_ulong( m );
1077 }
1086 static matrix_ulong const
1087 const_view_array_with_tda( unsigned long const* base, size_t const n1, size_t const n2, size_t const tda ){
1088 gsl_matrix_ulong* m = static_cast<gsl_matrix_ulong*>( malloc( sizeof( gsl_matrix_ulong ) ) );
1089 *m = gsl_matrix_ulong_const_view_array_with_tda( base, n1, n2, tda ).matrix;
1090 return matrix_ulong( m );
1091 }
1099 static matrix_ulong const const_view_vector( vector_ulong const& v, size_t const n1, size_t const n2 ){
1100 gsl_matrix_ulong* m = static_cast<gsl_matrix_ulong*>( malloc( sizeof( gsl_matrix_ulong ) ) );
1101 *m = gsl_matrix_ulong_const_view_vector( v.get(), n1, n2 ).matrix;
1102 return matrix_ulong( m );
1103 }
1112 static matrix_ulong const
1113 const_view_vector_with_tda( vector_ulong const& v, size_t const n1, size_t const n2, size_t const tda ){
1114 gsl_matrix_ulong* m = static_cast<gsl_matrix_ulong*>( malloc( sizeof( gsl_matrix_ulong ) ) );
1115 *m = gsl_matrix_ulong_const_view_vector_with_tda( v.get(), n1, n2, tda ).matrix;
1116 return matrix_ulong( m );
1117 }
1125 static matrix_ulong const view_array( unsigned long const* base, size_t const n1, size_t const n2 ){
1126 gsl_matrix_ulong* m = static_cast<gsl_matrix_ulong*>( malloc( sizeof( gsl_matrix_ulong ) ) );
1127 *m = gsl_matrix_ulong_const_view_array( base, n1, n2 ).matrix;
1128 return matrix_ulong( m );
1129 }
1138 static matrix_ulong const
1139 view_array_with_tda( unsigned long const* base, size_t const n1, size_t const n2, size_t const tda ){
1140 gsl_matrix_ulong* m = static_cast<gsl_matrix_ulong*>( malloc( sizeof( gsl_matrix_ulong ) ) );
1141 *m = gsl_matrix_ulong_const_view_array_with_tda( base, n1, n2, tda ).matrix;
1142 return matrix_ulong( m );
1143 }
1151 static matrix_ulong const view_vector( vector_ulong const& v, size_t const n1, size_t const n2 ){
1152 gsl_matrix_ulong* m = static_cast<gsl_matrix_ulong*>( malloc( sizeof( gsl_matrix_ulong ) ) );
1153 *m = gsl_matrix_ulong_const_view_vector( v.get(), n1, n2 ).matrix;
1154 return matrix_ulong( m );
1155 }
1164 static matrix_ulong const
1165 view_vector_with_tda( vector_ulong const& v, size_t const n1, size_t const n2, size_t const tda ){
1166 gsl_matrix_ulong* m = static_cast<gsl_matrix_ulong*>( malloc( sizeof( gsl_matrix_ulong ) ) );
1167 *m = gsl_matrix_ulong_const_view_vector_with_tda( v.get(), n1, n2, tda ).matrix;
1168 return matrix_ulong( m );
1169 }
1170 private:
1178 gsl_matrix_ulong* ccgsl_pointer;
1182 size_t* count;
1183 public:
1184 // shared reference functions
1189 gsl_matrix_ulong* get(){ return ccgsl_pointer; }
1194 gsl_matrix_ulong const* get() const { return ccgsl_pointer; }
1200 bool unique() const { return count != 0 and *count == 1; }
1205 size_t use_count() const { return count == 0 ? 0 : *count; }
1211#ifdef __GXX_EXPERIMENTAL_CXX0X__
1212 explicit
1213#endif
1214 operator bool() const { return ccgsl_pointer != 0; }
1215 // GSL functions
1223 static matrix_ulong calloc( size_t const n1, size_t const n2 ){ return matrix_ulong( gsl_matrix_ulong_calloc( n1, n2 ) ); }
1227 void set_zero(){ gsl_matrix_ulong_set_zero( get() ); }
1232 void set_all( unsigned long x ){ gsl_matrix_ulong_set_all( get(), x ); }
1238 int memcpy( matrix_ulong const& src ){ return gsl_matrix_ulong_memcpy( get(), src.get() ); }
1243 unsigned long max() const { return gsl_matrix_ulong_max( get() ); }
1248 unsigned long min() const { return gsl_matrix_ulong_min( get() ); }
1254 void minmax( unsigned long* min_out, unsigned long* max_out ) const {
1255 gsl_matrix_ulong_minmax( get(), min_out, max_out ); }
1261 void minmax( unsigned long& min_out, unsigned long& max_out ) const {
1262 gsl_matrix_ulong_minmax( get(), &min_out, &max_out ); }
1268 int add( matrix_ulong const& b ){ return gsl_matrix_ulong_add( get(), b.get() ); }
1274 int sub( matrix_ulong const& b ){ return gsl_matrix_ulong_sub( get(), b.get() ); }
1280 int scale( unsigned long const x ){ return gsl_matrix_ulong_scale( get(), x ); }
1286 int add_constant( unsigned long const x ){ return gsl_matrix_ulong_add_constant( get(), x ); }
1291 int isnull() const { return gsl_matrix_ulong_isnull( get() ); }
1296 int ispos() const { return gsl_matrix_ulong_ispos( get() ); }
1301 int isneg() const { return gsl_matrix_ulong_isneg( get() ); }
1306 int isnonneg() const { return gsl_matrix_ulong_isnonneg( get() ); }
1313 unsigned long get( size_t const i, size_t const j ) const { return gsl_matrix_ulong_get( get(), i, j ); }
1320 void set( size_t const i, size_t const j, unsigned long x ){ gsl_matrix_ulong_set( get(), i, j, x ); }
1327 unsigned long* ptr( size_t const i, size_t const j ){ return gsl_matrix_ulong_ptr( get(), i, j ); }
1334 unsigned long const* const_ptr( size_t const i, size_t const j ) const {
1335 return gsl_matrix_ulong_const_ptr( get(), i, j ); }
1341 int fread( FILE* stream ){ return gsl_matrix_ulong_fread( stream, get() ); }
1347 int fwrite( FILE* stream ) const { return gsl_matrix_ulong_fwrite( stream, get() ); }
1353 int fscanf( FILE* stream ){ return gsl_matrix_ulong_fscanf( stream, get() ); }
1360 int fprintf( FILE* stream, char const* format ) const {
1361 return gsl_matrix_ulong_fprintf( stream, get(), format ); }
1370 matrix_ulong( block_ulong& b, size_t const offset, size_t const n1, size_t const n2, size_t const d2 ){
1371 ccgsl_pointer = gsl_matrix_ulong_alloc_from_block( b.get(), offset, n1, n2, d2 );
1372 // just plausibly we could allocate vector_ulong but not count
1373 try { count = new size_t; } catch( std::bad_alloc& e ){
1374 // try to tidy up before rethrowing
1375 gsl_matrix_ulong_free( ccgsl_pointer );
1376 throw e;
1377 }
1378 *count = 1; // initially there is just one reference to ccgsl_pointer
1379 }
1388 matrix_ulong( matrix_ulong& m, size_t const k1, size_t const k2, size_t const n1, size_t const n2 ){
1389 ccgsl_pointer = gsl_matrix_ulong_alloc_from_matrix( m.get(), k1, k2, n1, n2 );
1390 // just plausibly we could allocate matrix_ulong but not count
1391 try { count = new size_t; } catch( std::bad_alloc& e ){
1392 // try to tidy up before rethrowing
1393 gsl_matrix_ulong_free( ccgsl_pointer );
1394 throw e;
1395 }
1396 *count = 1; // initially there is just one reference to ccgsl_pointer
1397 }
1398 // More functions
1402 void set_identity(){ gsl_matrix_ulong_set_identity( get() ); }
1409 int swap_rows( size_t const i, size_t const j ){ return gsl_matrix_ulong_swap_rows( get(), i, j ); }
1416 int swap_columns( size_t const i, size_t const j ){
1417 return gsl_matrix_ulong_swap_columns( get(), i, j ); }
1424 int swap_rowcol( size_t const i, size_t const j ){ return gsl_matrix_ulong_swap_rowcol( get(), i, j ); }
1429 int transpose(){ return gsl_matrix_ulong_transpose( get() ); }
1436 return gsl_matrix_ulong_transpose_memcpy( get(), src.get() ); }
1437#ifndef DOXYGEN_SKIP
1443 void max_index( size_t* imax, size_t* jmax ) const {
1444 gsl_matrix_ulong_max_index( get(), imax, jmax ); }
1450 void min_index( size_t* imin, size_t* jmin ) const {
1451 gsl_matrix_ulong_min_index( get(), imin, jmin ); }
1459 void minmax_index( size_t* imin, size_t* jmin, size_t* imax, size_t* jmax ) const {
1460 gsl_matrix_ulong_minmax_index( get(), imin, jmin, imax, jmax ); }
1461#endif
1467 void max_index( size_t& imax, size_t& jmax ) const {
1468 gsl_matrix_ulong_max_index( get(), &imax, &jmax ); }
1474 void min_index( size_t& imin, size_t& jmin ) const {
1475 gsl_matrix_ulong_min_index( get(), &imin, &jmin ); }
1483 void minmax_index( size_t& imin, size_t& jmin, size_t& imax, size_t& jmax ) const {
1484 gsl_matrix_ulong_minmax_index( get(), &imin, &jmin, &imax, &jmax ); }
1490 int
1492 return gsl_matrix_ulong_mul_elements( get(), b.get() ); }
1500 return gsl_matrix_ulong_div_elements( get(), b.get() ); }
1505 unsigned long norm1() const {
1506 return gsl_matrix_ulong_norm1( get() ); }
1512 int scale_rows( vector_ulong const& x ){
1513 return gsl_matrix_ulong_scale_rows( get(), x.get() ); }
1520 return gsl_matrix_ulong_scale_columns( get(), x.get() ); }
1526 int add_diagonal( unsigned long const x ){
1527 return gsl_matrix_ulong_add_diagonal( get(), x ); }
1534 int get_row( vector_ulong& v, size_t const i ) const {
1535 return gsl_matrix_ulong_get_row( v.get(), get(), i ); }
1542 int get_col( vector_ulong& v, size_t const j ) const {
1543 return gsl_matrix_ulong_get_col( v.get(), get(), j ); }
1550 int set_row( size_t const i, vector_ulong const& v ){
1551 return gsl_matrix_ulong_set_row( get(), i, v.get() ); }
1558 int set_col( size_t const j, vector_ulong const& v ){
1559 return gsl_matrix_ulong_set_col( get(), j, v.get() ); }
1560 // Extra functions for []
1568 vector_ulong operator[]( size_t const i ){
1569 // First check that iterator is initialised.
1570 if( ccgsl_pointer == 0 ){
1571 gsl_error( "matrix_ulong is null", __FILE__, __LINE__, exception::GSL_EFAULT );
1572 return vector_ulong();
1573 }
1574#ifndef GSL_RANGE_CHECK_OFF
1575#ifndef __GXX_EXPERIMENTAL_CXX0X__
1576 static vector_ulong something;
1577#endif
1578 //Check that position make sense
1579 if( i >= size1() ){
1580 gsl_error( "trying to read beyond last row of matrix_ulong",
1581 __FILE__, __LINE__, exception::GSL_EINVAL );
1582#ifdef __GXX_EXPERIMENTAL_CXX0X__
1583 return vector_ulong();
1584#else
1585 return something;
1586#endif
1587 }
1588 // n is a valid position
1589#endif
1590 vector_ulong v(0);
1591 gsl_vector_ulong_view w = gsl_matrix_ulong_row( ccgsl_pointer, i );
1593 return v;
1594 }
1602 vector_ulong const operator[]( size_t const i ) const {
1603 // First check that iterator is initialised.
1604 if( ccgsl_pointer == 0 ){
1605 gsl_error( "matrix_ulong is null", __FILE__, __LINE__, exception::GSL_EFAULT );
1606 return vector_ulong();
1607 }
1608 vector_ulong v(0);
1609 gsl_vector_ulong_view w = gsl_matrix_ulong_row( ccgsl_pointer, i );
1611 return v;
1612 }
1618 inline int
1620 return gsl_permute_matrix_ulong( p.get(), get() ); }
1621 };
1622
1623 // Extra functions for vector_ulong allocation from matrix_ulong objects
1625 inline vector_ulong vector_ulong::alloc_row_from_matrix( matrix_ulong& m, size_t const i ){
1626 return vector_ulong ( gsl_vector_ulong_alloc_row_from_matrix( m.get(), i ) ); }
1627 inline vector_ulong vector_ulong::alloc_col_from_matrix( matrix_ulong& m, size_t const i ){
1628 return vector_ulong ( gsl_vector_ulong_alloc_col_from_matrix( m.get(), i ) ); }
1630}
1631#endif
This class handles vector_ulongs as shared handles.
Definition: block_ulong.hpp:41
This class is used to handle gsl exceptions so that gsl can use these rather than the GSL error handl...
Definition: exception.hpp:387
@ 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
A class template for the const iterators.
const_iterator_t< reverse_t > operator++(int)
The postfix ++ operator.
const_iterator_t< reverse_t > & operator++()
The prefix ++ operator.
const_iterator_t< reverse_t > & operator--()
The prefix – operator.
const_iterator_t(iterator_t< reverse_t > const &i)
A copy constructor.
const_iterator_t< reverse_t > & operator=(const_iterator_t< reverse_t > const &i)
We can assign one output iterator from another.
const_iterator_t(matrix_ulong const *v, size_t position)
This constructor allows vector_ulong to create non-default iterators.
bool operator!=(iterator_t< reverse_t > const &i) const
Comparison with non-const iterator.
bool operator==(iterator_t< reverse_t > const &i) const
Comparison with non-const iterator.
const_iterator_t()
The default constructor.
bool operator==(const_iterator_t< reverse_t > const &i) const
Comparison with const iterator.
bool operator!=(const_iterator_t< reverse_t > const &i) const
Comparison with const iterator.
const_iterator_t< reverse_t > operator--(int)
The postfix – operator.
We create a suitable class for iterator types here.
vector_ulong_ptr pointer
An iterator must have a pointer typea.
bool operator==(iterator_base< container, content, reverse_t > const &i) const
The == operator.
void increment()
Increment the iterator.
pointer operator->() const
Dereference the pointer.
vector_ulong value_type
An iterator must have a value type.
void decrement()
Decrement the iterator.
container * v
Store a pointer to a matrix_ulong we can iterate over: 0 if no matrix_ulong.
std::bidirectional_iterator_tag iterator_category
An iterator must have an iterator category.
bool operator!=(iterator_base< container, content, reverse_t > const &i) const
The != operator.
size_t position
Mark position of iterator within matrix_ulong.
value_type reference
An iterator must have a reference type.
iterator_base()
The iterator is default constructible.
reference operator*() const
Dereference the pointer.
iterator_base(container *v, size_t position)
This constructor allows vector_ulong to create non-default iterators.
A class template for the two non-const iterators.
iterator_t< reverse_t > & operator--()
The prefix – operator.
bool operator==(const_iterator_t< reverse_t > const &i) const
Comparison with const iterator.
bool operator!=(const_iterator_t< reverse_t > const &i) const
Comparison with const iterator.
iterator_t()
The default constructor.
iterator_t< reverse_t > & operator=(iterator_t< reverse_t > const &i)
We can assign one output iterator from another.
iterator_t(matrix_ulong *v, size_t position)
This constructor allows vector_ulong to create non-default iterators.
iterator_t< reverse_t > & operator++()
The prefix ++ operator.
iterator_t< reverse_t > operator++(int)
The postfix ++ operator.
iterator_t< reverse_t > operator--(int)
The postfix – operator.
This class handles matrix_ulong objects as shared handles.
reverse_iterator rend()
Get iterator pointing beyond last vector_ulong element.
size_t use_count() const
Find how many matrix_ulong objects share this pointer.
size_t size1() const
The number of rows of the matrix_ulong.
unsigned long norm1() const
C++ version of gsl_matrix_ulong_norm1().
int fread(FILE *stream)
C++ version of gsl_matrix_ulong_fread().
size_t size_type
A container must have a size_type.
vector_ulong const const_superdiagonal(size_t const k) const
C++ version of gsl_matrix_ulong_const_superdiagonal().
void min_index(size_t &imin, size_t &jmin) const
C++ version of gsl_matrix_ulong_min_index().
unsigned long min() const
C++ version of gsl_matrix_ulong_min().
void max_index(size_t &imax, size_t &jmax) const
C++ version of gsl_matrix_ulong_max_index().
gsl_matrix_ulong * ccgsl_pointer
The shared pointer.
int swap_columns(size_t const i, size_t const j)
C++ version of gsl_matrix_ulong_swap_columns().
static matrix_ulong view_vector(vector_ulong &v, size_t const n1, size_t const n2)
C++ version of gsl_matrix_ulong_view_vector().
void minmax(unsigned long &min_out, unsigned long &max_out) const
C++ version of gsl_matrix_ulong_minmax().
size_t size2() const
The number of columns of the matrix_ulong.
void reset()
Stop sharing ownership of the shared pointer.
gsl_matrix_ulong const * get() const
Get the gsl_matrix_ulong.
bool owns_data
Used to allow a vector that does not own its data.
static matrix_ulong calloc(size_t const n1, size_t const n2)
C++ version of gsl_matrix_ulong_calloc().
void minmax_index(size_t &imin, size_t &jmin, size_t &imax, size_t &jmax) const
C++ version of gsl_matrix_ulong_minmax_index().
void set(size_t const i, size_t const j, unsigned long x)
C++ version of gsl_matrix_ulong_set().
vector_ulong const const_row(size_t const i) const
C++ version of gsl_matrix_ulong_const_row().
int scale_rows(vector_ulong const &x)
C++ version of gsl_matrix_ulong_scale_rows().
vector_ulong const operator[](size_t const i) const
This function allows us to use a matrix_ulong like an array.
matrix_ulong(matrix_ulong &&v)
Move constructor.
static matrix_ulong const const_view_vector(vector_ulong const &v, size_t const n1, size_t const n2)
C++ version of gsl_matrix_ulong_const_view_vector().
static matrix_ulong const const_view_array(unsigned long const *base, size_t const n1, size_t const n2)
C++ version of gsl_matrix_ulong_const_view_array().
matrix_ulong clone() const
The clone function.
vector_ulong const subcolumn(size_t const j, size_t const offset, size_t const n) const
Another C++ version of gsl_matrix_ulong_const_subcolumn().
vector_ulong subdiagonal(size_t const k)
C++ version of gsl_matrix_ulong_subdiagonal().
unsigned long max() const
C++ version of gsl_matrix_ulong_max().
const_iterator end() const
Get iterator pointing beyond last vector_ulong element.
unsigned long get(size_t const i, size_t const j) const
C++ version of gsl_matrix_ulong_get().
vector_ulong const const_column(size_t const j) const
C++ version of gsl_matrix_ulong_const_column().
int transpose()
C++ version of gsl_matrix_ulong_transpose().
int mul_elements(matrix_ulong const &b)
C++ version of gsl_matrix_ulong_mul_elements().
const_iterator begin() const
Get iterator pointing to first vector_ulong element.
int set_row(size_t const i, vector_ulong const &v)
C++ version of gsl_matrix_ulong_set_row().
matrix_ulong submatrix(size_t const i, size_t const j, size_t const n1, size_t const n2)
C++ version of gsl_matrix_ulong_submatrix().
int fscanf(FILE *stream)
C++ version of gsl_matrix_ulong_fscanf().
iterator_t< false > iterator
The iterator type.
vector_ulong const row(size_t const i) const
Another C++ version of gsl_matrix_ulong_const_row().
vector_ulong superdiagonal(size_t const k)
C++ version of gsl_matrix_ulong_superdiagonal().
void wrap_gsl_matrix_ulong_without_ownership(gsl_matrix_ulong *v)
This function is intended mainly for internal use.
int isneg() const
C++ version of gsl_matrix_ulong_isneg().
void set_identity()
C++ version of gsl_matrix_ulong_set_identity().
unsigned long const * data() const
Give access to the data block_ulong.
unsigned long const * const_ptr(size_t const i, size_t const j) const
C++ version of gsl_matrix_ulong_const_ptr().
matrix_ulong(matrix_ulong &m, size_t const k1, size_t const k2, size_t const n1, size_t const n2)
C++ version of gsl_matrix_ulong_alloc_from_matrix().
vector_ulong const diagonal() const
Another C++ version of gsl_matrix_ulong_const_diagonal().
static matrix_ulong view_array_with_tda(unsigned long *base, size_t const n1, size_t const n2, size_t const tda)
C++ version of gsl_matrix_ulong_view_array_with_tda().
int fwrite(FILE *stream) const
C++ version of gsl_matrix_ulong_fwrite().
int scale_columns(vector_ulong const &x)
C++ version of gsl_matrix_ulong_scale_columns().
int isnonneg() const
C++ version of gsl_matrix_ulong_isnonneg().
static matrix_ulong const view_vector(vector_ulong const &v, size_t const n1, size_t const n2)
Another C++ version of gsl_matrix_ulong_const_view_vector().
vector_ulong subcolumn(size_t const j, size_t const offset, size_t const n)
C++ version of gsl_matrix_ulong_subcolumn().
int div_elements(matrix_ulong const &b)
C++ version of gsl_matrix_ulong_div_elements().
reverse_iterator rbegin()
Get iterator pointing to first vector_ulong element.
matrix_ulong(std::initializer_list< std::initializer_list< unsigned long > > initializer_list)
Could construct from a std::initializer_list in C++11.
matrix_ulong const submatrix(size_t const i, size_t const j, size_t const n1, size_t const n2) const
Another C++ version of gsl_matrix_ulong_const_submatrix().
int swap_rows(size_t const i, size_t const j)
C++ version of gsl_matrix_ulong_swap_rows().
vector_ulong const const_subrow(size_t const i, size_t const offset, size_t const n) const
C++ version of gsl_matrix_ulong_const_subrow().
int swap_rowcol(size_t const i, size_t const j)
C++ version of gsl_matrix_ulong_swap_rowcol().
static matrix_ulong const const_view_vector_with_tda(vector_ulong const &v, size_t const n1, size_t const n2, size_t const tda)
C++ version of gsl_matrix_ulong_const_view_vector_with_tda().
gsl_matrix_ulong * get()
Get the gsl_matrix_ulong.
matrix_ulong(gsl_matrix_ulong *v)
Could construct from a gsl_matrix_ulong.
static matrix_ulong const view_vector_with_tda(vector_ulong const &v, size_t const n1, size_t const n2, size_t const tda)
Another C++ version of gsl_matrix_ulong_const_view_vector_with_tda().
matrix_ulong(matrix_ulong const &v)
The copy constructor.
iterator end()
Get iterator pointing beyond last vector_ulong element.
int get_row(vector_ulong &v, size_t const i) const
C++ version of gsl_matrix_ulong_get_row().
int transpose_memcpy(matrix_ulong const &src)
C++ version of gsl_matrix_ulong_transpose_memcpy().
matrix_ulong const const_submatrix(size_t const i, size_t const j, size_t const n1, size_t const n2) const
C++ version of gsl_matrix_ulong_const_submatrix().
const_reverse_iterator rbegin() const
Get iterator pointing to first vector_ulong element.
int get_col(vector_ulong &v, size_t const j) const
C++ version of gsl_matrix_ulong_get_col().
int add_constant(unsigned long const x)
C++ version of gsl_matrix_ulong_add_constant().
const_reverse_iterator rend() const
Get iterator pointing beyond last vector_ulong element.
~matrix_ulong()
The destructor only deletes the pointers if count reaches zero.
int add(matrix_ulong const &b)
C++ version of gsl_matrix_ulong_add().
int set_col(size_t const j, vector_ulong const &v)
C++ version of gsl_matrix_ulong_set_col().
vector_ulong operator[](size_t const i)
This function allows us to use a matrix_ulong like an array.
int permute(permutation &p)
Permute the columns of this by permutation p.
vector_ulong const const_diagonal() const
C++ version of gsl_matrix_ulong_const_diagonal().
static matrix_ulong const view_array(unsigned long const *base, size_t const n1, size_t const n2)
Another C++ version of gsl_matrix_ulong_const_view_array().
vector_ulong const const_subdiagonal(size_t const k) const
C++ version of gsl_matrix_ulong_const_subdiagonal().
const_iterator_t< true > const_reverse_iterator
The const_reverse_t type.
vector_ulong subrow(size_t const i, size_t const offset, size_t const n)
C++ version of gsl_matrix_ulong_subrow().
size_t * count
The shared reference count.
int sub(matrix_ulong const &b)
C++ version of gsl_matrix_ulong_sub().
static matrix_ulong view_array(unsigned long *base, size_t const n1, size_t const n2)
C++ version of gsl_matrix_ulong_view_array().
void set_all(unsigned long x)
C++ version of gsl_matrix_ulong_set_all().
unsigned long * data()
Give access to the data block_ulong.
void minmax(unsigned long *min_out, unsigned long *max_out) const
C++ version of gsl_matrix_ulong_minmax().
int memcpy(matrix_ulong const &src)
C++ version of gsl_matrix_ulong_memcpy().
static matrix_ulong const view_array_with_tda(unsigned long const *base, size_t const n1, size_t const n2, size_t const tda)
Another C++ version of gsl_matrix_ulong_const_view_array_with_tda().
int isnull() const
C++ version of gsl_matrix_ulong_isnull().
int ispos() const
C++ version of gsl_matrix_ulong_ispos().
vector_ulong column(size_t const j)
C++ version of gsl_matrix_ulong_column().
matrix_ulong & operator=(matrix_ulong const &v)
The assignment operator.
vector_ulong const column(size_t const j) const
Another C++ version of gsl_matrix_ulong_const_column().
void set_zero()
C++ version of gsl_matrix_ulong_set_zero().
vector_ulong const superdiagonal(size_t const k) const
Another C++ version of gsl_matrix_ulong_const_superdiagonal().
matrix_ulong(size_t const n1, size_t const n2)
This constructor creates a new matrix_ulong with n1 rows and n2 columns.
vector_ulong const subrow(size_t const i, size_t const offset, size_t const n) const
Another C++ version of gsl_matrix_ulong_const_subrow().
int scale(unsigned long const x)
C++ version of gsl_matrix_ulong_scale().
unsigned long * ptr(size_t const i, size_t const j)
C++ version of gsl_matrix_ulong_ptr().
matrix_ulong & operator=(matrix_ulong &&v)
Move operator.
vector_ulong const subdiagonal(size_t const k) const
Another C++ version of gsl_matrix_ulong_const_subdiagonal().
static matrix_ulong view_vector_with_tda(vector_ulong &v, size_t const n1, size_t const n2, size_t const tda)
C++ version of gsl_matrix_ulong_view_vector_with_tda().
int add_diagonal(unsigned long const x)
C++ version of gsl_matrix_ulong_add_diagonal().
vector_ulong row(size_t const i)
C++ version of gsl_matrix_ulong_row().
matrix_ulong(block_ulong &b, size_t const offset, size_t const n1, size_t const n2, size_t const d2)
C++ version of gsl_matrix_ulong_alloc_from_block().
iterator begin()
Get iterator pointing to first vector_ulong element.
void tricpy(CBLAS_UPLO_t Uplo, CBLAS_DIAG_t Diag, matrix_ulong const &src)
Copy the upper or lower triangular part of matrix src to this.
iterator_t< true > reverse_iterator
The reverse_iterator type.
const_iterator_t< false > const_iterator
The const_iterator type.
void swap(matrix_ulong &m)
Swap two matrix_ulong objects.
matrix_ulong()
The default constructor is only really useful for assigning to.
vector_ulong const const_subcolumn(size_t const j, size_t const offset, size_t const n) const
C++ version of gsl_matrix_ulong_const_subcolumn().
void transpose_tricpy(CBLAS_UPLO_t Uplo, CBLAS_DIAG_t Diag, matrix_ulong const &src)
Copy the upper or lower triangular part of matrix src to this.
int fprintf(FILE *stream, char const *format) const
C++ version of gsl_matrix_ulong_fprintf().
static matrix_ulong const const_view_array_with_tda(unsigned long const *base, size_t const n1, size_t const n2, size_t const tda)
C++ version of gsl_matrix_ulong_const_view_array_with_tda().
bool unique() const
Find if this is the only object sharing the gsl_matrix_ulong.
vector_ulong diagonal()
C++ version of gsl_matrix_ulong_diagonal().
This class handles GSL permutation objects.
Definition: permutation.hpp:33
gsl_permutation * get()
Get the gsl_permutation.
This class handles vector_ulong objects as shared handles.
void wrap_gsl_vector_ulong_without_ownership(gsl_vector_ulong *v)
This function is intended mainly for internal use.
vector_ulong()
The default constructor is only really useful for assigning to.
static vector_ulong alloc_row_from_matrix(matrix_ulong &m, size_t const i)
C++ version of gsl_vector_ulong_alloc_row_from_matrix().
static vector_ulong alloc_col_from_matrix(matrix_ulong &m, size_t const j)
C++ version of gsl_vector_ulong_alloc_col_from_matrix().
gsl_vector_ulong * get()
Get the gsl_vector_ulong.
size_t n(workspace const &w)
C++ version of gsl_rstat_n().
Definition: rstat.hpp:299
double b(int order, double qq)
C++ version of gsl_sf_mathieu_b().
Definition: sf_mathieu.hpp:298
gsl_sf_result result
Typedef for gsl_sf_result.
Definition: sf_result.hpp:30
The gsl package creates an interface to the GNU Scientific Library for C++.
Definition: blas.hpp:34
This is a pointer-like type for iterator return values.
vector_ulong & operator*()
Dereference operator.
vector_ulong_ptr(vector_ulong const &v)
Typically we have to construct from a vector_ulong.
vector_ulong * operator->()
Dereference operator.