ccgsl 2.7.2
C++wrappersforGnuScientificLibrary
matrix_char.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_CHAR_HPP
20#define CCGSL_MATRIX_CHAR_HPP
21
22#include<gsl/gsl_matrix.h>
23#include<gsl/gsl_permute_matrix_char.h>
24#include<new>
25
26#include"exception.hpp"
27#include"vector_char.hpp"
28#include"permutation.hpp"
29
30// This file is autogenerated
31
32namespace gsl {
59 public:
64 owns_data = false;
65 ccgsl_pointer = 0;
66 count = 0; // initially nullptr will do
67 }
68 // Refines random access container
69 // Refines assignable
75 explicit matrix_char( size_t const n1, size_t const n2 ) : owns_data(true){
76 if( n1 > 0 and n2 > 0 ) ccgsl_pointer = gsl_matrix_char_alloc( n1, n2 );
77 else { ccgsl_pointer = new gsl_matrix_char; ccgsl_pointer->size1 = n1;
78 ccgsl_pointer->size2 = n2; ccgsl_pointer->data = 0; }
79 // just plausibly we could allocate matrix_char but not count
80 try { count = new size_t; } catch( std::bad_alloc& e ){
81 // try to tidy up before rethrowing
82 if( n1 > 0 and n2 > 0 ) gsl_matrix_char_free( ccgsl_pointer );
83 else delete ccgsl_pointer;
84 throw e;
85 }
86 *count = 1; // initially there is just one reference to ccgsl_pointer
87 }
93 explicit matrix_char( gsl_matrix_char* v ) : owns_data(true){
94 ccgsl_pointer = v;
95 // just plausibly we could fail to allocate count: no further action needed.
96 count = new size_t;
97 *count = 1; // initially there is just one reference to ccgsl_pointer
98 }
99#ifdef __GXX_EXPERIMENTAL_CXX0X__
104 matrix_char( std::initializer_list<std::initializer_list<char> > initializer_list ) : owns_data(true){
105 size_t const n1 = initializer_list.size();
106 size_t const n2 = initializer_list.begin()->size();
107 for( auto l : initializer_list ){
108 if( l.size() != n2 ){
109 gsl::exception e( "matrix_char rows have unequal sizes", __FILE__, __LINE__,
111 throw( e );
112 }
113 }
114 ccgsl_pointer = gsl_matrix_char_alloc( n1, n2 );
115 // just plausibly we could allocate matrix_char but not count
116 try { count = new size_t; } catch( std::bad_alloc& e ){
117 // try to tidy up before rethrowing
118 if( n1 > 0 and n2 > 0 ) gsl_matrix_char_free( ccgsl_pointer );
119 else delete ccgsl_pointer;
120 throw e;
121 }
122 *count = 1; // initially there is just one reference to ccgsl_pointer
123 // now copy
124 int r = 0;
125 for( auto row : initializer_list ){
126 size_t c = 0;
127 for( auto x : row ){ set( r, c, x ); ++c; }
128 ++r;
129 }
130 }
131#endif
132 // copy constructor
137 matrix_char( matrix_char const& v ) : owns_data(true),
139 if( count != 0 ) ++*count; // matrix_char is now shared.
140 }
141 // assignment operator
147 // first, possibly delete anything pointed to by this
148 if( count == 0 or --*count == 0 ){
149 if( ccgsl_pointer != 0 and ccgsl_pointer->size1 > 0 and ccgsl_pointer->size2 > 0 ) gsl_matrix_char_free( ccgsl_pointer );
150 else delete ccgsl_pointer;
151 delete count;
152 }
153 // Then copy
156 count = v.count;
157 if( count != 0 ) ++*count; // block_char is now shared.
158 return *this;
159 }
160 // clone()
167 matrix_char copy( get()->size1, get()->size2 );
168 // Now copy
169 gsl_matrix_char_memcpy( copy.get(), get() );
170 // return new object
171 return copy;
172 }
173 // destructor
178 if( count != 0 and --*count == 0 ){
179 // could have allocated null pointer
180 if( ccgsl_pointer != 0 and owns_data ){
181 if( ccgsl_pointer->size1 > 0 and ccgsl_pointer->size2 > 0 )
182 gsl_matrix_char_free( ccgsl_pointer );
183 else delete ccgsl_pointer; }
184 delete count;
185 }
186 }
187
188 // Allow possibility of assigning from gsl_matrix_char without sharing
197 void wrap_gsl_matrix_char_without_ownership( gsl_matrix_char* v ){
198 if( count != 0 and --*count == 0 ){
199 // could have allocated null pointer
200 if( ccgsl_pointer != 0 ){
201 if( ccgsl_pointer->size1 != 0 and ccgsl_pointer->size1 != 0 )
202 gsl_matrix_char_free( ccgsl_pointer );
203 else delete ccgsl_pointer; }
204 }
205 ccgsl_pointer = v;
206 if(0 == count) count = new size_t;
207 *count = 1;
208 owns_data = false; // should never be able to delete ccgsl_pointer
209 }
213 void reset(){ matrix_char().swap( *this ); }
214#ifdef __GXX_EXPERIMENTAL_CXX0X__
220 ccgsl_pointer( v.ccgsl_pointer ), count( nullptr ){
221 std::swap( count, v.count );
222 v.ccgsl_pointer = nullptr;
223 }
230 matrix_char( std::move( v ) ).swap( *this );
231 return *this;
232 }
233#endif
234 private:
238 struct vector_char_ptr : public vector_char {
248 vector_char& operator*(){ return *this; }
253 vector_char* operator->(){ return this; }
254 };
259 template<typename container,typename content,bool reverse_t> class iterator_base {
260 friend class vector_char;
261 public:
265 typedef std::bidirectional_iterator_tag iterator_category;
278 public:
279 // // operator*
285 // Always try to return something
286 static content something;
287 // First check that iterator is initialised.
288 if( v == 0 ){
289 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
290 return something;
291 } else if( v->ccgsl_pointer == 0 ){
292 gsl_error( "matrix_char not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
293 return something;
294 }
295 // Check that position make sense
296 if( position >= v->size1() ){
297 gsl_error( "trying to dereference end()", __FILE__, __LINE__, exception::GSL_EFAILED );
298 return something;
299 }
300 // position and v are valid: return data
301 return v->row( position );
302 }
303 // // operator->
309 // Always try to return something
310 static content something_base;
311 static vector_char_ptr something( something_base );
312 // First check that iterator is initialised.
313 if( v == 0 ){
314 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
315 return something;
316 } else if( v->ccgsl_pointer == 0 ){
317 gsl_error( "matrix_char not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
318 return something;
319 }
320 // Check that position make sense
321 if( position >= v->size1() ){
322 gsl_error( "trying to dereference end()", __FILE__, __LINE__, exception::GSL_EFAILED );
323 return something;
324 }
325 // position and v are valid: return data
326 vector_char_ptr ptr( v->row( position ) );
327#ifdef __GXX_EXPERIMENTAL_CXX0X__
328 return std::move( ptr );
329#else
330 return ptr;
331#endif
332 }
339 return this->v == i.v and this->position == i.position;
340 }
347 return not this->operator==( i );
348 }
349 protected:
354 void increment(){
355 // Only makes sense if v points to a matrix_char
356 if( v == 0 ){
357 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
358 return;
359 } else if( v->ccgsl_pointer == 0 ){
360 gsl_error( "matrix_char not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
361 return;
362 }
363 // increment position and check against size
364 if( reverse_t ){ if( position >= 0 ) --position; }
365 else { if( position < v->size1() ) ++position; }
366 }
371 void decrement(){
372 // Only makes sense if v points to a matrix_char
373 if( v == 0 ){
374 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
375 return;
376 } else if( v->ccgsl_pointer == 0 ){
377 gsl_error( "matrix_char not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
378 return;
379 }
380 // decrement position and check against size
381 if( reverse_t ){ if( position < v->size1() ) ++position; }
382 else { if( position >= 0 ) --position; }
383 }
387 iterator_base(){ v = 0; }
393 iterator_base( container* v, size_t position )
394 : v( v ), position( position ){}
398 container* v;
402 size_t position;
403 };
404 // Need to know about const_iterator_t
405 template<bool reverse_t> class const_iterator_t;
409 template<bool reverse_t> class iterator_t : public iterator_base<matrix_char,vector_char,reverse_t>{
410 public:
411 // // Refines output iterator
412 // // operator=
420 return *this;
421 }
422 // // Refines forward iterator
423 // // operator++ (both)
430 return *this;
431 }
437 // return value
440 return result;
441 }
442 // // Refines bidirectional iterator
443 // // operator-- (both)
450 return *this;
451 }
457 // return value
460 return result;
461 }
468 return this->v == i.v and this->position == i.position;
469 }
476 return not this->operator==( i );
477 }
482 protected:
483 friend class matrix_char;
484 // We need a constructor for matrix_char
492 };
496 template<bool reverse_t> class const_iterator_t
497 : public iterator_base<matrix_char const,vector_char const,reverse_t>{
498 public:
499 // // Refines output iterator
500 // // operator=
508 return *this;
509 }
510 // // Refines forward iterator
511 // // operator++ (both)
518 return *this;
519 }
525 // return value
528 return result;
529 }
530 // // Refines bidirectional iterator
531 // // operator-- (both)
538 return *this;
539 }
545 // return value
548 return result;
549 }
561 }
567 bool operator==( iterator_t<reverse_t> const& i ) const {
568 return this->v == i.v and this->position == i.position;
569 }
575 bool operator!=( iterator_t<reverse_t> const& i ) const {
576 return not this->operator==( i );
577 }
584 return this->v == i.v and this->position == i.position;
585 }
592 return not this->operator==( i );
593 }
594 protected:
595 // We need a constructor for matrix_char
596 friend class matrix_char;
603 : iterator_base<matrix_char const,vector_char const,reverse_t>( v, position ){}
604 };
605 public:
625 typedef size_t size_type;
626 // begin()
632 return iterator( this, 0 );
633 }
639 return const_iterator( this, 0 );
640 }
641 // end()
647 if( ccgsl_pointer == 0 ) return iterator( this, 0 );
648 return iterator( this, size1() );
649 }
655 if( ccgsl_pointer == 0 ) return const_iterator( this, 0 );
656 return const_iterator( this, size1() );
657 }
658 // rbegin()
664 if( ccgsl_pointer ==0 ) return reverse_iterator( this, 0 );
665 return reverse_iterator( this, size1() - 1 );
666 }
672 if( ccgsl_pointer == 0 ) return const_reverse_iterator( this, 0 );
673 return const_reverse_iterator( this, size1() - 1 );
674 }
675 // rend()
681 return reverse_iterator( this, -1 );
682 }
688 return const_reverse_iterator( this, -1 );
689 }
690 public:
691 // Sizes
696 size_t size1() const { return ccgsl_pointer == 0 ? 0 : ccgsl_pointer->size1; }
701 size_t size2() const { return ccgsl_pointer == 0 ? 0 : ccgsl_pointer->size2; }
709 char* data() {
710 if( ccgsl_pointer == 0 ) gsl_error( "null vector_char", __FILE__, __LINE__, GSL_EFAULT );
711#ifndef GSL_RANGE_CHECK_OFF
712 if( ccgsl_pointer->size2 != ccgsl_pointer->tda )
713 gsl_error( "matrix_char size2 and tda do not match", __FILE__, __LINE__, GSL_EBADLEN );
714#endif
715 return ccgsl_pointer->data; }
723 char const* data() const {
724 if( ccgsl_pointer == 0 ) gsl_error( "null vector_char", __FILE__, __LINE__, GSL_EFAULT );
725#ifndef GSL_RANGE_CHECK_OFF
726 if( ccgsl_pointer->size2 != ccgsl_pointer->tda )
727 gsl_error( "matrix_char size2 and tda do not match", __FILE__, __LINE__, GSL_EBADLEN );
728#endif
729 return ccgsl_pointer->data; }
735 void swap( matrix_char& m ){
736 std::swap( ccgsl_pointer, m.ccgsl_pointer );
737 std::swap( count, m.count );
738 }
745 void tricpy(CBLAS_UPLO_t Uplo, CBLAS_DIAG_t Diag, matrix_char const& src){
746 gsl_matrix_char_tricpy( Uplo, Diag, get(), src.get() );
747 }
754 void transpose_tricpy(CBLAS_UPLO_t Uplo, CBLAS_DIAG_t Diag, matrix_char const& src){
755 gsl_matrix_char_transpose_tricpy( Uplo, Diag, get(), src.get() );
756 }
757 // view operations
766 matrix_char submatrix( size_t const i, size_t const j, size_t const n1, size_t const n2 ){
767 gsl_matrix_char* m = static_cast<gsl_matrix_char*>( malloc( sizeof( gsl_matrix_char ) ) );
768 *m = gsl_matrix_char_submatrix( get(), i, j, n1, n2 ).matrix;
769 return matrix_char( m );
770 }
776 vector_char row( size_t const i ){
777 gsl_vector_char* w = static_cast<gsl_vector_char*>( malloc( sizeof( gsl_vector_char ) ) );
778 *w = gsl_matrix_char_row( get(), i ).vector;
779 return vector_char( w );
780 }
786 vector_char column( size_t const j ){
787 gsl_vector_char* w = static_cast<gsl_vector_char*>( malloc( sizeof( gsl_vector_char ) ) );
788 *w = gsl_matrix_char_column( get(), j ).vector;
789 return vector_char( w );
790 }
796 diagonal(){ gsl_vector_char* w = static_cast<gsl_vector_char*>( malloc( sizeof( gsl_vector_char ) ) );
797 *w = gsl_matrix_char_diagonal( get() ).vector;
798 return vector_char( w );
799 }
805 vector_char subdiagonal( size_t const k ){
806 gsl_vector_char* w = static_cast<gsl_vector_char*>( malloc( sizeof( gsl_vector_char ) ) );
807 *w = gsl_matrix_char_subdiagonal( get(), k ).vector;
808 return vector_char( w );
809 }
815 vector_char superdiagonal( size_t const k ){
816 gsl_vector_char* w = static_cast<gsl_vector_char*>( malloc( sizeof( gsl_vector_char ) ) );
817 *w = gsl_matrix_char_superdiagonal( get(), k ).vector;
818 return vector_char( w );
819 }
827 vector_char subrow( size_t const i, size_t const offset, size_t const n ){
828 gsl_vector_char* w = static_cast<gsl_vector_char*>( malloc( sizeof( gsl_vector_char ) ) );
829 *w = gsl_matrix_char_subrow( get(), i, offset, n ).vector;
830 return vector_char( w );
831 }
839 vector_char subcolumn( size_t const j, size_t const offset, size_t const n ){
840 gsl_vector_char* w = static_cast<gsl_vector_char*>( malloc( sizeof( gsl_vector_char ) ) );
841 *w = gsl_matrix_char_subcolumn( get(), j, offset, n ).vector;
842 return vector_char( w );
843 }
851 static matrix_char view_array( char* base, size_t const n1, size_t const n2 ){
852 gsl_matrix_char* m = static_cast<gsl_matrix_char*>( malloc( sizeof( gsl_matrix_char ) ) );
853 *m = gsl_matrix_char_view_array( base, n1, n2 ).matrix;
854 return matrix_char( m );
855 }
864 static matrix_char view_array_with_tda( char* base, size_t const n1, size_t const n2, size_t const tda ){
865 gsl_matrix_char* m = static_cast<gsl_matrix_char*>( malloc( sizeof( gsl_matrix_char ) ) );
866 *m = gsl_matrix_char_view_array_with_tda( base, n1, n2, tda ).matrix;
867 return matrix_char( m );
868 }
876 static matrix_char view_vector( vector_char& v, size_t const n1, size_t const n2 ){
877 gsl_matrix_char* m = static_cast<gsl_matrix_char*>( malloc( sizeof( gsl_matrix_char ) ) );
878 *m = gsl_matrix_char_view_vector( v.get(), n1, n2 ).matrix;
879 return matrix_char( m );
880 }
889 static matrix_char view_vector_with_tda( vector_char& v, size_t const n1, size_t const n2, size_t const tda ){
890 gsl_matrix_char* m = static_cast<gsl_matrix_char*>( malloc( sizeof( gsl_matrix_char ) ) );
891 *m = gsl_matrix_char_view_vector_with_tda( v.get(), n1, n2, tda ).matrix;
892 return matrix_char( m );
893 }
894 // const versions ...
903 matrix_char const const_submatrix( size_t const i, size_t const j, size_t const n1, size_t const n2 ) const {
904 gsl_matrix_char* m = static_cast<gsl_matrix_char*>( malloc( sizeof( gsl_matrix_char ) ) );
905 *m = gsl_matrix_char_const_submatrix( get(), i, j, n1, n2 ).matrix;
906 return matrix_char( m );
907 }
913 vector_char const const_row( size_t const i ) const {
914 gsl_vector_char* w = static_cast<gsl_vector_char*>( malloc( sizeof( gsl_vector_char ) ) );
915 *w = gsl_matrix_char_const_row( get(), i ).vector;
916 return vector_char( w );
917 }
923 vector_char const const_column( size_t const j ) const {
924 gsl_vector_char* w = static_cast<gsl_vector_char*>( malloc( sizeof( gsl_vector_char ) ) );
925 *w = gsl_matrix_char_const_column( get(), j ).vector;
926 return vector_char( w );
927 }
933 gsl_vector_char* w = static_cast<gsl_vector_char*>( malloc( sizeof( gsl_vector_char ) ) );
934 *w = gsl_matrix_char_const_diagonal( get() ).vector;
935 return vector_char( w );
936 }
942 vector_char const const_subdiagonal( size_t const k ) const {
943 gsl_vector_char* w = static_cast<gsl_vector_char*>( malloc( sizeof( gsl_vector_char ) ) );
944 *w = gsl_matrix_char_const_subdiagonal( get(), k ).vector;
945 return vector_char( w );
946 }
952 vector_char const const_superdiagonal( size_t const k ) const {
953 gsl_vector_char* w = static_cast<gsl_vector_char*>( malloc( sizeof( gsl_vector_char ) ) );
954 *w = gsl_matrix_char_const_superdiagonal( get(), k ).vector;
955 return vector_char( w );
956 }
964 vector_char const const_subrow( size_t const i, size_t const offset, size_t const n ) const {
965 gsl_vector_char* w = static_cast<gsl_vector_char*>( malloc( sizeof( gsl_vector_char ) ) );
966 *w = gsl_matrix_char_const_subrow( get(), i, offset, n ).vector;
967 return vector_char( w );
968 }
976 vector_char const const_subcolumn( size_t const j, size_t const offset, size_t const n ) const {
977 gsl_vector_char* w = static_cast<gsl_vector_char*>( malloc( sizeof( gsl_vector_char ) ) );
978 *w = gsl_matrix_char_const_subcolumn( get(), j, offset, n ).vector;
979 return vector_char( w );
980 }
989 matrix_char const submatrix( size_t const i, size_t const j, size_t const n1, size_t const n2 ) const {
990 gsl_matrix_char* m = static_cast<gsl_matrix_char*>( malloc( sizeof( gsl_matrix_char ) ) );
991 *m = gsl_matrix_char_const_submatrix( get(), i, j, n1, n2 ).matrix;
992 return matrix_char( m );
993 }
999 vector_char const row( size_t const i ) const {
1000 gsl_vector_char* w = static_cast<gsl_vector_char*>( malloc( sizeof( gsl_vector_char ) ) );
1001 *w = gsl_matrix_char_const_row( get(), i ).vector;
1002 return vector_char( w );
1003 }
1009 vector_char const column( size_t const j ) const {
1010 gsl_vector_char* w = static_cast<gsl_vector_char*>( malloc( sizeof( gsl_vector_char ) ) );
1011 *w = gsl_matrix_char_const_column( get(), j ).vector;
1012 return vector_char( w );
1013 }
1018 vector_char const diagonal() const {
1019 gsl_vector_char* w = static_cast<gsl_vector_char*>( malloc( sizeof( gsl_vector_char ) ) );
1020 *w = gsl_matrix_char_const_diagonal( get() ).vector;
1021 return vector_char( w );
1022 }
1028 vector_char const subdiagonal( size_t const k ) const {
1029 gsl_vector_char* w = static_cast<gsl_vector_char*>( malloc( sizeof( gsl_vector_char ) ) );
1030 *w = gsl_matrix_char_const_subdiagonal( get(), k ).vector;
1031 return vector_char( w );
1032 }
1038 vector_char const superdiagonal( size_t const k ) const {
1039 gsl_vector_char* w = static_cast<gsl_vector_char*>( malloc( sizeof( gsl_vector_char ) ) );
1040 *w = gsl_matrix_char_const_superdiagonal( get(), k ).vector;
1041 return vector_char( w );
1042 }
1050 vector_char const subrow( size_t const i, size_t const offset, size_t const n ) const {
1051 gsl_vector_char* w = static_cast<gsl_vector_char*>( malloc( sizeof( gsl_vector_char ) ) );
1052 *w = gsl_matrix_char_const_subrow( get(), i, offset, n ).vector;
1053 return vector_char( w );
1054 }
1062 vector_char const subcolumn( size_t const j, size_t const offset, size_t const n ) const {
1063 gsl_vector_char* w = static_cast<gsl_vector_char*>( malloc( sizeof( gsl_vector_char ) ) );
1064 *w = gsl_matrix_char_const_subcolumn( get(), j, offset, n ).vector;
1065 return vector_char( w );
1066 }
1074 static matrix_char const const_view_array( char const* base, size_t const n1, size_t const n2 ){
1075 gsl_matrix_char* m = static_cast<gsl_matrix_char*>( malloc( sizeof( gsl_matrix_char ) ) );
1076 *m = gsl_matrix_char_const_view_array( base, n1, n2 ).matrix;
1077 return matrix_char( m );
1078 }
1087 static matrix_char const
1088 const_view_array_with_tda( char const* base, size_t const n1, size_t const n2, size_t const tda ){
1089 gsl_matrix_char* m = static_cast<gsl_matrix_char*>( malloc( sizeof( gsl_matrix_char ) ) );
1090 *m = gsl_matrix_char_const_view_array_with_tda( base, n1, n2, tda ).matrix;
1091 return matrix_char( m );
1092 }
1100 static matrix_char const const_view_vector( vector_char const& v, size_t const n1, size_t const n2 ){
1101 gsl_matrix_char* m = static_cast<gsl_matrix_char*>( malloc( sizeof( gsl_matrix_char ) ) );
1102 *m = gsl_matrix_char_const_view_vector( v.get(), n1, n2 ).matrix;
1103 return matrix_char( m );
1104 }
1113 static matrix_char const
1114 const_view_vector_with_tda( vector_char const& v, size_t const n1, size_t const n2, size_t const tda ){
1115 gsl_matrix_char* m = static_cast<gsl_matrix_char*>( malloc( sizeof( gsl_matrix_char ) ) );
1116 *m = gsl_matrix_char_const_view_vector_with_tda( v.get(), n1, n2, tda ).matrix;
1117 return matrix_char( m );
1118 }
1126 static matrix_char const view_array( char const* base, size_t const n1, size_t const n2 ){
1127 gsl_matrix_char* m = static_cast<gsl_matrix_char*>( malloc( sizeof( gsl_matrix_char ) ) );
1128 *m = gsl_matrix_char_const_view_array( base, n1, n2 ).matrix;
1129 return matrix_char( m );
1130 }
1139 static matrix_char const
1140 view_array_with_tda( char const* base, size_t const n1, size_t const n2, size_t const tda ){
1141 gsl_matrix_char* m = static_cast<gsl_matrix_char*>( malloc( sizeof( gsl_matrix_char ) ) );
1142 *m = gsl_matrix_char_const_view_array_with_tda( base, n1, n2, tda ).matrix;
1143 return matrix_char( m );
1144 }
1152 static matrix_char const view_vector( vector_char const& v, size_t const n1, size_t const n2 ){
1153 gsl_matrix_char* m = static_cast<gsl_matrix_char*>( malloc( sizeof( gsl_matrix_char ) ) );
1154 *m = gsl_matrix_char_const_view_vector( v.get(), n1, n2 ).matrix;
1155 return matrix_char( m );
1156 }
1165 static matrix_char const
1166 view_vector_with_tda( vector_char const& v, size_t const n1, size_t const n2, size_t const tda ){
1167 gsl_matrix_char* m = static_cast<gsl_matrix_char*>( malloc( sizeof( gsl_matrix_char ) ) );
1168 *m = gsl_matrix_char_const_view_vector_with_tda( v.get(), n1, n2, tda ).matrix;
1169 return matrix_char( m );
1170 }
1171 private:
1179 gsl_matrix_char* ccgsl_pointer;
1183 size_t* count;
1184 public:
1185 // shared reference functions
1190 gsl_matrix_char* get(){ return ccgsl_pointer; }
1195 gsl_matrix_char const* get() const { return ccgsl_pointer; }
1201 bool unique() const { return count != 0 and *count == 1; }
1206 size_t use_count() const { return count == 0 ? 0 : *count; }
1212#ifdef __GXX_EXPERIMENTAL_CXX0X__
1213 explicit
1214#endif
1215 operator bool() const { return ccgsl_pointer != 0; }
1216 // GSL functions
1224 static matrix_char calloc( size_t const n1, size_t const n2 ){ return matrix_char( gsl_matrix_char_calloc( n1, n2 ) ); }
1228 void set_zero(){ gsl_matrix_char_set_zero( get() ); }
1233 void set_all( char x ){ gsl_matrix_char_set_all( get(), x ); }
1239 int memcpy( matrix_char const& src ){ return gsl_matrix_char_memcpy( get(), src.get() ); }
1244 char max() const { return gsl_matrix_char_max( get() ); }
1249 char min() const { return gsl_matrix_char_min( get() ); }
1255 void minmax( char* min_out, char* max_out ) const {
1256 gsl_matrix_char_minmax( get(), min_out, max_out ); }
1262 void minmax( char& min_out, char& max_out ) const {
1263 gsl_matrix_char_minmax( get(), &min_out, &max_out ); }
1269 int add( matrix_char const& b ){ return gsl_matrix_char_add( get(), b.get() ); }
1275 int sub( matrix_char const& b ){ return gsl_matrix_char_sub( get(), b.get() ); }
1281 int scale( char const x ){ return gsl_matrix_char_scale( get(), x ); }
1287 int add_constant( char const x ){ return gsl_matrix_char_add_constant( get(), x ); }
1292 int isnull() const { return gsl_matrix_char_isnull( get() ); }
1297 int ispos() const { return gsl_matrix_char_ispos( get() ); }
1302 int isneg() const { return gsl_matrix_char_isneg( get() ); }
1307 int isnonneg() const { return gsl_matrix_char_isnonneg( get() ); }
1314 char get( size_t const i, size_t const j ) const { return gsl_matrix_char_get( get(), i, j ); }
1321 void set( size_t const i, size_t const j, char x ){ gsl_matrix_char_set( get(), i, j, x ); }
1328 char* ptr( size_t const i, size_t const j ){ return gsl_matrix_char_ptr( get(), i, j ); }
1335 char const* const_ptr( size_t const i, size_t const j ) const {
1336 return gsl_matrix_char_const_ptr( get(), i, j ); }
1342 int fread( FILE* stream ){ return gsl_matrix_char_fread( stream, get() ); }
1348 int fwrite( FILE* stream ) const { return gsl_matrix_char_fwrite( stream, get() ); }
1354 int fscanf( FILE* stream ){ return gsl_matrix_char_fscanf( stream, get() ); }
1361 int fprintf( FILE* stream, char const* format ) const {
1362 return gsl_matrix_char_fprintf( stream, get(), format ); }
1371 matrix_char( block_char& b, size_t const offset, size_t const n1, size_t const n2, size_t const d2 ){
1372 ccgsl_pointer = gsl_matrix_char_alloc_from_block( b.get(), offset, n1, n2, d2 );
1373 // just plausibly we could allocate vector_char but not count
1374 try { count = new size_t; } catch( std::bad_alloc& e ){
1375 // try to tidy up before rethrowing
1376 gsl_matrix_char_free( ccgsl_pointer );
1377 throw e;
1378 }
1379 *count = 1; // initially there is just one reference to ccgsl_pointer
1380 }
1389 matrix_char( matrix_char& m, size_t const k1, size_t const k2, size_t const n1, size_t const n2 ){
1390 ccgsl_pointer = gsl_matrix_char_alloc_from_matrix( m.get(), k1, k2, n1, n2 );
1391 // just plausibly we could allocate matrix_char but not count
1392 try { count = new size_t; } catch( std::bad_alloc& e ){
1393 // try to tidy up before rethrowing
1394 gsl_matrix_char_free( ccgsl_pointer );
1395 throw e;
1396 }
1397 *count = 1; // initially there is just one reference to ccgsl_pointer
1398 }
1399 // More functions
1403 void set_identity(){ gsl_matrix_char_set_identity( get() ); }
1410 int swap_rows( size_t const i, size_t const j ){ return gsl_matrix_char_swap_rows( get(), i, j ); }
1417 int swap_columns( size_t const i, size_t const j ){
1418 return gsl_matrix_char_swap_columns( get(), i, j ); }
1425 int swap_rowcol( size_t const i, size_t const j ){ return gsl_matrix_char_swap_rowcol( get(), i, j ); }
1430 int transpose(){ return gsl_matrix_char_transpose( get() ); }
1437 return gsl_matrix_char_transpose_memcpy( get(), src.get() ); }
1438#ifndef DOXYGEN_SKIP
1444 void max_index( size_t* imax, size_t* jmax ) const {
1445 gsl_matrix_char_max_index( get(), imax, jmax ); }
1451 void min_index( size_t* imin, size_t* jmin ) const {
1452 gsl_matrix_char_min_index( get(), imin, jmin ); }
1460 void minmax_index( size_t* imin, size_t* jmin, size_t* imax, size_t* jmax ) const {
1461 gsl_matrix_char_minmax_index( get(), imin, jmin, imax, jmax ); }
1462#endif
1468 void max_index( size_t& imax, size_t& jmax ) const {
1469 gsl_matrix_char_max_index( get(), &imax, &jmax ); }
1475 void min_index( size_t& imin, size_t& jmin ) const {
1476 gsl_matrix_char_min_index( get(), &imin, &jmin ); }
1484 void minmax_index( size_t& imin, size_t& jmin, size_t& imax, size_t& jmax ) const {
1485 gsl_matrix_char_minmax_index( get(), &imin, &jmin, &imax, &jmax ); }
1491 int
1493 return gsl_matrix_char_mul_elements( get(), b.get() ); }
1501 return gsl_matrix_char_div_elements( get(), b.get() ); }
1506 char norm1() const {
1507 return gsl_matrix_char_norm1( get() ); }
1513 int scale_rows( vector_char const& x ){
1514 return gsl_matrix_char_scale_rows( get(), x.get() ); }
1521 return gsl_matrix_char_scale_columns( get(), x.get() ); }
1527 int add_diagonal( char const x ){
1528 return gsl_matrix_char_add_diagonal( get(), x ); }
1535 int get_row( vector_char& v, size_t const i ) const {
1536 return gsl_matrix_char_get_row( v.get(), get(), i ); }
1543 int get_col( vector_char& v, size_t const j ) const {
1544 return gsl_matrix_char_get_col( v.get(), get(), j ); }
1551 int set_row( size_t const i, vector_char const& v ){
1552 return gsl_matrix_char_set_row( get(), i, v.get() ); }
1559 int set_col( size_t const j, vector_char const& v ){
1560 return gsl_matrix_char_set_col( get(), j, v.get() ); }
1561 // Extra functions for []
1569 vector_char operator[]( size_t const i ){
1570 // First check that iterator is initialised.
1571 if( ccgsl_pointer == 0 ){
1572 gsl_error( "matrix_char is null", __FILE__, __LINE__, exception::GSL_EFAULT );
1573 return vector_char();
1574 }
1575#ifndef GSL_RANGE_CHECK_OFF
1576#ifndef __GXX_EXPERIMENTAL_CXX0X__
1577 static vector_char something;
1578#endif
1579 //Check that position make sense
1580 if( i >= size1() ){
1581 gsl_error( "trying to read beyond last row of matrix_char",
1582 __FILE__, __LINE__, exception::GSL_EINVAL );
1583#ifdef __GXX_EXPERIMENTAL_CXX0X__
1584 return vector_char();
1585#else
1586 return something;
1587#endif
1588 }
1589 // n is a valid position
1590#endif
1591 vector_char v(0);
1592 gsl_vector_char_view w = gsl_matrix_char_row( ccgsl_pointer, i );
1594 return v;
1595 }
1603 vector_char const operator[]( size_t const i ) const {
1604 // First check that iterator is initialised.
1605 if( ccgsl_pointer == 0 ){
1606 gsl_error( "matrix_char is null", __FILE__, __LINE__, exception::GSL_EFAULT );
1607 return vector_char();
1608 }
1609 vector_char v(0);
1610 gsl_vector_char_view w = gsl_matrix_char_row( ccgsl_pointer, i );
1612 return v;
1613 }
1619 inline int
1621 return gsl_permute_matrix_char( p.get(), get() ); }
1622 };
1623
1624 // Extra functions for vector_char allocation from matrix_char objects
1626 inline vector_char vector_char::alloc_row_from_matrix( matrix_char& m, size_t const i ){
1627 return vector_char ( gsl_vector_char_alloc_row_from_matrix( m.get(), i ) ); }
1628 inline vector_char vector_char::alloc_col_from_matrix( matrix_char& m, size_t const i ){
1629 return vector_char ( gsl_vector_char_alloc_col_from_matrix( m.get(), i ) ); }
1631}
1632#endif
This class handles vector_chars as shared handles.
Definition: block_char.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.
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.
const_iterator_t(matrix_char const *v, size_t position)
This constructor allows vector_char to create non-default iterators.
const_iterator_t< reverse_t > & operator=(const_iterator_t< reverse_t > const &i)
We can assign one output iterator from another.
bool operator!=(iterator_t< reverse_t > const &i) const
Comparison with non-const iterator.
const_iterator_t< reverse_t > operator++(int)
The postfix ++ operator.
const_iterator_t< reverse_t > operator--(int)
The postfix – 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(iterator_t< reverse_t > const &i)
A copy constructor.
const_iterator_t< reverse_t > & operator++()
The prefix ++ operator.
We create a suitable class for iterator types here.
vector_char_ptr pointer
An iterator must have a pointer typea.
pointer operator->() const
Dereference the pointer.
bool operator!=(iterator_base< container, content, reverse_t > const &i) const
The != operator.
std::bidirectional_iterator_tag iterator_category
An iterator must have an iterator category.
iterator_base()
The iterator is default constructible.
value_type reference
An iterator must have a reference type.
vector_char value_type
An iterator must have a value type.
container * v
Store a pointer to a matrix_char we can iterate over: 0 if no matrix_char.
iterator_base(container *v, size_t position)
This constructor allows vector_char to create non-default iterators.
bool operator==(iterator_base< container, content, reverse_t > const &i) const
The == operator.
size_t position
Mark position of iterator within matrix_char.
reference operator*() const
Dereference the pointer.
void increment()
Increment the iterator.
void decrement()
Decrement the iterator.
A class template for the two non-const iterators.
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< reverse_t > operator++(int)
The postfix ++ operator.
iterator_t(matrix_char *v, size_t position)
This constructor allows vector_char to create non-default iterators.
bool operator==(const_iterator_t< reverse_t > const &i) const
Comparison with const iterator.
iterator_t< reverse_t > & operator++()
The prefix ++ operator.
iterator_t< reverse_t > operator--(int)
The postfix – operator.
iterator_t< reverse_t > & operator--()
The prefix – operator.
bool operator!=(const_iterator_t< reverse_t > const &i) const
Comparison with const iterator.
This class handles matrix_char objects as shared handles.
Definition: matrix_char.hpp:58
int set_row(size_t const i, vector_char const &v)
C++ version of gsl_matrix_char_set_row().
matrix_char 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_char_const_submatrix().
int scale_columns(vector_char const &x)
C++ version of gsl_matrix_char_scale_columns().
const_iterator_t< false > const_iterator
The const_iterator type.
matrix_char clone() const
The clone function.
vector_char row(size_t const i)
C++ version of gsl_matrix_char_row().
vector_char column(size_t const j)
C++ version of gsl_matrix_char_column().
int sub(matrix_char const &b)
C++ version of gsl_matrix_char_sub().
char max() const
C++ version of gsl_matrix_char_max().
matrix_char(size_t const n1, size_t const n2)
This constructor creates a new matrix_char with n1 rows and n2 columns.
Definition: matrix_char.hpp:75
int isnull() const
C++ version of gsl_matrix_char_isnull().
const_reverse_iterator rend() const
Get iterator pointing beyond last vector_char element.
static matrix_char calloc(size_t const n1, size_t const n2)
C++ version of gsl_matrix_char_calloc().
const_iterator end() const
Get iterator pointing beyond last vector_char element.
void max_index(size_t &imax, size_t &jmax) const
C++ version of gsl_matrix_char_max_index().
vector_char const subcolumn(size_t const j, size_t const offset, size_t const n) const
Another C++ version of gsl_matrix_char_const_subcolumn().
bool owns_data
Used to allow a vector that does not own its data.
void set(size_t const i, size_t const j, char x)
C++ version of gsl_matrix_char_set().
int get_row(vector_char &v, size_t const i) const
C++ version of gsl_matrix_char_get_row().
gsl_matrix_char const * get() const
Get the gsl_matrix_char.
vector_char const const_subcolumn(size_t const j, size_t const offset, size_t const n) const
C++ version of gsl_matrix_char_const_subcolumn().
int swap_columns(size_t const i, size_t const j)
C++ version of gsl_matrix_char_swap_columns().
static matrix_char view_array(char *base, size_t const n1, size_t const n2)
C++ version of gsl_matrix_char_view_array().
int isneg() const
C++ version of gsl_matrix_char_isneg().
matrix_char(gsl_matrix_char *v)
Could construct from a gsl_matrix_char.
Definition: matrix_char.hpp:93
matrix_char()
The default constructor is only really useful for assigning to.
Definition: matrix_char.hpp:63
matrix_char(matrix_char &&v)
Move constructor.
int add_constant(char const x)
C++ version of gsl_matrix_char_add_constant().
int memcpy(matrix_char const &src)
C++ version of gsl_matrix_char_memcpy().
reverse_iterator rbegin()
Get iterator pointing to first vector_char element.
int add(matrix_char const &b)
C++ version of gsl_matrix_char_add().
bool unique() const
Find if this is the only object sharing the gsl_matrix_char.
void min_index(size_t &imin, size_t &jmin) const
C++ version of gsl_matrix_char_min_index().
vector_char const row(size_t const i) const
Another C++ version of gsl_matrix_char_const_row().
const_iterator begin() const
Get iterator pointing to first vector_char element.
void reset()
Stop sharing ownership of the shared pointer.
static matrix_char const const_view_array_with_tda(char const *base, size_t const n1, size_t const n2, size_t const tda)
C++ version of gsl_matrix_char_const_view_array_with_tda().
matrix_char(std::initializer_list< std::initializer_list< char > > initializer_list)
Could construct from a std::initializer_list in C++11.
size_t use_count() const
Find how many matrix_char objects share this pointer.
void minmax_index(size_t &imin, size_t &jmin, size_t &imax, size_t &jmax) const
C++ version of gsl_matrix_char_minmax_index().
static matrix_char const const_view_vector_with_tda(vector_char const &v, size_t const n1, size_t const n2, size_t const tda)
C++ version of gsl_matrix_char_const_view_vector_with_tda().
static matrix_char const view_array_with_tda(char const *base, size_t const n1, size_t const n2, size_t const tda)
Another C++ version of gsl_matrix_char_const_view_array_with_tda().
reverse_iterator rend()
Get iterator pointing beyond last vector_char element.
char const * const_ptr(size_t const i, size_t const j) const
C++ version of gsl_matrix_char_const_ptr().
vector_char const subdiagonal(size_t const k) const
Another C++ version of gsl_matrix_char_const_subdiagonal().
const_iterator_t< true > const_reverse_iterator
The const_reverse_t type.
iterator_t< true > reverse_iterator
The reverse_iterator type.
char * data()
Give access to the data block_char.
char get(size_t const i, size_t const j) const
C++ version of gsl_matrix_char_get().
size_t size2() const
The number of columns of the matrix_char.
vector_char const const_subrow(size_t const i, size_t const offset, size_t const n) const
C++ version of gsl_matrix_char_const_subrow().
void minmax(char *min_out, char *max_out) const
C++ version of gsl_matrix_char_minmax().
static matrix_char const const_view_array(char const *base, size_t const n1, size_t const n2)
C++ version of gsl_matrix_char_const_view_array().
int add_diagonal(char const x)
C++ version of gsl_matrix_char_add_diagonal().
vector_char const const_diagonal() const
C++ version of gsl_matrix_char_const_diagonal().
vector_char const const_column(size_t const j) const
C++ version of gsl_matrix_char_const_column().
void set_identity()
C++ version of gsl_matrix_char_set_identity().
vector_char subcolumn(size_t const j, size_t const offset, size_t const n)
C++ version of gsl_matrix_char_subcolumn().
matrix_char 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_char_const_submatrix().
size_t * count
The shared reference count.
void transpose_tricpy(CBLAS_UPLO_t Uplo, CBLAS_DIAG_t Diag, matrix_char const &src)
Copy the upper or lower triangular part of matrix src to this.
int permute(permutation &p)
Permute the columns of this by permutation p.
vector_char const const_row(size_t const i) const
C++ version of gsl_matrix_char_const_row().
int fscanf(FILE *stream)
C++ version of gsl_matrix_char_fscanf().
gsl_matrix_char * get()
Get the gsl_matrix_char.
vector_char diagonal()
C++ version of gsl_matrix_char_diagonal().
iterator end()
Get iterator pointing beyond last vector_char element.
matrix_char submatrix(size_t const i, size_t const j, size_t const n1, size_t const n2)
C++ version of gsl_matrix_char_submatrix().
int swap_rowcol(size_t const i, size_t const j)
C++ version of gsl_matrix_char_swap_rowcol().
int div_elements(matrix_char const &b)
C++ version of gsl_matrix_char_div_elements().
vector_char const diagonal() const
Another C++ version of gsl_matrix_char_const_diagonal().
void tricpy(CBLAS_UPLO_t Uplo, CBLAS_DIAG_t Diag, matrix_char const &src)
Copy the upper or lower triangular part of matrix src to this.
const_reverse_iterator rbegin() const
Get iterator pointing to first vector_char element.
vector_char subdiagonal(size_t const k)
C++ version of gsl_matrix_char_subdiagonal().
char min() const
C++ version of gsl_matrix_char_min().
int transpose_memcpy(matrix_char const &src)
C++ version of gsl_matrix_char_transpose_memcpy().
vector_char const subrow(size_t const i, size_t const offset, size_t const n) const
Another C++ version of gsl_matrix_char_const_subrow().
gsl_matrix_char * ccgsl_pointer
The shared pointer.
int get_col(vector_char &v, size_t const j) const
C++ version of gsl_matrix_char_get_col().
int transpose()
C++ version of gsl_matrix_char_transpose().
static matrix_char view_vector_with_tda(vector_char &v, size_t const n1, size_t const n2, size_t const tda)
C++ version of gsl_matrix_char_view_vector_with_tda().
matrix_char(block_char &b, size_t const offset, size_t const n1, size_t const n2, size_t const d2)
C++ version of gsl_matrix_char_alloc_from_block().
size_t size1() const
The number of rows of the matrix_char.
int set_col(size_t const j, vector_char const &v)
C++ version of gsl_matrix_char_set_col().
matrix_char & operator=(matrix_char const &v)
The assignment operator.
void swap(matrix_char &m)
Swap two matrix_char objects.
int swap_rows(size_t const i, size_t const j)
C++ version of gsl_matrix_char_swap_rows().
char norm1() const
C++ version of gsl_matrix_char_norm1().
size_t size_type
A container must have a size_type.
vector_char const column(size_t const j) const
Another C++ version of gsl_matrix_char_const_column().
vector_char subrow(size_t const i, size_t const offset, size_t const n)
C++ version of gsl_matrix_char_subrow().
static matrix_char view_array_with_tda(char *base, size_t const n1, size_t const n2, size_t const tda)
C++ version of gsl_matrix_char_view_array_with_tda().
vector_char operator[](size_t const i)
This function allows us to use a matrix_char like an array.
int fprintf(FILE *stream, char const *format) const
C++ version of gsl_matrix_char_fprintf().
iterator_t< false > iterator
The iterator type.
char * ptr(size_t const i, size_t const j)
C++ version of gsl_matrix_char_ptr().
static matrix_char const view_vector_with_tda(vector_char const &v, size_t const n1, size_t const n2, size_t const tda)
Another C++ version of gsl_matrix_char_const_view_vector_with_tda().
int scale_rows(vector_char const &x)
C++ version of gsl_matrix_char_scale_rows().
vector_char const const_superdiagonal(size_t const k) const
C++ version of gsl_matrix_char_const_superdiagonal().
int fread(FILE *stream)
C++ version of gsl_matrix_char_fread().
int mul_elements(matrix_char const &b)
C++ version of gsl_matrix_char_mul_elements().
matrix_char(matrix_char const &v)
The copy constructor.
void wrap_gsl_matrix_char_without_ownership(gsl_matrix_char *v)
This function is intended mainly for internal use.
void minmax(char &min_out, char &max_out) const
C++ version of gsl_matrix_char_minmax().
iterator begin()
Get iterator pointing to first vector_char element.
char const * data() const
Give access to the data block_char.
int isnonneg() const
C++ version of gsl_matrix_char_isnonneg().
~matrix_char()
The destructor only deletes the pointers if count reaches zero.
vector_char superdiagonal(size_t const k)
C++ version of gsl_matrix_char_superdiagonal().
vector_char const const_subdiagonal(size_t const k) const
C++ version of gsl_matrix_char_const_subdiagonal().
static matrix_char const view_array(char const *base, size_t const n1, size_t const n2)
Another C++ version of gsl_matrix_char_const_view_array().
matrix_char & operator=(matrix_char &&v)
Move operator.
static matrix_char const const_view_vector(vector_char const &v, size_t const n1, size_t const n2)
C++ version of gsl_matrix_char_const_view_vector().
void set_all(char x)
C++ version of gsl_matrix_char_set_all().
vector_char const operator[](size_t const i) const
This function allows us to use a matrix_char like an array.
static matrix_char view_vector(vector_char &v, size_t const n1, size_t const n2)
C++ version of gsl_matrix_char_view_vector().
int fwrite(FILE *stream) const
C++ version of gsl_matrix_char_fwrite().
matrix_char(matrix_char &m, size_t const k1, size_t const k2, size_t const n1, size_t const n2)
C++ version of gsl_matrix_char_alloc_from_matrix().
static matrix_char const view_vector(vector_char const &v, size_t const n1, size_t const n2)
Another C++ version of gsl_matrix_char_const_view_vector().
int scale(char const x)
C++ version of gsl_matrix_char_scale().
vector_char const superdiagonal(size_t const k) const
Another C++ version of gsl_matrix_char_const_superdiagonal().
int ispos() const
C++ version of gsl_matrix_char_ispos().
void set_zero()
C++ version of gsl_matrix_char_set_zero().
This class handles GSL permutation objects.
Definition: permutation.hpp:33
gsl_permutation * get()
Get the gsl_permutation.
This class handles vector_char objects as shared handles.
Definition: vector_char.hpp:45
gsl_vector_char * get()
Get the gsl_vector_char.
static vector_char alloc_row_from_matrix(matrix_char &m, size_t const i)
C++ version of gsl_vector_char_alloc_row_from_matrix().
static vector_char alloc_col_from_matrix(matrix_char &m, size_t const j)
C++ version of gsl_vector_char_alloc_col_from_matrix().
vector_char()
The default constructor is only really useful for assigning to.
Definition: vector_char.hpp:50
void wrap_gsl_vector_char_without_ownership(gsl_vector_char *v)
This function is intended mainly for internal use.
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_char & operator*()
Dereference operator.
vector_char_ptr(vector_char const &v)
Typically we have to construct from a vector_char.
vector_char * operator->()
Dereference operator.