| 1 | # This file was automatically generated by SWIG (https://www.swig.org). | ||
| 2 | # Version 4.2.0 | ||
| 3 | # | ||
| 4 | # Do not make changes to this file unless you know what you are doing - modify | ||
| 5 | # the SWIG interface file instead. | ||
| 6 | |||
| 7 | package Math::GSL::Permutation; | ||
| 8 | use base qw(Exporter); | ||
| 9 | use base qw(DynaLoader); | ||
| 10 | package Math::GSL::Permutationc; | ||
| 11 | bootstrap Math::GSL::Permutation; | ||
| 12 | package Math::GSL::Permutation; | ||
| 13 | @EXPORT = qw(); | ||
| 14 | |||
| 15 | # ---------- BASE METHODS ------------- | ||
| 16 | |||
| 17 | package Math::GSL::Permutation; | ||
| 18 | |||
| 19 | sub TIEHASH { | ||
| 20 | my ($classname,$obj) = @_; | ||
| 21 | return bless $obj, $classname; | ||
| 22 | } | ||
| 23 | |||
| 24 | sub CLEAR { } | ||
| 25 | |||
| 26 | sub FIRSTKEY { } | ||
| 27 | |||
| 28 | sub NEXTKEY { } | ||
| 29 | |||
| 30 | sub FETCH { | ||
| 31 | my ($self,$field) = @_; | ||
| 32 | my $member_func = "swig_${field}_get"; | ||
| 33 | $self->$member_func(); | ||
| 34 | } | ||
| 35 | |||
| 36 | sub STORE { | ||
| 37 | my ($self,$field,$newval) = @_; | ||
| 38 | my $member_func = "swig_${field}_set"; | ||
| 39 | $self->$member_func($newval); | ||
| 40 | } | ||
| 41 | |||
| 42 | sub this { | ||
| 43 | my $ptr = shift; | ||
| 44 | return tied(%$ptr); | ||
| 45 | } | ||
| 46 | |||
| 47 | |||
| 48 | # ------- FUNCTION WRAPPERS -------- | ||
| 49 | |||
| 50 | package Math::GSL::Permutation; | ||
| 51 | |||
| 52 | *gsl_error = *Math::GSL::Permutationc::gsl_error; | ||
| 53 | *gsl_stream_printf = *Math::GSL::Permutationc::gsl_stream_printf; | ||
| 54 | *gsl_strerror = *Math::GSL::Permutationc::gsl_strerror; | ||
| 55 | *gsl_set_error_handler = *Math::GSL::Permutationc::gsl_set_error_handler; | ||
| 56 | *gsl_set_error_handler_off = *Math::GSL::Permutationc::gsl_set_error_handler_off; | ||
| 57 | *gsl_set_stream_handler = *Math::GSL::Permutationc::gsl_set_stream_handler; | ||
| 58 | *gsl_set_stream = *Math::GSL::Permutationc::gsl_set_stream; | ||
| 59 | *gsl_permute_complex_long_double = *Math::GSL::Permutationc::gsl_permute_complex_long_double; | ||
| 60 | *gsl_permute_complex_long_double_inverse = *Math::GSL::Permutationc::gsl_permute_complex_long_double_inverse; | ||
| 61 | *gsl_permute_complex = *Math::GSL::Permutationc::gsl_permute_complex; | ||
| 62 | *gsl_permute_complex_inverse = *Math::GSL::Permutationc::gsl_permute_complex_inverse; | ||
| 63 | *gsl_permute_complex_float = *Math::GSL::Permutationc::gsl_permute_complex_float; | ||
| 64 | *gsl_permute_complex_float_inverse = *Math::GSL::Permutationc::gsl_permute_complex_float_inverse; | ||
| 65 | *gsl_permute_long_double = *Math::GSL::Permutationc::gsl_permute_long_double; | ||
| 66 | *gsl_permute_long_double_inverse = *Math::GSL::Permutationc::gsl_permute_long_double_inverse; | ||
| 67 | *gsl_permute = *Math::GSL::Permutationc::gsl_permute; | ||
| 68 | *gsl_permute_inverse = *Math::GSL::Permutationc::gsl_permute_inverse; | ||
| 69 | *gsl_permute_int = *Math::GSL::Permutationc::gsl_permute_int; | ||
| 70 | *gsl_permute_int_inverse = *Math::GSL::Permutationc::gsl_permute_int_inverse; | ||
| 71 | *gsl_permute_uint = *Math::GSL::Permutationc::gsl_permute_uint; | ||
| 72 | *gsl_permute_uint_inverse = *Math::GSL::Permutationc::gsl_permute_uint_inverse; | ||
| 73 | *gsl_permute_vector = *Math::GSL::Permutationc::gsl_permute_vector; | ||
| 74 | *gsl_permute_vector_inverse = *Math::GSL::Permutationc::gsl_permute_vector_inverse; | ||
| 75 | *gsl_permute_vector_int = *Math::GSL::Permutationc::gsl_permute_vector_int; | ||
| 76 | *gsl_permute_vector_int_inverse = *Math::GSL::Permutationc::gsl_permute_vector_int_inverse; | ||
| 77 | *gsl_permute_vector_uint = *Math::GSL::Permutationc::gsl_permute_vector_uint; | ||
| 78 | *gsl_permute_vector_uint_inverse = *Math::GSL::Permutationc::gsl_permute_vector_uint_inverse; | ||
| 79 | *gsl_permute_vector_long = *Math::GSL::Permutationc::gsl_permute_vector_long; | ||
| 80 | *gsl_permute_vector_long_inverse = *Math::GSL::Permutationc::gsl_permute_vector_long_inverse; | ||
| 81 | *gsl_permute_vector_long_double = *Math::GSL::Permutationc::gsl_permute_vector_long_double; | ||
| 82 | *gsl_permute_vector_long_double_inverse = *Math::GSL::Permutationc::gsl_permute_vector_long_double_inverse; | ||
| 83 | *gsl_permute_vector_ulong = *Math::GSL::Permutationc::gsl_permute_vector_ulong; | ||
| 84 | *gsl_permute_vector_ulong_inverse = *Math::GSL::Permutationc::gsl_permute_vector_ulong_inverse; | ||
| 85 | *gsl_permute_vector_short = *Math::GSL::Permutationc::gsl_permute_vector_short; | ||
| 86 | *gsl_permute_vector_short_inverse = *Math::GSL::Permutationc::gsl_permute_vector_short_inverse; | ||
| 87 | *gsl_permute_vector_ushort = *Math::GSL::Permutationc::gsl_permute_vector_ushort; | ||
| 88 | *gsl_permute_vector_ushort_inverse = *Math::GSL::Permutationc::gsl_permute_vector_ushort_inverse; | ||
| 89 | *gsl_permutation_alloc = *Math::GSL::Permutationc::gsl_permutation_alloc; | ||
| 90 | *gsl_permutation_calloc = *Math::GSL::Permutationc::gsl_permutation_calloc; | ||
| 91 | *gsl_permutation_init = *Math::GSL::Permutationc::gsl_permutation_init; | ||
| 92 | *gsl_permutation_free = *Math::GSL::Permutationc::gsl_permutation_free; | ||
| 93 | *gsl_permutation_memcpy = *Math::GSL::Permutationc::gsl_permutation_memcpy; | ||
| 94 | *gsl_permutation_fread = *Math::GSL::Permutationc::gsl_permutation_fread; | ||
| 95 | *gsl_permutation_fwrite = *Math::GSL::Permutationc::gsl_permutation_fwrite; | ||
| 96 | *gsl_permutation_fscanf = *Math::GSL::Permutationc::gsl_permutation_fscanf; | ||
| 97 | *gsl_permutation_fprintf = *Math::GSL::Permutationc::gsl_permutation_fprintf; | ||
| 98 | *gsl_permutation_size = *Math::GSL::Permutationc::gsl_permutation_size; | ||
| 99 | *gsl_permutation_data = *Math::GSL::Permutationc::gsl_permutation_data; | ||
| 100 | *gsl_permutation_swap = *Math::GSL::Permutationc::gsl_permutation_swap; | ||
| 101 | *gsl_permutation_valid = *Math::GSL::Permutationc::gsl_permutation_valid; | ||
| 102 | *gsl_permutation_reverse = *Math::GSL::Permutationc::gsl_permutation_reverse; | ||
| 103 | *gsl_permutation_inverse = *Math::GSL::Permutationc::gsl_permutation_inverse; | ||
| 104 | *gsl_permutation_next = *Math::GSL::Permutationc::gsl_permutation_next; | ||
| 105 | *gsl_permutation_prev = *Math::GSL::Permutationc::gsl_permutation_prev; | ||
| 106 | *gsl_permutation_mul = *Math::GSL::Permutationc::gsl_permutation_mul; | ||
| 107 | *gsl_permutation_linear_to_canonical = *Math::GSL::Permutationc::gsl_permutation_linear_to_canonical; | ||
| 108 | *gsl_permutation_canonical_to_linear = *Math::GSL::Permutationc::gsl_permutation_canonical_to_linear; | ||
| 109 | *gsl_permutation_inversions = *Math::GSL::Permutationc::gsl_permutation_inversions; | ||
| 110 | *gsl_permutation_linear_cycles = *Math::GSL::Permutationc::gsl_permutation_linear_cycles; | ||
| 111 | *gsl_permutation_canonical_cycles = *Math::GSL::Permutationc::gsl_permutation_canonical_cycles; | ||
| 112 | *gsl_permutation_get = *Math::GSL::Permutationc::gsl_permutation_get; | ||
| 113 | |||
| 114 | ############# Class : Math::GSL::Permutation::gsl_permutation_struct ############## | ||
| 115 | |||
| 116 | package Math::GSL::Permutation::gsl_permutation_struct; | ||
| 117 | use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS); | ||
| 118 | @ISA = qw( Math::GSL::Permutation ); | ||
| 119 | %OWNER = (); | ||
| 120 | %ITERATORS = (); | ||
| 121 | *swig_size_get = *Math::GSL::Permutationc::gsl_permutation_struct_size_get; | ||
| 122 | *swig_size_set = *Math::GSL::Permutationc::gsl_permutation_struct_size_set; | ||
| 123 | *swig_data_get = *Math::GSL::Permutationc::gsl_permutation_struct_data_get; | ||
| 124 | *swig_data_set = *Math::GSL::Permutationc::gsl_permutation_struct_data_set; | ||
| 125 | sub new { | ||
| 126 | my $pkg = shift; | ||
| 127 | my $self = Math::GSL::Permutationc::new_gsl_permutation_struct(@_); | ||
| 128 | bless $self, $pkg if defined($self); | ||
| 129 | } | ||
| 130 | |||
| 131 | sub DESTROY { | ||
| 132 | return unless $_[0]->isa('HASH'); | ||
| 133 | my $self = tied(%{$_[0]}); | ||
| 134 | return unless defined $self; | ||
| 135 | delete $ITERATORS{$self}; | ||
| 136 | if (exists $OWNER{$self}) { | ||
| 137 | Math::GSL::Permutationc::delete_gsl_permutation_struct($self); | ||
| 138 | delete $OWNER{$self}; | ||
| 139 | } | ||
| 140 | } | ||
| 141 | |||
| 142 | sub DISOWN { | ||
| 143 | my $self = shift; | ||
| 144 | my $ptr = tied(%$self); | ||
| 145 | delete $OWNER{$ptr}; | ||
| 146 | } | ||
| 147 | |||
| 148 | sub ACQUIRE { | ||
| 149 | my $self = shift; | ||
| 150 | my $ptr = tied(%$self); | ||
| 151 | $OWNER{$ptr} = 1; | ||
| 152 | } | ||
| 153 | |||
| 154 | |||
| 155 | # ------- VARIABLE STUBS -------- | ||
| 156 | |||
| 157 | package Math::GSL::Permutation; | ||
| 158 | |||
| 159 | *GSL_VERSION = *Math::GSL::Permutationc::GSL_VERSION; | ||
| 160 | *GSL_MAJOR_VERSION = *Math::GSL::Permutationc::GSL_MAJOR_VERSION; | ||
| 161 | *GSL_MINOR_VERSION = *Math::GSL::Permutationc::GSL_MINOR_VERSION; | ||
| 162 | *GSL_POSZERO = *Math::GSL::Permutationc::GSL_POSZERO; | ||
| 163 | *GSL_NEGZERO = *Math::GSL::Permutationc::GSL_NEGZERO; | ||
| 164 | *GSL_SUCCESS = *Math::GSL::Permutationc::GSL_SUCCESS; | ||
| 165 | *GSL_FAILURE = *Math::GSL::Permutationc::GSL_FAILURE; | ||
| 166 | *GSL_CONTINUE = *Math::GSL::Permutationc::GSL_CONTINUE; | ||
| 167 | *GSL_EDOM = *Math::GSL::Permutationc::GSL_EDOM; | ||
| 168 | *GSL_ERANGE = *Math::GSL::Permutationc::GSL_ERANGE; | ||
| 169 | *GSL_EFAULT = *Math::GSL::Permutationc::GSL_EFAULT; | ||
| 170 | *GSL_EINVAL = *Math::GSL::Permutationc::GSL_EINVAL; | ||
| 171 | *GSL_EFAILED = *Math::GSL::Permutationc::GSL_EFAILED; | ||
| 172 | *GSL_EFACTOR = *Math::GSL::Permutationc::GSL_EFACTOR; | ||
| 173 | *GSL_ESANITY = *Math::GSL::Permutationc::GSL_ESANITY; | ||
| 174 | *GSL_ENOMEM = *Math::GSL::Permutationc::GSL_ENOMEM; | ||
| 175 | *GSL_EBADFUNC = *Math::GSL::Permutationc::GSL_EBADFUNC; | ||
| 176 | *GSL_ERUNAWAY = *Math::GSL::Permutationc::GSL_ERUNAWAY; | ||
| 177 | *GSL_EMAXITER = *Math::GSL::Permutationc::GSL_EMAXITER; | ||
| 178 | *GSL_EZERODIV = *Math::GSL::Permutationc::GSL_EZERODIV; | ||
| 179 | *GSL_EBADTOL = *Math::GSL::Permutationc::GSL_EBADTOL; | ||
| 180 | *GSL_ETOL = *Math::GSL::Permutationc::GSL_ETOL; | ||
| 181 | *GSL_EUNDRFLW = *Math::GSL::Permutationc::GSL_EUNDRFLW; | ||
| 182 | *GSL_EOVRFLW = *Math::GSL::Permutationc::GSL_EOVRFLW; | ||
| 183 | *GSL_ELOSS = *Math::GSL::Permutationc::GSL_ELOSS; | ||
| 184 | *GSL_EROUND = *Math::GSL::Permutationc::GSL_EROUND; | ||
| 185 | *GSL_EBADLEN = *Math::GSL::Permutationc::GSL_EBADLEN; | ||
| 186 | *GSL_ENOTSQR = *Math::GSL::Permutationc::GSL_ENOTSQR; | ||
| 187 | *GSL_ESING = *Math::GSL::Permutationc::GSL_ESING; | ||
| 188 | *GSL_EDIVERGE = *Math::GSL::Permutationc::GSL_EDIVERGE; | ||
| 189 | *GSL_EUNSUP = *Math::GSL::Permutationc::GSL_EUNSUP; | ||
| 190 | *GSL_EUNIMPL = *Math::GSL::Permutationc::GSL_EUNIMPL; | ||
| 191 | *GSL_ECACHE = *Math::GSL::Permutationc::GSL_ECACHE; | ||
| 192 | *GSL_ETABLE = *Math::GSL::Permutationc::GSL_ETABLE; | ||
| 193 | *GSL_ENOPROG = *Math::GSL::Permutationc::GSL_ENOPROG; | ||
| 194 | *GSL_ENOPROGJ = *Math::GSL::Permutationc::GSL_ENOPROGJ; | ||
| 195 | *GSL_ETOLF = *Math::GSL::Permutationc::GSL_ETOLF; | ||
| 196 | *GSL_ETOLX = *Math::GSL::Permutationc::GSL_ETOLX; | ||
| 197 | *GSL_ETOLG = *Math::GSL::Permutationc::GSL_ETOLG; | ||
| 198 | *GSL_EOF = *Math::GSL::Permutationc::GSL_EOF; | ||
| 199 | |||
| 200 | @EXPORT_OK = qw/ | ||
| 201 | gsl_permutation_alloc | ||
| 202 | gsl_permutation_calloc | ||
| 203 | gsl_permutation_init | ||
| 204 | gsl_permutation_free | ||
| 205 | gsl_permutation_memcpy | ||
| 206 | gsl_permutation_fread | ||
| 207 | gsl_permutation_fwrite | ||
| 208 | gsl_permutation_fscanf | ||
| 209 | gsl_permutation_fprintf | ||
| 210 | gsl_permutation_size | ||
| 211 | gsl_permutation_data | ||
| 212 | gsl_permutation_get | ||
| 213 | gsl_permutation_swap | ||
| 214 | gsl_permutation_valid | ||
| 215 | gsl_permutation_reverse | ||
| 216 | gsl_permutation_inverse | ||
| 217 | gsl_permutation_next | ||
| 218 | gsl_permutation_prev | ||
| 219 | gsl_permutation_mul | ||
| 220 | gsl_permutation_linear_to_canonical | ||
| 221 | gsl_permutation_canonical_to_linear | ||
| 222 | gsl_permutation_inversions | ||
| 223 | gsl_permutation_linear_cycles | ||
| 224 | gsl_permutation_canonical_cycles | ||
| 225 | gsl_permute | ||
| 226 | gsl_permute_inverse | ||
| 227 | gsl_permute_int | ||
| 228 | gsl_permute_int_inverse | ||
| 229 | gsl_permute_vector | ||
| 230 | gsl_permute_vector_inverse | ||
| 231 | gsl_permute_vector_int | ||
| 232 | gsl_permute_vector_int_inverse | ||
| 233 | /; | ||
| 234 | %EXPORT_TAGS = ( all => [ @EXPORT_OK ] ); | ||
| 235 | |||
| 236 | ### wrapper interface ### | ||
| 237 | sub new { | ||
| 238 | my ($class, $value) = @_; | ||
| 239 | my $this = {}; | ||
| 240 | $this->{_length} = $value; | ||
| 241 | $this->{_permutation} = gsl_permutation_calloc($value); | ||
| 242 | bless $this, $class; | ||
| 243 | } | ||
| 244 | |||
| 245 | sub as_list { | ||
| 246 | my $self=shift; | ||
| 247 | $self->get( [ 0 .. $self->length - 1 ] ); | ||
| 248 | } | ||
| 249 | |||
| 250 | sub get { | ||
| 251 | my ($self, $indices) = @_; | ||
| 252 | return map { gsl_permutation_get($self->{_permutation}, $_ ) } @$indices ; | ||
| 253 | } | ||
| 254 | |||
| 255 | sub raw { (shift)->{_permutation} } | ||
| 256 | sub length { (shift)->{_length} } | ||
| 257 | |||
| 258 | |||
| 259 | |||
| 260 | |||
| 261 | __END__ |