ccgsl 2.7.2
C++wrappersforGnuScientificLibrary
matrix_ushort.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_USHORT_HPP
20#define CCGSL_MATRIX_USHORT_HPP
21
22#include<gsl/gsl_matrix.h>
23#include<new>
24#include<gsl/gsl_permute_matrix_ushort.h>
25
26#include"exception.hpp"
27#include"vector_ushort.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_ushort( size_t const n1, size_t const n2 ) : owns_data(true){
75 if( n1 > 0 and n2 > 0 ) ccgsl_pointer = gsl_matrix_ushort_alloc( n1, n2 );
76 else { ccgsl_pointer = new gsl_matrix_ushort; ccgsl_pointer->size1 = n1;
77 ccgsl_pointer->size2 = n2; ccgsl_pointer->data = 0; }
78 // just plausibly we could allocate matrix_ushort 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_ushort_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_ushort( gsl_matrix_ushort* 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_ushort( std::initializer_list<std::initializer_list<unsigned short> > 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_ushort rows have unequal sizes", __FILE__, __LINE__,
110 throw( e );
111 }
112 }
113 ccgsl_pointer = gsl_matrix_ushort_alloc( n1, n2 );
114 // just plausibly we could allocate matrix_ushort 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_ushort_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_ushort 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_ushort_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_ushort is now shared.
157 return *this;
158 }
159 // clone()
166 matrix_ushort copy( get()->size1, get()->size2 );
167 // Now copy
168 gsl_matrix_ushort_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_ushort_free( ccgsl_pointer );
182 else delete ccgsl_pointer; }
183 delete count;
184 }
185 }
186
187 // Allow possibility of assigning from gsl_matrix_ushort without sharing
196 void wrap_gsl_matrix_ushort_without_ownership( gsl_matrix_ushort* 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_ushort_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_ushort().swap( *this ); }
213#ifdef __GXX_EXPERIMENTAL_CXX0X__
219 std::swap( count, v.count );
220 v.ccgsl_pointer = nullptr;
221 }
228 matrix_ushort( std::move( v ) ).swap( *this );
229 return *this;
230 }
231#endif
232 private:
246 vector_ushort& operator*(){ return *this; }
251 vector_ushort* operator->(){ return this; }
252 };
257 template<typename container,typename content,bool reverse_t> class iterator_base {
258 friend class vector_ushort;
259 public:
263 typedef std::bidirectional_iterator_tag iterator_category;
276 public:
277 // // operator*
283 // Always try to return something
284 static content something;
285 // First check that iterator is initialised.
286 if( v == 0 ){
287 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
288 return something;
289 } else if( v->ccgsl_pointer == 0 ){
290 gsl_error( "matrix_ushort not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
291 return something;
292 }
293 // Check that position make sense
294 if( position >= v->size1() ){
295 gsl_error( "trying to dereference end()", __FILE__, __LINE__, exception::GSL_EFAILED );
296 return something;
297 }
298 // position and v are valid: return data
299 return v->row( position );
300 }
301 // // operator->
307 // Always try to return something
308 static content something_base;
309 static vector_ushort_ptr something( something_base );
310 // First check that iterator is initialised.
311 if( v == 0 ){
312 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
313 return something;
314 } else if( v->ccgsl_pointer == 0 ){
315 gsl_error( "matrix_ushort not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
316 return something;
317 }
318 // Check that position make sense
319 if( position >= v->size1() ){
320 gsl_error( "trying to dereference end()", __FILE__, __LINE__, exception::GSL_EFAILED );
321 return something;
322 }
323 // position and v are valid: return data
324 vector_ushort_ptr ptr( v->row( position ) );
325#ifdef __GXX_EXPERIMENTAL_CXX0X__
326 return std::move( ptr );
327#else
328 return ptr;
329#endif
330 }
337 return this->v == i.v and this->position == i.position;
338 }
345 return not this->operator==( i );
346 }
347 protected:
352 void increment(){
353 // Only makes sense if v points to a matrix_ushort
354 if( v == 0 ){
355 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
356 return;
357 } else if( v->ccgsl_pointer == 0 ){
358 gsl_error( "matrix_ushort not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
359 return;
360 }
361 // increment position and check against size
362 if( reverse_t ){ if( position >= 0 ) --position; }
363 else { if( position < v->size1() ) ++position; }
364 }
369 void decrement(){
370 // Only makes sense if v points to a matrix_ushort
371 if( v == 0 ){
372 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
373 return;
374 } else if( v->ccgsl_pointer == 0 ){
375 gsl_error( "matrix_ushort not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
376 return;
377 }
378 // decrement position and check against size
379 if( reverse_t ){ if( position < v->size1() ) ++position; }
380 else { if( position >= 0 ) --position; }
381 }
385 iterator_base(){ v = 0; }
391 iterator_base( container* v, size_t position )
392 : v( v ), position( position ){}
396 container* v;
400 size_t position;
401 };
402 // Need to know about const_iterator_t
403 template<bool reverse_t> class const_iterator_t;
407 template<bool reverse_t> class iterator_t : public iterator_base<matrix_ushort,vector_ushort,reverse_t>{
408 public:
409 // // Refines output iterator
410 // // operator=
418 return *this;
419 }
420 // // Refines forward iterator
421 // // operator++ (both)
428 return *this;
429 }
435 // return value
438 return result;
439 }
440 // // Refines bidirectional iterator
441 // // operator-- (both)
448 return *this;
449 }
455 // return value
458 return result;
459 }
466 return this->v == i.v and this->position == i.position;
467 }
474 return not this->operator==( i );
475 }
480 protected:
481 friend class matrix_ushort;
482 // We need a constructor for matrix_ushort
490 };
494 template<bool reverse_t> class const_iterator_t
495 : public iterator_base<matrix_ushort const,vector_ushort const,reverse_t>{
496 public:
497 // // Refines output iterator
498 // // operator=
506 return *this;
507 }
508 // // Refines forward iterator
509 // // operator++ (both)
516 return *this;
517 }
523 // return value
526 return result;
527 }
528 // // Refines bidirectional iterator
529 // // operator-- (both)
536 return *this;
537 }
543 // return value
546 return result;
547 }
559 }
565 bool operator==( iterator_t<reverse_t> const& i ) const {
566 return this->v == i.v and this->position == i.position;
567 }
573 bool operator!=( iterator_t<reverse_t> const& i ) const {
574 return not this->operator==( i );
575 }
582 return this->v == i.v and this->position == i.position;
583 }
590 return not this->operator==( i );
591 }
592 protected:
593 // We need a constructor for matrix_ushort
594 friend class matrix_ushort;
601 : iterator_base<matrix_ushort const,vector_ushort const,reverse_t>( v, position ){}
602 };
603 public:
623 typedef size_t size_type;
624 // begin()
630 return iterator( this, 0 );
631 }
637 return const_iterator( this, 0 );
638 }
639 // end()
645 if( ccgsl_pointer == 0 ) return iterator( this, 0 );
646 return iterator( this, size1() );
647 }
653 if( ccgsl_pointer == 0 ) return const_iterator( this, 0 );
654 return const_iterator( this, size1() );
655 }
656 // rbegin()
662 if( ccgsl_pointer ==0 ) return reverse_iterator( this, 0 );
663 return reverse_iterator( this, size1() - 1 );
664 }
670 if( ccgsl_pointer == 0 ) return const_reverse_iterator( this, 0 );
671 return const_reverse_iterator( this, size1() - 1 );
672 }
673 // rend()
679 return reverse_iterator( this, -1 );
680 }
686 return const_reverse_iterator( this, -1 );
687 }
688 public:
689 // Sizes
694 size_t size1() const { return ccgsl_pointer == 0 ? 0 : ccgsl_pointer->size1; }
699 size_t size2() const { return ccgsl_pointer == 0 ? 0 : ccgsl_pointer->size2; }
707 unsigned short* data() {
708 if( ccgsl_pointer == 0 ) gsl_error( "null vector_ushort", __FILE__, __LINE__, GSL_EFAULT );
709#ifndef GSL_RANGE_CHECK_OFF
710 if( ccgsl_pointer->size2 != ccgsl_pointer->tda )
711 gsl_error( "matrix_ushort size2 and tda do not match", __FILE__, __LINE__, GSL_EBADLEN );
712#endif
713 return ccgsl_pointer->data; }
721 unsigned short const* data() const {
722 if( ccgsl_pointer == 0 ) gsl_error( "null vector_ushort", __FILE__, __LINE__, GSL_EFAULT );
723#ifndef GSL_RANGE_CHECK_OFF
724 if( ccgsl_pointer->size2 != ccgsl_pointer->tda )
725 gsl_error( "matrix_ushort size2 and tda do not match", __FILE__, __LINE__, GSL_EBADLEN );
726#endif
727 return ccgsl_pointer->data; }
733 void swap( matrix_ushort& m ){
734 std::swap( ccgsl_pointer, m.ccgsl_pointer );
735 std::swap( count, m.count );
736 }
743 void tricpy(CBLAS_UPLO_t Uplo, CBLAS_DIAG_t Diag, matrix_ushort const& src){
744 gsl_matrix_ushort_tricpy( Uplo, Diag, get(), src.get() );
745 }
752 void transpose_tricpy(CBLAS_UPLO_t Uplo, CBLAS_DIAG_t Diag, matrix_ushort const& src){
753 gsl_matrix_ushort_transpose_tricpy( Uplo, Diag, get(), src.get() );
754 }
755 // view operations
764 matrix_ushort submatrix( size_t const i, size_t const j, size_t const n1, size_t const n2 ){
765 gsl_matrix_ushort* m = static_cast<gsl_matrix_ushort*>( malloc( sizeof( gsl_matrix_ushort ) ) );
766 *m = gsl_matrix_ushort_submatrix( get(), i, j, n1, n2 ).matrix;
767 return matrix_ushort( m );
768 }
774 vector_ushort row( size_t const i ){
775 gsl_vector_ushort* w = static_cast<gsl_vector_ushort*>( malloc( sizeof( gsl_vector_ushort ) ) );
776 *w = gsl_matrix_ushort_row( get(), i ).vector;
777 return vector_ushort( w );
778 }
784 vector_ushort column( size_t const j ){
785 gsl_vector_ushort* w = static_cast<gsl_vector_ushort*>( malloc( sizeof( gsl_vector_ushort ) ) );
786 *w = gsl_matrix_ushort_column( get(), j ).vector;
787 return vector_ushort( w );
788 }
794 diagonal(){ gsl_vector_ushort* w = static_cast<gsl_vector_ushort*>( malloc( sizeof( gsl_vector_ushort ) ) );
795 *w = gsl_matrix_ushort_diagonal( get() ).vector;
796 return vector_ushort( w );
797 }
803 vector_ushort subdiagonal( size_t const k ){
804 gsl_vector_ushort* w = static_cast<gsl_vector_ushort*>( malloc( sizeof( gsl_vector_ushort ) ) );
805 *w = gsl_matrix_ushort_subdiagonal( get(), k ).vector;
806 return vector_ushort( w );
807 }
813 vector_ushort superdiagonal( size_t const k ){
814 gsl_vector_ushort* w = static_cast<gsl_vector_ushort*>( malloc( sizeof( gsl_vector_ushort ) ) );
815 *w = gsl_matrix_ushort_superdiagonal( get(), k ).vector;
816 return vector_ushort( w );
817 }
825 vector_ushort subrow( size_t const i, size_t const offset, size_t const n ){
826 gsl_vector_ushort* w = static_cast<gsl_vector_ushort*>( malloc( sizeof( gsl_vector_ushort ) ) );
827 *w = gsl_matrix_ushort_subrow( get(), i, offset, n ).vector;
828 return vector_ushort( w );
829 }
837 vector_ushort subcolumn( size_t const j, size_t const offset, size_t const n ){
838 gsl_vector_ushort* w = static_cast<gsl_vector_ushort*>( malloc( sizeof( gsl_vector_ushort ) ) );
839 *w = gsl_matrix_ushort_subcolumn( get(), j, offset, n ).vector;
840 return vector_ushort( w );
841 }
849 static matrix_ushort view_array( unsigned short* base, size_t const n1, size_t const n2 ){
850 gsl_matrix_ushort* m = static_cast<gsl_matrix_ushort*>( malloc( sizeof( gsl_matrix_ushort ) ) );
851 *m = gsl_matrix_ushort_view_array( base, n1, n2 ).matrix;
852 return matrix_ushort( m );
853 }
862 static matrix_ushort view_array_with_tda( unsigned short* base, size_t const n1, size_t const n2, size_t const tda ){
863 gsl_matrix_ushort* m = static_cast<gsl_matrix_ushort*>( malloc( sizeof( gsl_matrix_ushort ) ) );
864 *m = gsl_matrix_ushort_view_array_with_tda( base, n1, n2, tda ).matrix;
865 return matrix_ushort( m );
866 }
874 static matrix_ushort view_vector( vector_ushort& v, size_t const n1, size_t const n2 ){
875 gsl_matrix_ushort* m = static_cast<gsl_matrix_ushort*>( malloc( sizeof( gsl_matrix_ushort ) ) );
876 *m = gsl_matrix_ushort_view_vector( v.get(), n1, n2 ).matrix;
877 return matrix_ushort( m );
878 }
887 static matrix_ushort view_vector_with_tda( vector_ushort& v, size_t const n1, size_t const n2, size_t const tda ){
888 gsl_matrix_ushort* m = static_cast<gsl_matrix_ushort*>( malloc( sizeof( gsl_matrix_ushort ) ) );
889 *m = gsl_matrix_ushort_view_vector_with_tda( v.get(), n1, n2, tda ).matrix;
890 return matrix_ushort( m );
891 }
892 // const versions ...
901 matrix_ushort const const_submatrix( size_t const i, size_t const j, size_t const n1, size_t const n2 ) const {
902 gsl_matrix_ushort* m = static_cast<gsl_matrix_ushort*>( malloc( sizeof( gsl_matrix_ushort ) ) );
903 *m = gsl_matrix_ushort_const_submatrix( get(), i, j, n1, n2 ).matrix;
904 return matrix_ushort( m );
905 }
911 vector_ushort const const_row( size_t const i ) const {
912 gsl_vector_ushort* w = static_cast<gsl_vector_ushort*>( malloc( sizeof( gsl_vector_ushort ) ) );
913 *w = gsl_matrix_ushort_const_row( get(), i ).vector;
914 return vector_ushort( w );
915 }
921 vector_ushort const const_column( size_t const j ) const {
922 gsl_vector_ushort* w = static_cast<gsl_vector_ushort*>( malloc( sizeof( gsl_vector_ushort ) ) );
923 *w = gsl_matrix_ushort_const_column( get(), j ).vector;
924 return vector_ushort( w );
925 }
931 gsl_vector_ushort* w = static_cast<gsl_vector_ushort*>( malloc( sizeof( gsl_vector_ushort ) ) );
932 *w = gsl_matrix_ushort_const_diagonal( get() ).vector;
933 return vector_ushort( w );
934 }
940 vector_ushort const const_subdiagonal( size_t const k ) const {
941 gsl_vector_ushort* w = static_cast<gsl_vector_ushort*>( malloc( sizeof( gsl_vector_ushort ) ) );
942 *w = gsl_matrix_ushort_const_subdiagonal( get(), k ).vector;
943 return vector_ushort( w );
944 }
950 vector_ushort const const_superdiagonal( size_t const k ) const {
951 gsl_vector_ushort* w = static_cast<gsl_vector_ushort*>( malloc( sizeof( gsl_vector_ushort ) ) );
952 *w = gsl_matrix_ushort_const_superdiagonal( get(), k ).vector;
953 return vector_ushort( w );
954 }
962 vector_ushort const const_subrow( size_t const i, size_t const offset, size_t const n ) const {
963 gsl_vector_ushort* w = static_cast<gsl_vector_ushort*>( malloc( sizeof( gsl_vector_ushort ) ) );
964 *w = gsl_matrix_ushort_const_subrow( get(), i, offset, n ).vector;
965 return vector_ushort( w );
966 }
974 vector_ushort const const_subcolumn( size_t const j, size_t const offset, size_t const n ) const {
975 gsl_vector_ushort* w = static_cast<gsl_vector_ushort*>( malloc( sizeof( gsl_vector_ushort ) ) );
976 *w = gsl_matrix_ushort_const_subcolumn( get(), j, offset, n ).vector;
977 return vector_ushort( w );
978 }
987 matrix_ushort const submatrix( size_t const i, size_t const j, size_t const n1, size_t const n2 ) const {
988 gsl_matrix_ushort* m = static_cast<gsl_matrix_ushort*>( malloc( sizeof( gsl_matrix_ushort ) ) );
989 *m = gsl_matrix_ushort_const_submatrix( get(), i, j, n1, n2 ).matrix;
990 return matrix_ushort( m );
991 }
997 vector_ushort const row( size_t const i ) const {
998 gsl_vector_ushort* w = static_cast<gsl_vector_ushort*>( malloc( sizeof( gsl_vector_ushort ) ) );
999 *w = gsl_matrix_ushort_const_row( get(), i ).vector;
1000 return vector_ushort( w );
1001 }
1007 vector_ushort const column( size_t const j ) const {
1008 gsl_vector_ushort* w = static_cast<gsl_vector_ushort*>( malloc( sizeof( gsl_vector_ushort ) ) );
1009 *w = gsl_matrix_ushort_const_column( get(), j ).vector;
1010 return vector_ushort( w );
1011 }
1016 vector_ushort const diagonal() const {
1017 gsl_vector_ushort* w = static_cast<gsl_vector_ushort*>( malloc( sizeof( gsl_vector_ushort ) ) );
1018 *w = gsl_matrix_ushort_const_diagonal( get() ).vector;
1019 return vector_ushort( w );
1020 }
1026 vector_ushort const subdiagonal( size_t const k ) const {
1027 gsl_vector_ushort* w = static_cast<gsl_vector_ushort*>( malloc( sizeof( gsl_vector_ushort ) ) );
1028 *w = gsl_matrix_ushort_const_subdiagonal( get(), k ).vector;
1029 return vector_ushort( w );
1030 }
1036 vector_ushort const superdiagonal( size_t const k ) const {
1037 gsl_vector_ushort* w = static_cast<gsl_vector_ushort*>( malloc( sizeof( gsl_vector_ushort ) ) );
1038 *w = gsl_matrix_ushort_const_superdiagonal( get(), k ).vector;
1039 return vector_ushort( w );
1040 }
1048 vector_ushort const subrow( size_t const i, size_t const offset, size_t const n ) const {
1049 gsl_vector_ushort* w = static_cast<gsl_vector_ushort*>( malloc( sizeof( gsl_vector_ushort ) ) );
1050 *w = gsl_matrix_ushort_const_subrow( get(), i, offset, n ).vector;
1051 return vector_ushort( w );
1052 }
1060 vector_ushort const subcolumn( size_t const j, size_t const offset, size_t const n ) const {
1061 gsl_vector_ushort* w = static_cast<gsl_vector_ushort*>( malloc( sizeof( gsl_vector_ushort ) ) );
1062 *w = gsl_matrix_ushort_const_subcolumn( get(), j, offset, n ).vector;
1063 return vector_ushort( w );
1064 }
1072 static matrix_ushort const const_view_array( unsigned short const* base, size_t const n1, size_t const n2 ){
1073 gsl_matrix_ushort* m = static_cast<gsl_matrix_ushort*>( malloc( sizeof( gsl_matrix_ushort ) ) );
1074 *m = gsl_matrix_ushort_const_view_array( base, n1, n2 ).matrix;
1075 return matrix_ushort( m );
1076 }
1085 static matrix_ushort const
1086 const_view_array_with_tda( unsigned short const* base, size_t const n1, size_t const n2, size_t const tda ){
1087 gsl_matrix_ushort* m = static_cast<gsl_matrix_ushort*>( malloc( sizeof( gsl_matrix_ushort ) ) );
1088 *m = gsl_matrix_ushort_const_view_array_with_tda( base, n1, n2, tda ).matrix;
1089 return matrix_ushort( m );
1090 }
1098 static matrix_ushort const const_view_vector( vector_ushort const& v, size_t const n1, size_t const n2 ){
1099 gsl_matrix_ushort* m = static_cast<gsl_matrix_ushort*>( malloc( sizeof( gsl_matrix_ushort ) ) );
1100 *m = gsl_matrix_ushort_const_view_vector( v.get(), n1, n2 ).matrix;
1101 return matrix_ushort( m );
1102 }
1111 static matrix_ushort const
1112 const_view_vector_with_tda( vector_ushort const& v, size_t const n1, size_t const n2, size_t const tda ){
1113 gsl_matrix_ushort* m = static_cast<gsl_matrix_ushort*>( malloc( sizeof( gsl_matrix_ushort ) ) );
1114 *m = gsl_matrix_ushort_const_view_vector_with_tda( v.get(), n1, n2, tda ).matrix;
1115 return matrix_ushort( m );
1116 }
1124 static matrix_ushort const view_array( unsigned short const* base, size_t const n1, size_t const n2 ){
1125 gsl_matrix_ushort* m = static_cast<gsl_matrix_ushort*>( malloc( sizeof( gsl_matrix_ushort ) ) );
1126 *m = gsl_matrix_ushort_const_view_array( base, n1, n2 ).matrix;
1127 return matrix_ushort( m );
1128 }
1137 static matrix_ushort const
1138 view_array_with_tda( unsigned short const* base, size_t const n1, size_t const n2, size_t const tda ){
1139 gsl_matrix_ushort* m = static_cast<gsl_matrix_ushort*>( malloc( sizeof( gsl_matrix_ushort ) ) );
1140 *m = gsl_matrix_ushort_const_view_array_with_tda( base, n1, n2, tda ).matrix;
1141 return matrix_ushort( m );
1142 }
1150 static matrix_ushort const view_vector( vector_ushort const& v, size_t const n1, size_t const n2 ){
1151 gsl_matrix_ushort* m = static_cast<gsl_matrix_ushort*>( malloc( sizeof( gsl_matrix_ushort ) ) );
1152 *m = gsl_matrix_ushort_const_view_vector( v.get(), n1, n2 ).matrix;
1153 return matrix_ushort( m );
1154 }
1163 static matrix_ushort const
1164 view_vector_with_tda( vector_ushort const& v, size_t const n1, size_t const n2, size_t const tda ){
1165 gsl_matrix_ushort* m = static_cast<gsl_matrix_ushort*>( malloc( sizeof( gsl_matrix_ushort ) ) );
1166 *m = gsl_matrix_ushort_const_view_vector_with_tda( v.get(), n1, n2, tda ).matrix;
1167 return matrix_ushort( m );
1168 }
1169 private:
1177 gsl_matrix_ushort* ccgsl_pointer;
1181 size_t* count;
1182 public:
1183 // shared reference functions
1188 gsl_matrix_ushort* get(){ return ccgsl_pointer; }
1193 gsl_matrix_ushort const* get() const { return ccgsl_pointer; }
1199 bool unique() const { return count != 0 and *count == 1; }
1204 size_t use_count() const { return count == 0 ? 0 : *count; }
1210#ifdef __GXX_EXPERIMENTAL_CXX0X__
1211 explicit
1212#endif
1213 operator bool() const { return ccgsl_pointer != 0; }
1214 // GSL functions
1222 static matrix_ushort calloc( size_t const n1, size_t const n2 ){ return matrix_ushort( gsl_matrix_ushort_calloc( n1, n2 ) ); }
1226 void set_zero(){ gsl_matrix_ushort_set_zero( get() ); }
1231 void set_all( unsigned short x ){ gsl_matrix_ushort_set_all( get(), x ); }
1237 int memcpy( matrix_ushort const& src ){ return gsl_matrix_ushort_memcpy( get(), src.get() ); }
1242 unsigned short max() const { return gsl_matrix_ushort_max( get() ); }
1247 unsigned short min() const { return gsl_matrix_ushort_min( get() ); }
1253 void minmax( unsigned short* min_out, unsigned short* max_out ) const {
1254 gsl_matrix_ushort_minmax( get(), min_out, max_out ); }
1260 void minmax( unsigned short& min_out, unsigned short& max_out ) const {
1261 gsl_matrix_ushort_minmax( get(), &min_out, &max_out ); }
1267 int add( matrix_ushort const& b ){ return gsl_matrix_ushort_add( get(), b.get() ); }
1273 int sub( matrix_ushort const& b ){ return gsl_matrix_ushort_sub( get(), b.get() ); }
1279 int scale( unsigned short const x ){ return gsl_matrix_ushort_scale( get(), x ); }
1285 int add_constant( unsigned short const x ){ return gsl_matrix_ushort_add_constant( get(), x ); }
1290 int isnull() const { return gsl_matrix_ushort_isnull( get() ); }
1295 int ispos() const { return gsl_matrix_ushort_ispos( get() ); }
1300 int isneg() const { return gsl_matrix_ushort_isneg( get() ); }
1305 int isnonneg() const { return gsl_matrix_ushort_isnonneg( get() ); }
1312 unsigned short get( size_t const i, size_t const j ) const { return gsl_matrix_ushort_get( get(), i, j ); }
1319 void set( size_t const i, size_t const j, unsigned short x ){ gsl_matrix_ushort_set( get(), i, j, x ); }
1326 unsigned short* ptr( size_t const i, size_t const j ){ return gsl_matrix_ushort_ptr( get(), i, j ); }
1333 unsigned short const* const_ptr( size_t const i, size_t const j ) const {
1334 return gsl_matrix_ushort_const_ptr( get(), i, j ); }
1340 int fread( FILE* stream ){ return gsl_matrix_ushort_fread( stream, get() ); }
1346 int fwrite( FILE* stream ) const { return gsl_matrix_ushort_fwrite( stream, get() ); }
1352 int fscanf( FILE* stream ){ return gsl_matrix_ushort_fscanf( stream, get() ); }
1359 int fprintf( FILE* stream, char const* format ) const {
1360 return gsl_matrix_ushort_fprintf( stream, get(), format ); }
1369 matrix_ushort( block_ushort& b, size_t const offset, size_t const n1, size_t const n2, size_t const d2 ){
1370 ccgsl_pointer = gsl_matrix_ushort_alloc_from_block( b.get(), offset, n1, n2, d2 );
1371 // just plausibly we could allocate vector_ushort but not count
1372 try { count = new size_t; } catch( std::bad_alloc& e ){
1373 // try to tidy up before rethrowing
1374 gsl_matrix_ushort_free( ccgsl_pointer );
1375 throw e;
1376 }
1377 *count = 1; // initially there is just one reference to ccgsl_pointer
1378 }
1387 matrix_ushort( matrix_ushort& m, size_t const k1, size_t const k2, size_t const n1, size_t const n2 ){
1388 ccgsl_pointer = gsl_matrix_ushort_alloc_from_matrix( m.get(), k1, k2, n1, n2 );
1389 // just plausibly we could allocate matrix_ushort but not count
1390 try { count = new size_t; } catch( std::bad_alloc& e ){
1391 // try to tidy up before rethrowing
1392 gsl_matrix_ushort_free( ccgsl_pointer );
1393 throw e;
1394 }
1395 *count = 1; // initially there is just one reference to ccgsl_pointer
1396 }
1397 // More functions
1401 void set_identity(){ gsl_matrix_ushort_set_identity( get() ); }
1408 int swap_rows( size_t const i, size_t const j ){ return gsl_matrix_ushort_swap_rows( get(), i, j ); }
1415 int swap_columns( size_t const i, size_t const j ){
1416 return gsl_matrix_ushort_swap_columns( get(), i, j ); }
1423 int swap_rowcol( size_t const i, size_t const j ){ return gsl_matrix_ushort_swap_rowcol( get(), i, j ); }
1428 int transpose(){ return gsl_matrix_ushort_transpose( get() ); }
1435 return gsl_matrix_ushort_transpose_memcpy( get(), src.get() ); }
1436#ifndef DOXYGEN_SKIP
1442 void max_index( size_t* imax, size_t* jmax ) const {
1443 gsl_matrix_ushort_max_index( get(), imax, jmax ); }
1449 void min_index( size_t* imin, size_t* jmin ) const {
1450 gsl_matrix_ushort_min_index( get(), imin, jmin ); }
1458 void minmax_index( size_t* imin, size_t* jmin, size_t* imax, size_t* jmax ) const {
1459 gsl_matrix_ushort_minmax_index( get(), imin, jmin, imax, jmax ); }
1460#endif
1466 void max_index( size_t& imax, size_t& jmax ) const {
1467 gsl_matrix_ushort_max_index( get(), &imax, &jmax ); }
1473 void min_index( size_t& imin, size_t& jmin ) const {
1474 gsl_matrix_ushort_min_index( get(), &imin, &jmin ); }
1482 void minmax_index( size_t& imin, size_t& jmin, size_t& imax, size_t& jmax ) const {
1483 gsl_matrix_ushort_minmax_index( get(), &imin, &jmin, &imax, &jmax ); }
1489 int
1491 return gsl_matrix_ushort_mul_elements( get(), b.get() ); }
1499 return gsl_matrix_ushort_div_elements( get(), b.get() ); }
1504 unsigned short norm1() const {
1505 return gsl_matrix_ushort_norm1( get() ); }
1511 int scale_rows( vector_ushort const& x ){
1512 return gsl_matrix_ushort_scale_rows( get(), x.get() ); }
1519 return gsl_matrix_ushort_scale_columns( get(), x.get() ); }
1525 int add_diagonal( unsigned short const x ){
1526 return gsl_matrix_ushort_add_diagonal( get(), x ); }
1533 int get_row( vector_ushort& v, size_t const i ) const {
1534 return gsl_matrix_ushort_get_row( v.get(), get(), i ); }
1541 int get_col( vector_ushort& v, size_t const j ) const {
1542 return gsl_matrix_ushort_get_col( v.get(), get(), j ); }
1549 int set_row( size_t const i, vector_ushort const& v ){
1550 return gsl_matrix_ushort_set_row( get(), i, v.get() ); }
1557 int set_col( size_t const j, vector_ushort const& v ){
1558 return gsl_matrix_ushort_set_col( get(), j, v.get() ); }
1559 // Extra functions for []
1567 vector_ushort operator[]( size_t const i ){
1568 // First check that iterator is initialised.
1569 if( ccgsl_pointer == 0 ){
1570 gsl_error( "matrix_ushort is null", __FILE__, __LINE__, exception::GSL_EFAULT );
1571 return vector_ushort();
1572 }
1573#ifndef GSL_RANGE_CHECK_OFF
1574#ifndef __GXX_EXPERIMENTAL_CXX0X__
1575 static vector_ushort something;
1576#endif
1577 //Check that position make sense
1578 if( i >= size1() ){
1579 gsl_error( "trying to read beyond last row of matrix_ushort",
1580 __FILE__, __LINE__, exception::GSL_EINVAL );
1581#ifdef __GXX_EXPERIMENTAL_CXX0X__
1582 return vector_ushort();
1583#else
1584 return something;
1585#endif
1586 }
1587 // n is a valid position
1588#endif
1589 vector_ushort v(0);
1590 gsl_vector_ushort_view w = gsl_matrix_ushort_row( ccgsl_pointer, i );
1592 return v;
1593 }
1601 vector_ushort const operator[]( size_t const i ) const {
1602 // First check that iterator is initialised.
1603 if( ccgsl_pointer == 0 ){
1604 gsl_error( "matrix_ushort is null", __FILE__, __LINE__, exception::GSL_EFAULT );
1605 return vector_ushort();
1606 }
1607 vector_ushort v(0);
1608 gsl_vector_ushort_view w = gsl_matrix_ushort_row( ccgsl_pointer, i );
1610 return v;
1611 }
1617 inline int
1619 return gsl_permute_matrix_ushort( p.get(), get() ); }
1620 };
1621
1622 // Extra functions for vector_ushort allocation from matrix_ushort objects
1624 inline vector_ushort vector_ushort::alloc_row_from_matrix( matrix_ushort& m, size_t const i ){
1625 return vector_ushort ( gsl_vector_ushort_alloc_row_from_matrix( m.get(), i ) ); }
1626 inline vector_ushort vector_ushort::alloc_col_from_matrix( matrix_ushort& m, size_t const i ){
1627 return vector_ushort ( gsl_vector_ushort_alloc_col_from_matrix( m.get(), i ) ); }
1629}
1630#endif
This class handles vector_ushorts as shared handles.
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==(const_iterator_t< reverse_t > const &i) const
Comparison with const iterator.
const_iterator_t< reverse_t > & operator++()
The prefix ++ operator.
const_iterator_t< reverse_t > operator--(int)
The postfix – operator.
const_iterator_t< reverse_t > operator++(int)
The postfix ++ operator.
const_iterator_t(iterator_t< reverse_t > const &i)
A copy constructor.
const_iterator_t(matrix_ushort const *v, size_t position)
This constructor allows vector_ushort to create non-default iterators.
const_iterator_t< reverse_t > & operator--()
The prefix – operator.
bool operator!=(const_iterator_t< reverse_t > const &i) const
Comparison with const iterator.
bool operator==(iterator_t< reverse_t > const &i) const
Comparison with non-const iterator.
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()
The default constructor.
We create a suitable class for iterator types here.
size_t position
Mark position of iterator within matrix_ushort.
value_type reference
An iterator must have a reference type.
container * v
Store a pointer to a matrix_ushort we can iterate over: 0 if no matrix_ushort.
iterator_base()
The iterator is default constructible.
iterator_base(container *v, size_t position)
This constructor allows vector_ushort to create non-default iterators.
void increment()
Increment the iterator.
vector_ushort_ptr pointer
An iterator must have a pointer typea.
std::bidirectional_iterator_tag iterator_category
An iterator must have an iterator category.
void decrement()
Decrement the iterator.
pointer operator->() const
Dereference the pointer.
reference operator*() const
Dereference the pointer.
bool operator!=(iterator_base< container, content, reverse_t > const &i) const
The != operator.
vector_ushort value_type
An iterator must have a value type.
bool operator==(iterator_base< container, content, reverse_t > const &i) const
The == operator.
A class template for the two non-const iterators.
iterator_t(matrix_ushort *v, size_t position)
This constructor allows vector_ushort to create non-default iterators.
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.
bool operator==(const_iterator_t< reverse_t > const &i) const
Comparison with const iterator.
iterator_t< reverse_t > operator--(int)
The postfix – operator.
iterator_t< reverse_t > & operator--()
The prefix – operator.
iterator_t< reverse_t > & operator++()
The prefix ++ operator.
iterator_t< reverse_t > operator++(int)
The postfix ++ operator.
This class handles matrix_ushort objects as shared handles.
vector_ushort const diagonal() const
Another C++ version of gsl_matrix_ushort_const_diagonal().
vector_ushort const operator[](size_t const i) const
This function allows us to use a matrix_ushort like an array.
void set_zero()
C++ version of gsl_matrix_ushort_set_zero().
vector_ushort const column(size_t const j) const
Another C++ version of gsl_matrix_ushort_const_column().
int permute(permutation &p)
Permute the columns of this by permutation p.
matrix_ushort(block_ushort &b, size_t const offset, size_t const n1, size_t const n2, size_t const d2)
C++ version of gsl_matrix_ushort_alloc_from_block().
vector_ushort subrow(size_t const i, size_t const offset, size_t const n)
C++ version of gsl_matrix_ushort_subrow().
static matrix_ushort calloc(size_t const n1, size_t const n2)
C++ version of gsl_matrix_ushort_calloc().
const_iterator begin() const
Get iterator pointing to first vector_ushort element.
unsigned short * ptr(size_t const i, size_t const j)
C++ version of gsl_matrix_ushort_ptr().
vector_ushort const const_row(size_t const i) const
C++ version of gsl_matrix_ushort_const_row().
static matrix_ushort const const_view_vector_with_tda(vector_ushort const &v, size_t const n1, size_t const n2, size_t const tda)
C++ version of gsl_matrix_ushort_const_view_vector_with_tda().
const_reverse_iterator rbegin() const
Get iterator pointing to first vector_ushort element.
int set_row(size_t const i, vector_ushort const &v)
C++ version of gsl_matrix_ushort_set_row().
bool unique() const
Find if this is the only object sharing the gsl_matrix_ushort.
matrix_ushort clone() const
The clone function.
size_t size1() const
The number of rows of the matrix_ushort.
int transpose()
C++ version of gsl_matrix_ushort_transpose().
reverse_iterator rend()
Get iterator pointing beyond last vector_ushort element.
reverse_iterator rbegin()
Get iterator pointing to first vector_ushort element.
void transpose_tricpy(CBLAS_UPLO_t Uplo, CBLAS_DIAG_t Diag, matrix_ushort const &src)
Copy the upper or lower triangular part of matrix src to this.
size_t use_count() const
Find how many matrix_ushort objects share this pointer.
int sub(matrix_ushort const &b)
C++ version of gsl_matrix_ushort_sub().
size_t * count
The shared reference count.
vector_ushort const subdiagonal(size_t const k) const
Another C++ version of gsl_matrix_ushort_const_subdiagonal().
int scale_rows(vector_ushort const &x)
C++ version of gsl_matrix_ushort_scale_rows().
vector_ushort diagonal()
C++ version of gsl_matrix_ushort_diagonal().
int swap_columns(size_t const i, size_t const j)
C++ version of gsl_matrix_ushort_swap_columns().
matrix_ushort(std::initializer_list< std::initializer_list< unsigned short > > initializer_list)
Could construct from a std::initializer_list in C++11.
unsigned short * data()
Give access to the data block_ushort.
vector_ushort const row(size_t const i) const
Another C++ version of gsl_matrix_ushort_const_row().
static matrix_ushort view_array(unsigned short *base, size_t const n1, size_t const n2)
C++ version of gsl_matrix_ushort_view_array().
int add_diagonal(unsigned short const x)
C++ version of gsl_matrix_ushort_add_diagonal().
void minmax_index(size_t &imin, size_t &jmin, size_t &imax, size_t &jmax) const
C++ version of gsl_matrix_ushort_minmax_index().
static matrix_ushort const view_vector_with_tda(vector_ushort const &v, size_t const n1, size_t const n2, size_t const tda)
Another C++ version of gsl_matrix_ushort_const_view_vector_with_tda().
iterator_t< true > reverse_iterator
The reverse_iterator type.
int fprintf(FILE *stream, char const *format) const
C++ version of gsl_matrix_ushort_fprintf().
vector_ushort column(size_t const j)
C++ version of gsl_matrix_ushort_column().
const_reverse_iterator rend() const
Get iterator pointing beyond last vector_ushort element.
iterator begin()
Get iterator pointing to first vector_ushort element.
vector_ushort operator[](size_t const i)
This function allows us to use a matrix_ushort like an array.
void set(size_t const i, size_t const j, unsigned short x)
C++ version of gsl_matrix_ushort_set().
void wrap_gsl_matrix_ushort_without_ownership(gsl_matrix_ushort *v)
This function is intended mainly for internal use.
vector_ushort subdiagonal(size_t const k)
C++ version of gsl_matrix_ushort_subdiagonal().
matrix_ushort 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_ushort_const_submatrix().
static matrix_ushort view_array_with_tda(unsigned short *base, size_t const n1, size_t const n2, size_t const tda)
C++ version of gsl_matrix_ushort_view_array_with_tda().
void minmax(unsigned short *min_out, unsigned short *max_out) const
C++ version of gsl_matrix_ushort_minmax().
vector_ushort superdiagonal(size_t const k)
C++ version of gsl_matrix_ushort_superdiagonal().
vector_ushort const subcolumn(size_t const j, size_t const offset, size_t const n) const
Another C++ version of gsl_matrix_ushort_const_subcolumn().
matrix_ushort(matrix_ushort const &v)
The copy constructor.
~matrix_ushort()
The destructor only deletes the pointers if count reaches zero.
int ispos() const
C++ version of gsl_matrix_ushort_ispos().
unsigned short const * data() const
Give access to the data block_ushort.
matrix_ushort 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_ushort_const_submatrix().
void minmax(unsigned short &min_out, unsigned short &max_out) const
C++ version of gsl_matrix_ushort_minmax().
static matrix_ushort const view_array_with_tda(unsigned short const *base, size_t const n1, size_t const n2, size_t const tda)
Another C++ version of gsl_matrix_ushort_const_view_array_with_tda().
gsl_matrix_ushort * ccgsl_pointer
The shared pointer.
int memcpy(matrix_ushort const &src)
C++ version of gsl_matrix_ushort_memcpy().
static matrix_ushort const view_array(unsigned short const *base, size_t const n1, size_t const n2)
Another C++ version of gsl_matrix_ushort_const_view_array().
int add(matrix_ushort const &b)
C++ version of gsl_matrix_ushort_add().
matrix_ushort()
The default constructor is only really useful for assigning to.
size_t size_type
A container must have a size_type.
const_iterator_t< true > const_reverse_iterator
The const_reverse_t type.
vector_ushort subcolumn(size_t const j, size_t const offset, size_t const n)
C++ version of gsl_matrix_ushort_subcolumn().
int mul_elements(matrix_ushort const &b)
C++ version of gsl_matrix_ushort_mul_elements().
unsigned short min() const
C++ version of gsl_matrix_ushort_min().
matrix_ushort(matrix_ushort &&v)
Move constructor.
unsigned short norm1() const
C++ version of gsl_matrix_ushort_norm1().
int isneg() const
C++ version of gsl_matrix_ushort_isneg().
int transpose_memcpy(matrix_ushort const &src)
C++ version of gsl_matrix_ushort_transpose_memcpy().
static matrix_ushort const const_view_array_with_tda(unsigned short const *base, size_t const n1, size_t const n2, size_t const tda)
C++ version of gsl_matrix_ushort_const_view_array_with_tda().
int get_col(vector_ushort &v, size_t const j) const
C++ version of gsl_matrix_ushort_get_col().
matrix_ushort(size_t const n1, size_t const n2)
This constructor creates a new matrix_ushort with n1 rows and n2 columns.
int fscanf(FILE *stream)
C++ version of gsl_matrix_ushort_fscanf().
size_t size2() const
The number of columns of the matrix_ushort.
const_iterator_t< false > const_iterator
The const_iterator type.
static matrix_ushort const view_vector(vector_ushort const &v, size_t const n1, size_t const n2)
Another C++ version of gsl_matrix_ushort_const_view_vector().
int scale(unsigned short const x)
C++ version of gsl_matrix_ushort_scale().
iterator end()
Get iterator pointing beyond last vector_ushort element.
unsigned short max() const
C++ version of gsl_matrix_ushort_max().
unsigned short const * const_ptr(size_t const i, size_t const j) const
C++ version of gsl_matrix_ushort_const_ptr().
vector_ushort const const_subcolumn(size_t const j, size_t const offset, size_t const n) const
C++ version of gsl_matrix_ushort_const_subcolumn().
vector_ushort const const_subrow(size_t const i, size_t const offset, size_t const n) const
C++ version of gsl_matrix_ushort_const_subrow().
int add_constant(unsigned short const x)
C++ version of gsl_matrix_ushort_add_constant().
void max_index(size_t &imax, size_t &jmax) const
C++ version of gsl_matrix_ushort_max_index().
bool owns_data
Used to allow a vector that does not own its data.
vector_ushort row(size_t const i)
C++ version of gsl_matrix_ushort_row().
static matrix_ushort const const_view_vector(vector_ushort const &v, size_t const n1, size_t const n2)
C++ version of gsl_matrix_ushort_const_view_vector().
void min_index(size_t &imin, size_t &jmin) const
C++ version of gsl_matrix_ushort_min_index().
void swap(matrix_ushort &m)
Swap two matrix_ushort objects.
int get_row(vector_ushort &v, size_t const i) const
C++ version of gsl_matrix_ushort_get_row().
gsl_matrix_ushort const * get() const
Get the gsl_matrix_ushort.
matrix_ushort & operator=(matrix_ushort &&v)
Move operator.
int swap_rows(size_t const i, size_t const j)
C++ version of gsl_matrix_ushort_swap_rows().
int fwrite(FILE *stream) const
C++ version of gsl_matrix_ushort_fwrite().
vector_ushort const subrow(size_t const i, size_t const offset, size_t const n) const
Another C++ version of gsl_matrix_ushort_const_subrow().
static matrix_ushort const const_view_array(unsigned short const *base, size_t const n1, size_t const n2)
C++ version of gsl_matrix_ushort_const_view_array().
matrix_ushort(gsl_matrix_ushort *v)
Could construct from a gsl_matrix_ushort.
vector_ushort const const_diagonal() const
C++ version of gsl_matrix_ushort_const_diagonal().
int isnonneg() const
C++ version of gsl_matrix_ushort_isnonneg().
int fread(FILE *stream)
C++ version of gsl_matrix_ushort_fread().
vector_ushort const const_superdiagonal(size_t const k) const
C++ version of gsl_matrix_ushort_const_superdiagonal().
matrix_ushort & operator=(matrix_ushort const &v)
The assignment operator.
void set_all(unsigned short x)
C++ version of gsl_matrix_ushort_set_all().
matrix_ushort(matrix_ushort &m, size_t const k1, size_t const k2, size_t const n1, size_t const n2)
C++ version of gsl_matrix_ushort_alloc_from_matrix().
static matrix_ushort view_vector_with_tda(vector_ushort &v, size_t const n1, size_t const n2, size_t const tda)
C++ version of gsl_matrix_ushort_view_vector_with_tda().
iterator_t< false > iterator
The iterator type.
int set_col(size_t const j, vector_ushort const &v)
C++ version of gsl_matrix_ushort_set_col().
gsl_matrix_ushort * get()
Get the gsl_matrix_ushort.
const_iterator end() const
Get iterator pointing beyond last vector_ushort element.
unsigned short get(size_t const i, size_t const j) const
C++ version of gsl_matrix_ushort_get().
int isnull() const
C++ version of gsl_matrix_ushort_isnull().
void tricpy(CBLAS_UPLO_t Uplo, CBLAS_DIAG_t Diag, matrix_ushort const &src)
Copy the upper or lower triangular part of matrix src to this.
int swap_rowcol(size_t const i, size_t const j)
C++ version of gsl_matrix_ushort_swap_rowcol().
void reset()
Stop sharing ownership of the shared pointer.
vector_ushort const superdiagonal(size_t const k) const
Another C++ version of gsl_matrix_ushort_const_superdiagonal().
void set_identity()
C++ version of gsl_matrix_ushort_set_identity().
matrix_ushort submatrix(size_t const i, size_t const j, size_t const n1, size_t const n2)
C++ version of gsl_matrix_ushort_submatrix().
static matrix_ushort view_vector(vector_ushort &v, size_t const n1, size_t const n2)
C++ version of gsl_matrix_ushort_view_vector().
vector_ushort const const_column(size_t const j) const
C++ version of gsl_matrix_ushort_const_column().
int div_elements(matrix_ushort const &b)
C++ version of gsl_matrix_ushort_div_elements().
vector_ushort const const_subdiagonal(size_t const k) const
C++ version of gsl_matrix_ushort_const_subdiagonal().
int scale_columns(vector_ushort const &x)
C++ version of gsl_matrix_ushort_scale_columns().
This class handles GSL permutation objects.
Definition: permutation.hpp:33
gsl_permutation * get()
Get the gsl_permutation.
This class handles vector_ushort objects as shared handles.
gsl_vector_ushort * get()
Get the gsl_vector_ushort.
static vector_ushort alloc_row_from_matrix(matrix_ushort &m, size_t const i)
C++ version of gsl_vector_ushort_alloc_row_from_matrix().
static vector_ushort alloc_col_from_matrix(matrix_ushort &m, size_t const j)
C++ version of gsl_vector_ushort_alloc_col_from_matrix().
void wrap_gsl_vector_ushort_without_ownership(gsl_vector_ushort *v)
This function is intended mainly for internal use.
vector_ushort()
The default constructor is only really useful for assigning to.
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_ushort * operator->()
Dereference operator.
vector_ushort & operator*()
Dereference operator.
vector_ushort_ptr(vector_ushort const &v)
Typically we have to construct from a vector_ushort.