blib/lib/Math/GSL/Matrix.pm untested

filter: Statementstmt 0.0% 0 / 1217 Branchbran 0.0% 0 / 250 Conditioncond 0.0% 0 / 90 MC/DCmcdc 0.0% 0 / 50 Subroutinesub 0.0% 0 / 159 Podpod 0.0% 0 / 121 totaltotal 0.0% 0 / 1887 CC 126 SCAR 23.2
CC
126
Cov
0%
read
30.0
DESTROY
20.0
DESTROY
20.0
CRAP 10.2
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::Matrix;
8 use base qw(Exporter);
9 use base qw(DynaLoader);
10 package Math::GSL::Matrixc;
11 bootstrap Math::GSL::Matrix;
12 package Math::GSL::Matrix;
13 @EXPORT = qw();
14  
15 # ---------- BASE METHODS -------------
16  
17 package Math::GSL::Matrix;
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::Matrix;
51  
52 *gsl_error = *Math::GSL::Matrixc::gsl_error;
53 *gsl_stream_printf = *Math::GSL::Matrixc::gsl_stream_printf;
54 *gsl_strerror = *Math::GSL::Matrixc::gsl_strerror;
55 *gsl_set_error_handler = *Math::GSL::Matrixc::gsl_set_error_handler;
56 *gsl_set_error_handler_off = *Math::GSL::Matrixc::gsl_set_error_handler_off;
57 *gsl_set_stream_handler = *Math::GSL::Matrixc::gsl_set_stream_handler;
58 *gsl_set_stream = *Math::GSL::Matrixc::gsl_set_stream;
59 *gsl_vector_alloc = *Math::GSL::Matrixc::gsl_vector_alloc;
60 *gsl_vector_calloc = *Math::GSL::Matrixc::gsl_vector_calloc;
61 *gsl_vector_alloc_from_block = *Math::GSL::Matrixc::gsl_vector_alloc_from_block;
62 *gsl_vector_alloc_from_vector = *Math::GSL::Matrixc::gsl_vector_alloc_from_vector;
63 *gsl_vector_free = *Math::GSL::Matrixc::gsl_vector_free;
64 *gsl_vector_view_array = *Math::GSL::Matrixc::gsl_vector_view_array;
65 *gsl_vector_view_array_with_stride = *Math::GSL::Matrixc::gsl_vector_view_array_with_stride;
66 *gsl_vector_const_view_array = *Math::GSL::Matrixc::gsl_vector_const_view_array;
67 *gsl_vector_const_view_array_with_stride = *Math::GSL::Matrixc::gsl_vector_const_view_array_with_stride;
68 *gsl_vector_subvector = *Math::GSL::Matrixc::gsl_vector_subvector;
69 *gsl_vector_subvector_with_stride = *Math::GSL::Matrixc::gsl_vector_subvector_with_stride;
70 *gsl_vector_const_subvector = *Math::GSL::Matrixc::gsl_vector_const_subvector;
71 *gsl_vector_const_subvector_with_stride = *Math::GSL::Matrixc::gsl_vector_const_subvector_with_stride;
72 *gsl_vector_set_zero = *Math::GSL::Matrixc::gsl_vector_set_zero;
73 *gsl_vector_set_all = *Math::GSL::Matrixc::gsl_vector_set_all;
74 *gsl_vector_set_basis = *Math::GSL::Matrixc::gsl_vector_set_basis;
75 *gsl_vector_fread = *Math::GSL::Matrixc::gsl_vector_fread;
76 *gsl_vector_fwrite = *Math::GSL::Matrixc::gsl_vector_fwrite;
77 *gsl_vector_fscanf = *Math::GSL::Matrixc::gsl_vector_fscanf;
78 *gsl_vector_fprintf = *Math::GSL::Matrixc::gsl_vector_fprintf;
79 *gsl_vector_memcpy = *Math::GSL::Matrixc::gsl_vector_memcpy;
80 *gsl_vector_reverse = *Math::GSL::Matrixc::gsl_vector_reverse;
81 *gsl_vector_swap = *Math::GSL::Matrixc::gsl_vector_swap;
82 *gsl_vector_swap_elements = *Math::GSL::Matrixc::gsl_vector_swap_elements;
83 *gsl_vector_max = *Math::GSL::Matrixc::gsl_vector_max;
84 *gsl_vector_min = *Math::GSL::Matrixc::gsl_vector_min;
85 *gsl_vector_minmax = *Math::GSL::Matrixc::gsl_vector_minmax;
86 *gsl_vector_max_index = *Math::GSL::Matrixc::gsl_vector_max_index;
87 *gsl_vector_min_index = *Math::GSL::Matrixc::gsl_vector_min_index;
88 *gsl_vector_minmax_index = *Math::GSL::Matrixc::gsl_vector_minmax_index;
89 *gsl_vector_add = *Math::GSL::Matrixc::gsl_vector_add;
90 *gsl_vector_sub = *Math::GSL::Matrixc::gsl_vector_sub;
91 *gsl_vector_mul = *Math::GSL::Matrixc::gsl_vector_mul;
92 *gsl_vector_div = *Math::GSL::Matrixc::gsl_vector_div;
93 *gsl_vector_scale = *Math::GSL::Matrixc::gsl_vector_scale;
94 *gsl_vector_add_constant = *Math::GSL::Matrixc::gsl_vector_add_constant;
95 *gsl_vector_axpby = *Math::GSL::Matrixc::gsl_vector_axpby;
96 *gsl_vector_sum = *Math::GSL::Matrixc::gsl_vector_sum;
97 *gsl_vector_equal = *Math::GSL::Matrixc::gsl_vector_equal;
98 *gsl_vector_isnull = *Math::GSL::Matrixc::gsl_vector_isnull;
99 *gsl_vector_ispos = *Math::GSL::Matrixc::gsl_vector_ispos;
100 *gsl_vector_isneg = *Math::GSL::Matrixc::gsl_vector_isneg;
101 *gsl_vector_isnonneg = *Math::GSL::Matrixc::gsl_vector_isnonneg;
102 *gsl_vector_get = *Math::GSL::Matrixc::gsl_vector_get;
103 *gsl_vector_set = *Math::GSL::Matrixc::gsl_vector_set;
104 *gsl_vector_ptr = *Math::GSL::Matrixc::gsl_vector_ptr;
105 *gsl_vector_const_ptr = *Math::GSL::Matrixc::gsl_vector_const_ptr;
106 *gsl_matrix_alloc = *Math::GSL::Matrixc::gsl_matrix_alloc;
107 *gsl_matrix_calloc = *Math::GSL::Matrixc::gsl_matrix_calloc;
108 *gsl_matrix_alloc_from_block = *Math::GSL::Matrixc::gsl_matrix_alloc_from_block;
109 *gsl_matrix_alloc_from_matrix = *Math::GSL::Matrixc::gsl_matrix_alloc_from_matrix;
110 *gsl_vector_alloc_row_from_matrix = *Math::GSL::Matrixc::gsl_vector_alloc_row_from_matrix;
111 *gsl_vector_alloc_col_from_matrix = *Math::GSL::Matrixc::gsl_vector_alloc_col_from_matrix;
112 *gsl_matrix_free = *Math::GSL::Matrixc::gsl_matrix_free;
113 *gsl_matrix_submatrix = *Math::GSL::Matrixc::gsl_matrix_submatrix;
114 *gsl_matrix_row = *Math::GSL::Matrixc::gsl_matrix_row;
115 *gsl_matrix_column = *Math::GSL::Matrixc::gsl_matrix_column;
116 *gsl_matrix_diagonal = *Math::GSL::Matrixc::gsl_matrix_diagonal;
117 *gsl_matrix_subdiagonal = *Math::GSL::Matrixc::gsl_matrix_subdiagonal;
118 *gsl_matrix_superdiagonal = *Math::GSL::Matrixc::gsl_matrix_superdiagonal;
119 *gsl_matrix_subrow = *Math::GSL::Matrixc::gsl_matrix_subrow;
120 *gsl_matrix_subcolumn = *Math::GSL::Matrixc::gsl_matrix_subcolumn;
121 *gsl_matrix_view_array = *Math::GSL::Matrixc::gsl_matrix_view_array;
122 *gsl_matrix_view_array_with_tda = *Math::GSL::Matrixc::gsl_matrix_view_array_with_tda;
123 *gsl_matrix_view_vector = *Math::GSL::Matrixc::gsl_matrix_view_vector;
124 *gsl_matrix_view_vector_with_tda = *Math::GSL::Matrixc::gsl_matrix_view_vector_with_tda;
125 *gsl_matrix_const_submatrix = *Math::GSL::Matrixc::gsl_matrix_const_submatrix;
126 *gsl_matrix_const_row = *Math::GSL::Matrixc::gsl_matrix_const_row;
127 *gsl_matrix_const_column = *Math::GSL::Matrixc::gsl_matrix_const_column;
128 *gsl_matrix_const_diagonal = *Math::GSL::Matrixc::gsl_matrix_const_diagonal;
129 *gsl_matrix_const_subdiagonal = *Math::GSL::Matrixc::gsl_matrix_const_subdiagonal;
130 *gsl_matrix_const_superdiagonal = *Math::GSL::Matrixc::gsl_matrix_const_superdiagonal;
131 *gsl_matrix_const_subrow = *Math::GSL::Matrixc::gsl_matrix_const_subrow;
132 *gsl_matrix_const_subcolumn = *Math::GSL::Matrixc::gsl_matrix_const_subcolumn;
133 *gsl_matrix_const_view_array = *Math::GSL::Matrixc::gsl_matrix_const_view_array;
134 *gsl_matrix_const_view_array_with_tda = *Math::GSL::Matrixc::gsl_matrix_const_view_array_with_tda;
135 *gsl_matrix_const_view_vector = *Math::GSL::Matrixc::gsl_matrix_const_view_vector;
136 *gsl_matrix_const_view_vector_with_tda = *Math::GSL::Matrixc::gsl_matrix_const_view_vector_with_tda;
137 *gsl_matrix_set_zero = *Math::GSL::Matrixc::gsl_matrix_set_zero;
138 *gsl_matrix_set_identity = *Math::GSL::Matrixc::gsl_matrix_set_identity;
139 *gsl_matrix_set_all = *Math::GSL::Matrixc::gsl_matrix_set_all;
140 *gsl_matrix_fread = *Math::GSL::Matrixc::gsl_matrix_fread;
141 *gsl_matrix_fwrite = *Math::GSL::Matrixc::gsl_matrix_fwrite;
142 *gsl_matrix_fscanf = *Math::GSL::Matrixc::gsl_matrix_fscanf;
143 *gsl_matrix_fprintf = *Math::GSL::Matrixc::gsl_matrix_fprintf;
144 *gsl_matrix_memcpy = *Math::GSL::Matrixc::gsl_matrix_memcpy;
145 *gsl_matrix_swap = *Math::GSL::Matrixc::gsl_matrix_swap;
146 *gsl_matrix_tricpy = *Math::GSL::Matrixc::gsl_matrix_tricpy;
147 *gsl_matrix_swap_rows = *Math::GSL::Matrixc::gsl_matrix_swap_rows;
148 *gsl_matrix_swap_columns = *Math::GSL::Matrixc::gsl_matrix_swap_columns;
149 *gsl_matrix_swap_rowcol = *Math::GSL::Matrixc::gsl_matrix_swap_rowcol;
150 *gsl_matrix_transpose = *Math::GSL::Matrixc::gsl_matrix_transpose;
151 *gsl_matrix_transpose_memcpy = *Math::GSL::Matrixc::gsl_matrix_transpose_memcpy;
152 *gsl_matrix_transpose_tricpy = *Math::GSL::Matrixc::gsl_matrix_transpose_tricpy;
153 *gsl_matrix_max = *Math::GSL::Matrixc::gsl_matrix_max;
154 *gsl_matrix_min = *Math::GSL::Matrixc::gsl_matrix_min;
155 *gsl_matrix_minmax = *Math::GSL::Matrixc::gsl_matrix_minmax;
156 *gsl_matrix_max_index = *Math::GSL::Matrixc::gsl_matrix_max_index;
157 *gsl_matrix_min_index = *Math::GSL::Matrixc::gsl_matrix_min_index;
158 *gsl_matrix_minmax_index = *Math::GSL::Matrixc::gsl_matrix_minmax_index;
159 *gsl_matrix_equal = *Math::GSL::Matrixc::gsl_matrix_equal;
160 *gsl_matrix_isnull = *Math::GSL::Matrixc::gsl_matrix_isnull;
161 *gsl_matrix_ispos = *Math::GSL::Matrixc::gsl_matrix_ispos;
162 *gsl_matrix_isneg = *Math::GSL::Matrixc::gsl_matrix_isneg;
163 *gsl_matrix_isnonneg = *Math::GSL::Matrixc::gsl_matrix_isnonneg;
164 *gsl_matrix_norm1 = *Math::GSL::Matrixc::gsl_matrix_norm1;
165 *gsl_matrix_add = *Math::GSL::Matrixc::gsl_matrix_add;
166 *gsl_matrix_sub = *Math::GSL::Matrixc::gsl_matrix_sub;
167 *gsl_matrix_mul_elements = *Math::GSL::Matrixc::gsl_matrix_mul_elements;
168 *gsl_matrix_div_elements = *Math::GSL::Matrixc::gsl_matrix_div_elements;
169 *gsl_matrix_scale = *Math::GSL::Matrixc::gsl_matrix_scale;
170 *gsl_matrix_scale_rows = *Math::GSL::Matrixc::gsl_matrix_scale_rows;
171 *gsl_matrix_scale_columns = *Math::GSL::Matrixc::gsl_matrix_scale_columns;
172 *gsl_matrix_add_constant = *Math::GSL::Matrixc::gsl_matrix_add_constant;
173 *gsl_matrix_add_diagonal = *Math::GSL::Matrixc::gsl_matrix_add_diagonal;
174 *gsl_matrix_get_row = *Math::GSL::Matrixc::gsl_matrix_get_row;
175 *gsl_matrix_get_col = *Math::GSL::Matrixc::gsl_matrix_get_col;
176 *gsl_matrix_set_row = *Math::GSL::Matrixc::gsl_matrix_set_row;
177 *gsl_matrix_set_col = *Math::GSL::Matrixc::gsl_matrix_set_col;
178 *gsl_matrix_get = *Math::GSL::Matrixc::gsl_matrix_get;
179 *gsl_matrix_set = *Math::GSL::Matrixc::gsl_matrix_set;
180 *gsl_matrix_ptr = *Math::GSL::Matrixc::gsl_matrix_ptr;
181 *gsl_matrix_const_ptr = *Math::GSL::Matrixc::gsl_matrix_const_ptr;
182 *gsl_matrix_int_alloc = *Math::GSL::Matrixc::gsl_matrix_int_alloc;
183 *gsl_matrix_int_calloc = *Math::GSL::Matrixc::gsl_matrix_int_calloc;
184 *gsl_matrix_int_alloc_from_block = *Math::GSL::Matrixc::gsl_matrix_int_alloc_from_block;
185 *gsl_matrix_int_alloc_from_matrix = *Math::GSL::Matrixc::gsl_matrix_int_alloc_from_matrix;
186 *gsl_vector_int_alloc_row_from_matrix = *Math::GSL::Matrixc::gsl_vector_int_alloc_row_from_matrix;
187 *gsl_vector_int_alloc_col_from_matrix = *Math::GSL::Matrixc::gsl_vector_int_alloc_col_from_matrix;
188 *gsl_matrix_int_free = *Math::GSL::Matrixc::gsl_matrix_int_free;
189 *gsl_matrix_int_submatrix = *Math::GSL::Matrixc::gsl_matrix_int_submatrix;
190 *gsl_matrix_int_row = *Math::GSL::Matrixc::gsl_matrix_int_row;
191 *gsl_matrix_int_column = *Math::GSL::Matrixc::gsl_matrix_int_column;
192 *gsl_matrix_int_diagonal = *Math::GSL::Matrixc::gsl_matrix_int_diagonal;
193 *gsl_matrix_int_subdiagonal = *Math::GSL::Matrixc::gsl_matrix_int_subdiagonal;
194 *gsl_matrix_int_superdiagonal = *Math::GSL::Matrixc::gsl_matrix_int_superdiagonal;
195 *gsl_matrix_int_subrow = *Math::GSL::Matrixc::gsl_matrix_int_subrow;
196 *gsl_matrix_int_subcolumn = *Math::GSL::Matrixc::gsl_matrix_int_subcolumn;
197 *gsl_matrix_int_view_array = *Math::GSL::Matrixc::gsl_matrix_int_view_array;
198 *gsl_matrix_int_view_array_with_tda = *Math::GSL::Matrixc::gsl_matrix_int_view_array_with_tda;
199 *gsl_matrix_int_view_vector = *Math::GSL::Matrixc::gsl_matrix_int_view_vector;
200 *gsl_matrix_int_view_vector_with_tda = *Math::GSL::Matrixc::gsl_matrix_int_view_vector_with_tda;
201 *gsl_matrix_int_const_submatrix = *Math::GSL::Matrixc::gsl_matrix_int_const_submatrix;
202 *gsl_matrix_int_const_row = *Math::GSL::Matrixc::gsl_matrix_int_const_row;
203 *gsl_matrix_int_const_column = *Math::GSL::Matrixc::gsl_matrix_int_const_column;
204 *gsl_matrix_int_const_diagonal = *Math::GSL::Matrixc::gsl_matrix_int_const_diagonal;
205 *gsl_matrix_int_const_subdiagonal = *Math::GSL::Matrixc::gsl_matrix_int_const_subdiagonal;
206 *gsl_matrix_int_const_superdiagonal = *Math::GSL::Matrixc::gsl_matrix_int_const_superdiagonal;
207 *gsl_matrix_int_const_subrow = *Math::GSL::Matrixc::gsl_matrix_int_const_subrow;
208 *gsl_matrix_int_const_subcolumn = *Math::GSL::Matrixc::gsl_matrix_int_const_subcolumn;
209 *gsl_matrix_int_const_view_array = *Math::GSL::Matrixc::gsl_matrix_int_const_view_array;
210 *gsl_matrix_int_const_view_array_with_tda = *Math::GSL::Matrixc::gsl_matrix_int_const_view_array_with_tda;
211 *gsl_matrix_int_const_view_vector = *Math::GSL::Matrixc::gsl_matrix_int_const_view_vector;
212 *gsl_matrix_int_const_view_vector_with_tda = *Math::GSL::Matrixc::gsl_matrix_int_const_view_vector_with_tda;
213 *gsl_matrix_int_set_zero = *Math::GSL::Matrixc::gsl_matrix_int_set_zero;
214 *gsl_matrix_int_set_identity = *Math::GSL::Matrixc::gsl_matrix_int_set_identity;
215 *gsl_matrix_int_set_all = *Math::GSL::Matrixc::gsl_matrix_int_set_all;
216 *gsl_matrix_int_fread = *Math::GSL::Matrixc::gsl_matrix_int_fread;
217 *gsl_matrix_int_fwrite = *Math::GSL::Matrixc::gsl_matrix_int_fwrite;
218 *gsl_matrix_int_fscanf = *Math::GSL::Matrixc::gsl_matrix_int_fscanf;
219 *gsl_matrix_int_fprintf = *Math::GSL::Matrixc::gsl_matrix_int_fprintf;
220 *gsl_matrix_int_memcpy = *Math::GSL::Matrixc::gsl_matrix_int_memcpy;
221 *gsl_matrix_int_swap = *Math::GSL::Matrixc::gsl_matrix_int_swap;
222 *gsl_matrix_int_tricpy = *Math::GSL::Matrixc::gsl_matrix_int_tricpy;
223 *gsl_matrix_int_swap_rows = *Math::GSL::Matrixc::gsl_matrix_int_swap_rows;
224 *gsl_matrix_int_swap_columns = *Math::GSL::Matrixc::gsl_matrix_int_swap_columns;
225 *gsl_matrix_int_swap_rowcol = *Math::GSL::Matrixc::gsl_matrix_int_swap_rowcol;
226 *gsl_matrix_int_transpose = *Math::GSL::Matrixc::gsl_matrix_int_transpose;
227 *gsl_matrix_int_transpose_memcpy = *Math::GSL::Matrixc::gsl_matrix_int_transpose_memcpy;
228 *gsl_matrix_int_transpose_tricpy = *Math::GSL::Matrixc::gsl_matrix_int_transpose_tricpy;
229 *gsl_matrix_int_max = *Math::GSL::Matrixc::gsl_matrix_int_max;
230 *gsl_matrix_int_min = *Math::GSL::Matrixc::gsl_matrix_int_min;
231 *gsl_matrix_int_minmax = *Math::GSL::Matrixc::gsl_matrix_int_minmax;
232 *gsl_matrix_int_max_index = *Math::GSL::Matrixc::gsl_matrix_int_max_index;
233 *gsl_matrix_int_min_index = *Math::GSL::Matrixc::gsl_matrix_int_min_index;
234 *gsl_matrix_int_minmax_index = *Math::GSL::Matrixc::gsl_matrix_int_minmax_index;
235 *gsl_matrix_int_equal = *Math::GSL::Matrixc::gsl_matrix_int_equal;
236 *gsl_matrix_int_isnull = *Math::GSL::Matrixc::gsl_matrix_int_isnull;
237 *gsl_matrix_int_ispos = *Math::GSL::Matrixc::gsl_matrix_int_ispos;
238 *gsl_matrix_int_isneg = *Math::GSL::Matrixc::gsl_matrix_int_isneg;
239 *gsl_matrix_int_isnonneg = *Math::GSL::Matrixc::gsl_matrix_int_isnonneg;
240 *gsl_matrix_int_norm1 = *Math::GSL::Matrixc::gsl_matrix_int_norm1;
241 *gsl_matrix_int_add = *Math::GSL::Matrixc::gsl_matrix_int_add;
242 *gsl_matrix_int_sub = *Math::GSL::Matrixc::gsl_matrix_int_sub;
243 *gsl_matrix_int_mul_elements = *Math::GSL::Matrixc::gsl_matrix_int_mul_elements;
244 *gsl_matrix_int_div_elements = *Math::GSL::Matrixc::gsl_matrix_int_div_elements;
245 *gsl_matrix_int_scale = *Math::GSL::Matrixc::gsl_matrix_int_scale;
246 *gsl_matrix_int_scale_rows = *Math::GSL::Matrixc::gsl_matrix_int_scale_rows;
247 *gsl_matrix_int_scale_columns = *Math::GSL::Matrixc::gsl_matrix_int_scale_columns;
248 *gsl_matrix_int_add_constant = *Math::GSL::Matrixc::gsl_matrix_int_add_constant;
249 *gsl_matrix_int_add_diagonal = *Math::GSL::Matrixc::gsl_matrix_int_add_diagonal;
250 *gsl_matrix_int_get_row = *Math::GSL::Matrixc::gsl_matrix_int_get_row;
251 *gsl_matrix_int_get_col = *Math::GSL::Matrixc::gsl_matrix_int_get_col;
252 *gsl_matrix_int_set_row = *Math::GSL::Matrixc::gsl_matrix_int_set_row;
253 *gsl_matrix_int_set_col = *Math::GSL::Matrixc::gsl_matrix_int_set_col;
254 *gsl_matrix_int_get = *Math::GSL::Matrixc::gsl_matrix_int_get;
255 *gsl_matrix_int_set = *Math::GSL::Matrixc::gsl_matrix_int_set;
256 *gsl_matrix_int_ptr = *Math::GSL::Matrixc::gsl_matrix_int_ptr;
257 *gsl_matrix_int_const_ptr = *Math::GSL::Matrixc::gsl_matrix_int_const_ptr;
258 *gsl_matrix_complex_alloc = *Math::GSL::Matrixc::gsl_matrix_complex_alloc;
259 *gsl_matrix_complex_calloc = *Math::GSL::Matrixc::gsl_matrix_complex_calloc;
260 *gsl_matrix_complex_alloc_from_block = *Math::GSL::Matrixc::gsl_matrix_complex_alloc_from_block;
261 *gsl_matrix_complex_alloc_from_matrix = *Math::GSL::Matrixc::gsl_matrix_complex_alloc_from_matrix;
262 *gsl_vector_complex_alloc_row_from_matrix = *Math::GSL::Matrixc::gsl_vector_complex_alloc_row_from_matrix;
263 *gsl_vector_complex_alloc_col_from_matrix = *Math::GSL::Matrixc::gsl_vector_complex_alloc_col_from_matrix;
264 *gsl_matrix_complex_free = *Math::GSL::Matrixc::gsl_matrix_complex_free;
265 *gsl_matrix_complex_submatrix = *Math::GSL::Matrixc::gsl_matrix_complex_submatrix;
266 *gsl_matrix_complex_row = *Math::GSL::Matrixc::gsl_matrix_complex_row;
267 *gsl_matrix_complex_column = *Math::GSL::Matrixc::gsl_matrix_complex_column;
268 *gsl_matrix_complex_diagonal = *Math::GSL::Matrixc::gsl_matrix_complex_diagonal;
269 *gsl_matrix_complex_subdiagonal = *Math::GSL::Matrixc::gsl_matrix_complex_subdiagonal;
270 *gsl_matrix_complex_superdiagonal = *Math::GSL::Matrixc::gsl_matrix_complex_superdiagonal;
271 *gsl_matrix_complex_subrow = *Math::GSL::Matrixc::gsl_matrix_complex_subrow;
272 *gsl_matrix_complex_subcolumn = *Math::GSL::Matrixc::gsl_matrix_complex_subcolumn;
273 *gsl_matrix_complex_view_array = *Math::GSL::Matrixc::gsl_matrix_complex_view_array;
274 *gsl_matrix_complex_view_array_with_tda = *Math::GSL::Matrixc::gsl_matrix_complex_view_array_with_tda;
275 *gsl_matrix_complex_view_vector = *Math::GSL::Matrixc::gsl_matrix_complex_view_vector;
276 *gsl_matrix_complex_view_vector_with_tda = *Math::GSL::Matrixc::gsl_matrix_complex_view_vector_with_tda;
277 *gsl_matrix_complex_const_submatrix = *Math::GSL::Matrixc::gsl_matrix_complex_const_submatrix;
278 *gsl_matrix_complex_const_row = *Math::GSL::Matrixc::gsl_matrix_complex_const_row;
279 *gsl_matrix_complex_const_column = *Math::GSL::Matrixc::gsl_matrix_complex_const_column;
280 *gsl_matrix_complex_const_diagonal = *Math::GSL::Matrixc::gsl_matrix_complex_const_diagonal;
281 *gsl_matrix_complex_const_subdiagonal = *Math::GSL::Matrixc::gsl_matrix_complex_const_subdiagonal;
282 *gsl_matrix_complex_const_superdiagonal = *Math::GSL::Matrixc::gsl_matrix_complex_const_superdiagonal;
283 *gsl_matrix_complex_const_subrow = *Math::GSL::Matrixc::gsl_matrix_complex_const_subrow;
284 *gsl_matrix_complex_const_subcolumn = *Math::GSL::Matrixc::gsl_matrix_complex_const_subcolumn;
285 *gsl_matrix_complex_const_view_array = *Math::GSL::Matrixc::gsl_matrix_complex_const_view_array;
286 *gsl_matrix_complex_const_view_array_with_tda = *Math::GSL::Matrixc::gsl_matrix_complex_const_view_array_with_tda;
287 *gsl_matrix_complex_const_view_vector = *Math::GSL::Matrixc::gsl_matrix_complex_const_view_vector;
288 *gsl_matrix_complex_const_view_vector_with_tda = *Math::GSL::Matrixc::gsl_matrix_complex_const_view_vector_with_tda;
289 *gsl_matrix_complex_set_zero = *Math::GSL::Matrixc::gsl_matrix_complex_set_zero;
290 *gsl_matrix_complex_set_identity = *Math::GSL::Matrixc::gsl_matrix_complex_set_identity;
291 *gsl_matrix_complex_set_all = *Math::GSL::Matrixc::gsl_matrix_complex_set_all;
292 *gsl_matrix_complex_fread = *Math::GSL::Matrixc::gsl_matrix_complex_fread;
293 *gsl_matrix_complex_fwrite = *Math::GSL::Matrixc::gsl_matrix_complex_fwrite;
294 *gsl_matrix_complex_fscanf = *Math::GSL::Matrixc::gsl_matrix_complex_fscanf;
295 *gsl_matrix_complex_fprintf = *Math::GSL::Matrixc::gsl_matrix_complex_fprintf;
296 *gsl_matrix_complex_memcpy = *Math::GSL::Matrixc::gsl_matrix_complex_memcpy;
297 *gsl_matrix_complex_swap = *Math::GSL::Matrixc::gsl_matrix_complex_swap;
298 *gsl_matrix_complex_tricpy = *Math::GSL::Matrixc::gsl_matrix_complex_tricpy;
299 *gsl_matrix_complex_swap_rows = *Math::GSL::Matrixc::gsl_matrix_complex_swap_rows;
300 *gsl_matrix_complex_swap_columns = *Math::GSL::Matrixc::gsl_matrix_complex_swap_columns;
301 *gsl_matrix_complex_swap_rowcol = *Math::GSL::Matrixc::gsl_matrix_complex_swap_rowcol;
302 *gsl_matrix_complex_transpose = *Math::GSL::Matrixc::gsl_matrix_complex_transpose;
303 *gsl_matrix_complex_transpose_memcpy = *Math::GSL::Matrixc::gsl_matrix_complex_transpose_memcpy;
304 *gsl_matrix_complex_transpose_tricpy = *Math::GSL::Matrixc::gsl_matrix_complex_transpose_tricpy;
305 *gsl_matrix_complex_conjtrans_memcpy = *Math::GSL::Matrixc::gsl_matrix_complex_conjtrans_memcpy;
306 *gsl_matrix_complex_equal = *Math::GSL::Matrixc::gsl_matrix_complex_equal;
307 *gsl_matrix_complex_isnull = *Math::GSL::Matrixc::gsl_matrix_complex_isnull;
308 *gsl_matrix_complex_ispos = *Math::GSL::Matrixc::gsl_matrix_complex_ispos;
309 *gsl_matrix_complex_isneg = *Math::GSL::Matrixc::gsl_matrix_complex_isneg;
310 *gsl_matrix_complex_isnonneg = *Math::GSL::Matrixc::gsl_matrix_complex_isnonneg;
311 *gsl_matrix_complex_add = *Math::GSL::Matrixc::gsl_matrix_complex_add;
312 *gsl_matrix_complex_sub = *Math::GSL::Matrixc::gsl_matrix_complex_sub;
313 *gsl_matrix_complex_mul_elements = *Math::GSL::Matrixc::gsl_matrix_complex_mul_elements;
314 *gsl_matrix_complex_div_elements = *Math::GSL::Matrixc::gsl_matrix_complex_div_elements;
315 *gsl_matrix_complex_scale = *Math::GSL::Matrixc::gsl_matrix_complex_scale;
316 *gsl_matrix_complex_scale_rows = *Math::GSL::Matrixc::gsl_matrix_complex_scale_rows;
317 *gsl_matrix_complex_scale_columns = *Math::GSL::Matrixc::gsl_matrix_complex_scale_columns;
318 *gsl_matrix_complex_add_constant = *Math::GSL::Matrixc::gsl_matrix_complex_add_constant;
319 *gsl_matrix_complex_add_diagonal = *Math::GSL::Matrixc::gsl_matrix_complex_add_diagonal;
320 *gsl_matrix_complex_conjugate = *Math::GSL::Matrixc::gsl_matrix_complex_conjugate;
321 *gsl_matrix_complex_get_row = *Math::GSL::Matrixc::gsl_matrix_complex_get_row;
322 *gsl_matrix_complex_get_col = *Math::GSL::Matrixc::gsl_matrix_complex_get_col;
323 *gsl_matrix_complex_set_row = *Math::GSL::Matrixc::gsl_matrix_complex_set_row;
324 *gsl_matrix_complex_set_col = *Math::GSL::Matrixc::gsl_matrix_complex_set_col;
325 *gsl_matrix_complex_get = *Math::GSL::Matrixc::gsl_matrix_complex_get;
326 *gsl_matrix_complex_set = *Math::GSL::Matrixc::gsl_matrix_complex_set;
327 *gsl_matrix_complex_ptr = *Math::GSL::Matrixc::gsl_matrix_complex_ptr;
328 *gsl_matrix_complex_const_ptr = *Math::GSL::Matrixc::gsl_matrix_complex_const_ptr;
329 *gsl_matrix_char_alloc = *Math::GSL::Matrixc::gsl_matrix_char_alloc;
330 *gsl_matrix_char_calloc = *Math::GSL::Matrixc::gsl_matrix_char_calloc;
331 *gsl_matrix_char_alloc_from_block = *Math::GSL::Matrixc::gsl_matrix_char_alloc_from_block;
332 *gsl_matrix_char_alloc_from_matrix = *Math::GSL::Matrixc::gsl_matrix_char_alloc_from_matrix;
333 *gsl_vector_char_alloc_row_from_matrix = *Math::GSL::Matrixc::gsl_vector_char_alloc_row_from_matrix;
334 *gsl_vector_char_alloc_col_from_matrix = *Math::GSL::Matrixc::gsl_vector_char_alloc_col_from_matrix;
335 *gsl_matrix_char_free = *Math::GSL::Matrixc::gsl_matrix_char_free;
336 *gsl_matrix_char_submatrix = *Math::GSL::Matrixc::gsl_matrix_char_submatrix;
337 *gsl_matrix_char_row = *Math::GSL::Matrixc::gsl_matrix_char_row;
338 *gsl_matrix_char_column = *Math::GSL::Matrixc::gsl_matrix_char_column;
339 *gsl_matrix_char_diagonal = *Math::GSL::Matrixc::gsl_matrix_char_diagonal;
340 *gsl_matrix_char_subdiagonal = *Math::GSL::Matrixc::gsl_matrix_char_subdiagonal;
341 *gsl_matrix_char_superdiagonal = *Math::GSL::Matrixc::gsl_matrix_char_superdiagonal;
342 *gsl_matrix_char_subrow = *Math::GSL::Matrixc::gsl_matrix_char_subrow;
343 *gsl_matrix_char_subcolumn = *Math::GSL::Matrixc::gsl_matrix_char_subcolumn;
344 *gsl_matrix_char_view_array = *Math::GSL::Matrixc::gsl_matrix_char_view_array;
345 *gsl_matrix_char_view_array_with_tda = *Math::GSL::Matrixc::gsl_matrix_char_view_array_with_tda;
346 *gsl_matrix_char_view_vector = *Math::GSL::Matrixc::gsl_matrix_char_view_vector;
347 *gsl_matrix_char_view_vector_with_tda = *Math::GSL::Matrixc::gsl_matrix_char_view_vector_with_tda;
348 *gsl_matrix_char_const_submatrix = *Math::GSL::Matrixc::gsl_matrix_char_const_submatrix;
349 *gsl_matrix_char_const_row = *Math::GSL::Matrixc::gsl_matrix_char_const_row;
350 *gsl_matrix_char_const_column = *Math::GSL::Matrixc::gsl_matrix_char_const_column;
351 *gsl_matrix_char_const_diagonal = *Math::GSL::Matrixc::gsl_matrix_char_const_diagonal;
352 *gsl_matrix_char_const_subdiagonal = *Math::GSL::Matrixc::gsl_matrix_char_const_subdiagonal;
353 *gsl_matrix_char_const_superdiagonal = *Math::GSL::Matrixc::gsl_matrix_char_const_superdiagonal;
354 *gsl_matrix_char_const_subrow = *Math::GSL::Matrixc::gsl_matrix_char_const_subrow;
355 *gsl_matrix_char_const_subcolumn = *Math::GSL::Matrixc::gsl_matrix_char_const_subcolumn;
356 *gsl_matrix_char_const_view_array = *Math::GSL::Matrixc::gsl_matrix_char_const_view_array;
357 *gsl_matrix_char_const_view_array_with_tda = *Math::GSL::Matrixc::gsl_matrix_char_const_view_array_with_tda;
358 *gsl_matrix_char_const_view_vector = *Math::GSL::Matrixc::gsl_matrix_char_const_view_vector;
359 *gsl_matrix_char_const_view_vector_with_tda = *Math::GSL::Matrixc::gsl_matrix_char_const_view_vector_with_tda;
360 *gsl_matrix_char_set_zero = *Math::GSL::Matrixc::gsl_matrix_char_set_zero;
361 *gsl_matrix_char_set_identity = *Math::GSL::Matrixc::gsl_matrix_char_set_identity;
362 *gsl_matrix_char_set_all = *Math::GSL::Matrixc::gsl_matrix_char_set_all;
363 *gsl_matrix_char_fread = *Math::GSL::Matrixc::gsl_matrix_char_fread;
364 *gsl_matrix_char_fwrite = *Math::GSL::Matrixc::gsl_matrix_char_fwrite;
365 *gsl_matrix_char_fscanf = *Math::GSL::Matrixc::gsl_matrix_char_fscanf;
366 *gsl_matrix_char_fprintf = *Math::GSL::Matrixc::gsl_matrix_char_fprintf;
367 *gsl_matrix_char_memcpy = *Math::GSL::Matrixc::gsl_matrix_char_memcpy;
368 *gsl_matrix_char_swap = *Math::GSL::Matrixc::gsl_matrix_char_swap;
369 *gsl_matrix_char_tricpy = *Math::GSL::Matrixc::gsl_matrix_char_tricpy;
370 *gsl_matrix_char_swap_rows = *Math::GSL::Matrixc::gsl_matrix_char_swap_rows;
371 *gsl_matrix_char_swap_columns = *Math::GSL::Matrixc::gsl_matrix_char_swap_columns;
372 *gsl_matrix_char_swap_rowcol = *Math::GSL::Matrixc::gsl_matrix_char_swap_rowcol;
373 *gsl_matrix_char_transpose = *Math::GSL::Matrixc::gsl_matrix_char_transpose;
374 *gsl_matrix_char_transpose_memcpy = *Math::GSL::Matrixc::gsl_matrix_char_transpose_memcpy;
375 *gsl_matrix_char_transpose_tricpy = *Math::GSL::Matrixc::gsl_matrix_char_transpose_tricpy;
376 *gsl_matrix_char_max = *Math::GSL::Matrixc::gsl_matrix_char_max;
377 *gsl_matrix_char_min = *Math::GSL::Matrixc::gsl_matrix_char_min;
378 *gsl_matrix_char_minmax = *Math::GSL::Matrixc::gsl_matrix_char_minmax;
379 *gsl_matrix_char_max_index = *Math::GSL::Matrixc::gsl_matrix_char_max_index;
380 *gsl_matrix_char_min_index = *Math::GSL::Matrixc::gsl_matrix_char_min_index;
381 *gsl_matrix_char_minmax_index = *Math::GSL::Matrixc::gsl_matrix_char_minmax_index;
382 *gsl_matrix_char_equal = *Math::GSL::Matrixc::gsl_matrix_char_equal;
383 *gsl_matrix_char_isnull = *Math::GSL::Matrixc::gsl_matrix_char_isnull;
384 *gsl_matrix_char_ispos = *Math::GSL::Matrixc::gsl_matrix_char_ispos;
385 *gsl_matrix_char_isneg = *Math::GSL::Matrixc::gsl_matrix_char_isneg;
386 *gsl_matrix_char_isnonneg = *Math::GSL::Matrixc::gsl_matrix_char_isnonneg;
387 *gsl_matrix_char_add = *Math::GSL::Matrixc::gsl_matrix_char_add;
388 *gsl_matrix_char_sub = *Math::GSL::Matrixc::gsl_matrix_char_sub;
389 *gsl_matrix_char_mul_elements = *Math::GSL::Matrixc::gsl_matrix_char_mul_elements;
390 *gsl_matrix_char_div_elements = *Math::GSL::Matrixc::gsl_matrix_char_div_elements;
391 *gsl_matrix_char_scale = *Math::GSL::Matrixc::gsl_matrix_char_scale;
392 *gsl_matrix_char_scale_rows = *Math::GSL::Matrixc::gsl_matrix_char_scale_rows;
393 *gsl_matrix_char_scale_columns = *Math::GSL::Matrixc::gsl_matrix_char_scale_columns;
394 *gsl_matrix_char_add_constant = *Math::GSL::Matrixc::gsl_matrix_char_add_constant;
395 *gsl_matrix_char_add_diagonal = *Math::GSL::Matrixc::gsl_matrix_char_add_diagonal;
396 *gsl_matrix_char_get_row = *Math::GSL::Matrixc::gsl_matrix_char_get_row;
397 *gsl_matrix_char_get_col = *Math::GSL::Matrixc::gsl_matrix_char_get_col;
398 *gsl_matrix_char_set_row = *Math::GSL::Matrixc::gsl_matrix_char_set_row;
399 *gsl_matrix_char_set_col = *Math::GSL::Matrixc::gsl_matrix_char_set_col;
400 *gsl_matrix_char_get = *Math::GSL::Matrixc::gsl_matrix_char_get;
401 *gsl_matrix_char_set = *Math::GSL::Matrixc::gsl_matrix_char_set;
402 *gsl_matrix_char_ptr = *Math::GSL::Matrixc::gsl_matrix_char_ptr;
403 *gsl_matrix_char_const_ptr = *Math::GSL::Matrixc::gsl_matrix_char_const_ptr;
404 *gsl_matrix_vconcat = *Math::GSL::Matrixc::gsl_matrix_vconcat;
405 *gsl_matrix_hconcat = *Math::GSL::Matrixc::gsl_matrix_hconcat;
406 *gsl_matrix_random = *Math::GSL::Matrixc::gsl_matrix_random;
407  
408 ############# Class : Math::GSL::Matrix::gsl_complex ##############
409  
410 package Math::GSL::Matrix::gsl_complex;
411 use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
412 @ISA = qw( Math::GSL::Matrix );
413 %OWNER = ();
414 %ITERATORS = ();
415 *swig_dat_get = *Math::GSL::Matrixc::gsl_complex_dat_get;
416 *swig_dat_set = *Math::GSL::Matrixc::gsl_complex_dat_set;
417 sub new {
418 my $pkg = shift;
419 my $self = Math::GSL::Matrixc::new_gsl_complex(@_);
420 bless $self, $pkg if defined($self);
421 }
422  
423 sub DESTROY {
424 return unless $_[0]->isa('HASH');
425 my $self = tied(%{$_[0]});
426 return unless defined $self;
427 delete $ITERATORS{$self};
428 if (exists $OWNER{$self}) {
429 Math::GSL::Matrixc::delete_gsl_complex($self);
430 delete $OWNER{$self};
431 }
432 }
433  
434 sub DISOWN {
435 my $self = shift;
436 my $ptr = tied(%$self);
437 delete $OWNER{$ptr};
438 }
439  
440 sub ACQUIRE {
441 my $self = shift;
442 my $ptr = tied(%$self);
443 $OWNER{$ptr} = 1;
444 }
445  
446  
447 ############# Class : Math::GSL::Matrix::gsl_complex_long_double ##############
448  
449 package Math::GSL::Matrix::gsl_complex_long_double;
450 use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
451 @ISA = qw( Math::GSL::Matrix );
452 %OWNER = ();
453 %ITERATORS = ();
454 *swig_dat_get = *Math::GSL::Matrixc::gsl_complex_long_double_dat_get;
455 *swig_dat_set = *Math::GSL::Matrixc::gsl_complex_long_double_dat_set;
456 sub new {
457 my $pkg = shift;
458 my $self = Math::GSL::Matrixc::new_gsl_complex_long_double(@_);
459 bless $self, $pkg if defined($self);
460 }
461  
462 sub DESTROY {
463 return unless $_[0]->isa('HASH');
464 my $self = tied(%{$_[0]});
465 return unless defined $self;
466 delete $ITERATORS{$self};
467 if (exists $OWNER{$self}) {
468 Math::GSL::Matrixc::delete_gsl_complex_long_double($self);
469 delete $OWNER{$self};
470 }
471 }
472  
473 sub DISOWN {
474 my $self = shift;
475 my $ptr = tied(%$self);
476 delete $OWNER{$ptr};
477 }
478  
479 sub ACQUIRE {
480 my $self = shift;
481 my $ptr = tied(%$self);
482 $OWNER{$ptr} = 1;
483 }
484  
485  
486 ############# Class : Math::GSL::Matrix::gsl_complex_float ##############
487  
488 package Math::GSL::Matrix::gsl_complex_float;
489 use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
490 @ISA = qw( Math::GSL::Matrix );
491 %OWNER = ();
492 %ITERATORS = ();
493 *swig_dat_get = *Math::GSL::Matrixc::gsl_complex_float_dat_get;
494 *swig_dat_set = *Math::GSL::Matrixc::gsl_complex_float_dat_set;
495 sub new {
496 my $pkg = shift;
497 my $self = Math::GSL::Matrixc::new_gsl_complex_float(@_);
498 bless $self, $pkg if defined($self);
499 }
500  
501 sub DESTROY {
502 return unless $_[0]->isa('HASH');
503 my $self = tied(%{$_[0]});
504 return unless defined $self;
505 delete $ITERATORS{$self};
506 if (exists $OWNER{$self}) {
507 Math::GSL::Matrixc::delete_gsl_complex_float($self);
508 delete $OWNER{$self};
509 }
510 }
511  
512 sub DISOWN {
513 my $self = shift;
514 my $ptr = tied(%$self);
515 delete $OWNER{$ptr};
516 }
517  
518 sub ACQUIRE {
519 my $self = shift;
520 my $ptr = tied(%$self);
521 $OWNER{$ptr} = 1;
522 }
523  
524  
525 ############# Class : Math::GSL::Matrix::gsl_vector ##############
526  
527 package Math::GSL::Matrix::gsl_vector;
528 use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
529 @ISA = qw( Math::GSL::Matrix );
530 %OWNER = ();
531 %ITERATORS = ();
532 *swig_size_get = *Math::GSL::Matrixc::gsl_vector_size_get;
533 *swig_size_set = *Math::GSL::Matrixc::gsl_vector_size_set;
534 *swig_stride_get = *Math::GSL::Matrixc::gsl_vector_stride_get;
535 *swig_stride_set = *Math::GSL::Matrixc::gsl_vector_stride_set;
536 *swig_data_get = *Math::GSL::Matrixc::gsl_vector_data_get;
537 *swig_data_set = *Math::GSL::Matrixc::gsl_vector_data_set;
538 *swig_block_get = *Math::GSL::Matrixc::gsl_vector_block_get;
539 *swig_block_set = *Math::GSL::Matrixc::gsl_vector_block_set;
540 *swig_owner_get = *Math::GSL::Matrixc::gsl_vector_owner_get;
541 *swig_owner_set = *Math::GSL::Matrixc::gsl_vector_owner_set;
542 sub new {
543 my $pkg = shift;
544 my $self = Math::GSL::Matrixc::new_gsl_vector(@_);
545 bless $self, $pkg if defined($self);
546 }
547  
548 sub DESTROY {
549 return unless $_[0]->isa('HASH');
550 my $self = tied(%{$_[0]});
551 return unless defined $self;
552 delete $ITERATORS{$self};
553 if (exists $OWNER{$self}) {
554 Math::GSL::Matrixc::delete_gsl_vector($self);
555 delete $OWNER{$self};
556 }
557 }
558  
559 sub DISOWN {
560 my $self = shift;
561 my $ptr = tied(%$self);
562 delete $OWNER{$ptr};
563 }
564  
565 sub ACQUIRE {
566 my $self = shift;
567 my $ptr = tied(%$self);
568 $OWNER{$ptr} = 1;
569 }
570  
571  
572 ############# Class : Math::GSL::Matrix::_gsl_vector_view ##############
573  
574 package Math::GSL::Matrix::_gsl_vector_view;
575 use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
576 @ISA = qw( Math::GSL::Matrix );
577 %OWNER = ();
578 %ITERATORS = ();
579 *swig_vector_get = *Math::GSL::Matrixc::_gsl_vector_view_vector_get;
580 *swig_vector_set = *Math::GSL::Matrixc::_gsl_vector_view_vector_set;
581 sub new {
582 my $pkg = shift;
583 my $self = Math::GSL::Matrixc::new__gsl_vector_view(@_);
584 bless $self, $pkg if defined($self);
585 }
586  
587 sub DESTROY {
588 return unless $_[0]->isa('HASH');
589 my $self = tied(%{$_[0]});
590 return unless defined $self;
591 delete $ITERATORS{$self};
592 if (exists $OWNER{$self}) {
593 Math::GSL::Matrixc::delete__gsl_vector_view($self);
594 delete $OWNER{$self};
595 }
596 }
597  
598 sub DISOWN {
599 my $self = shift;
600 my $ptr = tied(%$self);
601 delete $OWNER{$ptr};
602 }
603  
604 sub ACQUIRE {
605 my $self = shift;
606 my $ptr = tied(%$self);
607 $OWNER{$ptr} = 1;
608 }
609  
610  
611 ############# Class : Math::GSL::Matrix::_gsl_vector_const_view ##############
612  
613 package Math::GSL::Matrix::_gsl_vector_const_view;
614 use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
615 @ISA = qw( Math::GSL::Matrix );
616 %OWNER = ();
617 %ITERATORS = ();
618 *swig_vector_get = *Math::GSL::Matrixc::_gsl_vector_const_view_vector_get;
619 *swig_vector_set = *Math::GSL::Matrixc::_gsl_vector_const_view_vector_set;
620 sub new {
621 my $pkg = shift;
622 my $self = Math::GSL::Matrixc::new__gsl_vector_const_view(@_);
623 bless $self, $pkg if defined($self);
624 }
625  
626 sub DESTROY {
627 return unless $_[0]->isa('HASH');
628 my $self = tied(%{$_[0]});
629 return unless defined $self;
630 delete $ITERATORS{$self};
631 if (exists $OWNER{$self}) {
632 Math::GSL::Matrixc::delete__gsl_vector_const_view($self);
633 delete $OWNER{$self};
634 }
635 }
636  
637 sub DISOWN {
638 my $self = shift;
639 my $ptr = tied(%$self);
640 delete $OWNER{$ptr};
641 }
642  
643 sub ACQUIRE {
644 my $self = shift;
645 my $ptr = tied(%$self);
646 $OWNER{$ptr} = 1;
647 }
648  
649  
650 ############# Class : Math::GSL::Matrix::gsl_matrix ##############
651  
652 package Math::GSL::Matrix::gsl_matrix;
653 use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
654 @ISA = qw( Math::GSL::Matrix );
655 %OWNER = ();
656 %ITERATORS = ();
657 *swig_size1_get = *Math::GSL::Matrixc::gsl_matrix_size1_get;
658 *swig_size1_set = *Math::GSL::Matrixc::gsl_matrix_size1_set;
659 *swig_size2_get = *Math::GSL::Matrixc::gsl_matrix_size2_get;
660 *swig_size2_set = *Math::GSL::Matrixc::gsl_matrix_size2_set;
661 *swig_tda_get = *Math::GSL::Matrixc::gsl_matrix_tda_get;
662 *swig_tda_set = *Math::GSL::Matrixc::gsl_matrix_tda_set;
663 *swig_data_get = *Math::GSL::Matrixc::gsl_matrix_data_get;
664 *swig_data_set = *Math::GSL::Matrixc::gsl_matrix_data_set;
665 *swig_block_get = *Math::GSL::Matrixc::gsl_matrix_block_get;
666 *swig_block_set = *Math::GSL::Matrixc::gsl_matrix_block_set;
667 *swig_owner_get = *Math::GSL::Matrixc::gsl_matrix_owner_get;
668 *swig_owner_set = *Math::GSL::Matrixc::gsl_matrix_owner_set;
669 sub new {
670 my $pkg = shift;
671 my $self = Math::GSL::Matrixc::new_gsl_matrix(@_);
672 bless $self, $pkg if defined($self);
673 }
674  
675 sub DESTROY {
676 return unless $_[0]->isa('HASH');
677 my $self = tied(%{$_[0]});
678 return unless defined $self;
679 delete $ITERATORS{$self};
680 if (exists $OWNER{$self}) {
681 Math::GSL::Matrixc::delete_gsl_matrix($self);
682 delete $OWNER{$self};
683 }
684 }
685  
686 sub DISOWN {
687 my $self = shift;
688 my $ptr = tied(%$self);
689 delete $OWNER{$ptr};
690 }
691  
692 sub ACQUIRE {
693 my $self = shift;
694 my $ptr = tied(%$self);
695 $OWNER{$ptr} = 1;
696 }
697  
698  
699 ############# Class : Math::GSL::Matrix::_gsl_matrix_view ##############
700  
701 package Math::GSL::Matrix::_gsl_matrix_view;
702 use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
703 @ISA = qw( Math::GSL::Matrix );
704 %OWNER = ();
705 %ITERATORS = ();
706 *swig_matrix_get = *Math::GSL::Matrixc::_gsl_matrix_view_matrix_get;
707 *swig_matrix_set = *Math::GSL::Matrixc::_gsl_matrix_view_matrix_set;
708 sub new {
709 my $pkg = shift;
710 my $self = Math::GSL::Matrixc::new__gsl_matrix_view(@_);
711 bless $self, $pkg if defined($self);
712 }
713  
714 sub DESTROY {
715 return unless $_[0]->isa('HASH');
716 my $self = tied(%{$_[0]});
717 return unless defined $self;
718 delete $ITERATORS{$self};
719 if (exists $OWNER{$self}) {
720 Math::GSL::Matrixc::delete__gsl_matrix_view($self);
721 delete $OWNER{$self};
722 }
723 }
724  
725 sub DISOWN {
726 my $self = shift;
727 my $ptr = tied(%$self);
728 delete $OWNER{$ptr};
729 }
730  
731 sub ACQUIRE {
732 my $self = shift;
733 my $ptr = tied(%$self);
734 $OWNER{$ptr} = 1;
735 }
736  
737  
738 ############# Class : Math::GSL::Matrix::_gsl_matrix_const_view ##############
739  
740 package Math::GSL::Matrix::_gsl_matrix_const_view;
741 use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
742 @ISA = qw( Math::GSL::Matrix );
743 %OWNER = ();
744 %ITERATORS = ();
745 *swig_matrix_get = *Math::GSL::Matrixc::_gsl_matrix_const_view_matrix_get;
746 *swig_matrix_set = *Math::GSL::Matrixc::_gsl_matrix_const_view_matrix_set;
747 sub new {
748 my $pkg = shift;
749 my $self = Math::GSL::Matrixc::new__gsl_matrix_const_view(@_);
750 bless $self, $pkg if defined($self);
751 }
752  
753 sub DESTROY {
754 return unless $_[0]->isa('HASH');
755 my $self = tied(%{$_[0]});
756 return unless defined $self;
757 delete $ITERATORS{$self};
758 if (exists $OWNER{$self}) {
759 Math::GSL::Matrixc::delete__gsl_matrix_const_view($self);
760 delete $OWNER{$self};
761 }
762 }
763  
764 sub DISOWN {
765 my $self = shift;
766 my $ptr = tied(%$self);
767 delete $OWNER{$ptr};
768 }
769  
770 sub ACQUIRE {
771 my $self = shift;
772 my $ptr = tied(%$self);
773 $OWNER{$ptr} = 1;
774 }
775  
776  
777 ############# Class : Math::GSL::Matrix::gsl_matrix_int ##############
778  
779 package Math::GSL::Matrix::gsl_matrix_int;
780 use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
781 @ISA = qw( Math::GSL::Matrix );
782 %OWNER = ();
783 %ITERATORS = ();
784 *swig_size1_get = *Math::GSL::Matrixc::gsl_matrix_int_size1_get;
785 *swig_size1_set = *Math::GSL::Matrixc::gsl_matrix_int_size1_set;
786 *swig_size2_get = *Math::GSL::Matrixc::gsl_matrix_int_size2_get;
787 *swig_size2_set = *Math::GSL::Matrixc::gsl_matrix_int_size2_set;
788 *swig_tda_get = *Math::GSL::Matrixc::gsl_matrix_int_tda_get;
789 *swig_tda_set = *Math::GSL::Matrixc::gsl_matrix_int_tda_set;
790 *swig_data_get = *Math::GSL::Matrixc::gsl_matrix_int_data_get;
791 *swig_data_set = *Math::GSL::Matrixc::gsl_matrix_int_data_set;
792 *swig_block_get = *Math::GSL::Matrixc::gsl_matrix_int_block_get;
793 *swig_block_set = *Math::GSL::Matrixc::gsl_matrix_int_block_set;
794 *swig_owner_get = *Math::GSL::Matrixc::gsl_matrix_int_owner_get;
795 *swig_owner_set = *Math::GSL::Matrixc::gsl_matrix_int_owner_set;
796 sub new {
797 my $pkg = shift;
798 my $self = Math::GSL::Matrixc::new_gsl_matrix_int(@_);
799 bless $self, $pkg if defined($self);
800 }
801  
802 sub DESTROY {
803 return unless $_[0]->isa('HASH');
804 my $self = tied(%{$_[0]});
805 return unless defined $self;
806 delete $ITERATORS{$self};
807 if (exists $OWNER{$self}) {
808 Math::GSL::Matrixc::delete_gsl_matrix_int($self);
809 delete $OWNER{$self};
810 }
811 }
812  
813 sub DISOWN {
814 my $self = shift;
815 my $ptr = tied(%$self);
816 delete $OWNER{$ptr};
817 }
818  
819 sub ACQUIRE {
820 my $self = shift;
821 my $ptr = tied(%$self);
822 $OWNER{$ptr} = 1;
823 }
824  
825  
826 ############# Class : Math::GSL::Matrix::_gsl_matrix_int_view ##############
827  
828 package Math::GSL::Matrix::_gsl_matrix_int_view;
829 use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
830 @ISA = qw( Math::GSL::Matrix );
831 %OWNER = ();
832 %ITERATORS = ();
833 *swig_matrix_get = *Math::GSL::Matrixc::_gsl_matrix_int_view_matrix_get;
834 *swig_matrix_set = *Math::GSL::Matrixc::_gsl_matrix_int_view_matrix_set;
835 sub new {
836 my $pkg = shift;
837 my $self = Math::GSL::Matrixc::new__gsl_matrix_int_view(@_);
838 bless $self, $pkg if defined($self);
839 }
840  
841 sub DESTROY {
842 return unless $_[0]->isa('HASH');
843 my $self = tied(%{$_[0]});
844 return unless defined $self;
845 delete $ITERATORS{$self};
846 if (exists $OWNER{$self}) {
847 Math::GSL::Matrixc::delete__gsl_matrix_int_view($self);
848 delete $OWNER{$self};
849 }
850 }
851  
852 sub DISOWN {
853 my $self = shift;
854 my $ptr = tied(%$self);
855 delete $OWNER{$ptr};
856 }
857  
858 sub ACQUIRE {
859 my $self = shift;
860 my $ptr = tied(%$self);
861 $OWNER{$ptr} = 1;
862 }
863  
864  
865 ############# Class : Math::GSL::Matrix::_gsl_matrix_int_const_view ##############
866  
867 package Math::GSL::Matrix::_gsl_matrix_int_const_view;
868 use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
869 @ISA = qw( Math::GSL::Matrix );
870 %OWNER = ();
871 %ITERATORS = ();
872 *swig_matrix_get = *Math::GSL::Matrixc::_gsl_matrix_int_const_view_matrix_get;
873 *swig_matrix_set = *Math::GSL::Matrixc::_gsl_matrix_int_const_view_matrix_set;
874 sub new {
875 my $pkg = shift;
876 my $self = Math::GSL::Matrixc::new__gsl_matrix_int_const_view(@_);
877 bless $self, $pkg if defined($self);
878 }
879  
880 sub DESTROY {
881 return unless $_[0]->isa('HASH');
882 my $self = tied(%{$_[0]});
883 return unless defined $self;
884 delete $ITERATORS{$self};
885 if (exists $OWNER{$self}) {
886 Math::GSL::Matrixc::delete__gsl_matrix_int_const_view($self);
887 delete $OWNER{$self};
888 }
889 }
890  
891 sub DISOWN {
892 my $self = shift;
893 my $ptr = tied(%$self);
894 delete $OWNER{$ptr};
895 }
896  
897 sub ACQUIRE {
898 my $self = shift;
899 my $ptr = tied(%$self);
900 $OWNER{$ptr} = 1;
901 }
902  
903  
904 ############# Class : Math::GSL::Matrix::gsl_matrix_complex ##############
905  
906 package Math::GSL::Matrix::gsl_matrix_complex;
907 use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
908 @ISA = qw( Math::GSL::Matrix );
909 %OWNER = ();
910 %ITERATORS = ();
911 *swig_size1_get = *Math::GSL::Matrixc::gsl_matrix_complex_size1_get;
912 *swig_size1_set = *Math::GSL::Matrixc::gsl_matrix_complex_size1_set;
913 *swig_size2_get = *Math::GSL::Matrixc::gsl_matrix_complex_size2_get;
914 *swig_size2_set = *Math::GSL::Matrixc::gsl_matrix_complex_size2_set;
915 *swig_tda_get = *Math::GSL::Matrixc::gsl_matrix_complex_tda_get;
916 *swig_tda_set = *Math::GSL::Matrixc::gsl_matrix_complex_tda_set;
917 *swig_data_get = *Math::GSL::Matrixc::gsl_matrix_complex_data_get;
918 *swig_data_set = *Math::GSL::Matrixc::gsl_matrix_complex_data_set;
919 *swig_block_get = *Math::GSL::Matrixc::gsl_matrix_complex_block_get;
920 *swig_block_set = *Math::GSL::Matrixc::gsl_matrix_complex_block_set;
921 *swig_owner_get = *Math::GSL::Matrixc::gsl_matrix_complex_owner_get;
922 *swig_owner_set = *Math::GSL::Matrixc::gsl_matrix_complex_owner_set;
923 sub new {
924 my $pkg = shift;
925 my $self = Math::GSL::Matrixc::new_gsl_matrix_complex(@_);
926 bless $self, $pkg if defined($self);
927 }
928  
929 sub DESTROY {
930 return unless $_[0]->isa('HASH');
931 my $self = tied(%{$_[0]});
932 return unless defined $self;
933 delete $ITERATORS{$self};
934 if (exists $OWNER{$self}) {
935 Math::GSL::Matrixc::delete_gsl_matrix_complex($self);
936 delete $OWNER{$self};
937 }
938 }
939  
940 sub DISOWN {
941 my $self = shift;
942 my $ptr = tied(%$self);
943 delete $OWNER{$ptr};
944 }
945  
946 sub ACQUIRE {
947 my $self = shift;
948 my $ptr = tied(%$self);
949 $OWNER{$ptr} = 1;
950 }
951  
952  
953 ############# Class : Math::GSL::Matrix::_gsl_matrix_complex_view ##############
954  
955 package Math::GSL::Matrix::_gsl_matrix_complex_view;
956 use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
957 @ISA = qw( Math::GSL::Matrix );
958 %OWNER = ();
959 %ITERATORS = ();
960 *swig_matrix_get = *Math::GSL::Matrixc::_gsl_matrix_complex_view_matrix_get;
961 *swig_matrix_set = *Math::GSL::Matrixc::_gsl_matrix_complex_view_matrix_set;
962 sub new {
963 my $pkg = shift;
964 my $self = Math::GSL::Matrixc::new__gsl_matrix_complex_view(@_);
965 bless $self, $pkg if defined($self);
966 }
967  
968 sub DESTROY {
969 return unless $_[0]->isa('HASH');
970 my $self = tied(%{$_[0]});
971 return unless defined $self;
972 delete $ITERATORS{$self};
973 if (exists $OWNER{$self}) {
974 Math::GSL::Matrixc::delete__gsl_matrix_complex_view($self);
975 delete $OWNER{$self};
976 }
977 }
978  
979 sub DISOWN {
980 my $self = shift;
981 my $ptr = tied(%$self);
982 delete $OWNER{$ptr};
983 }
984  
985 sub ACQUIRE {
986 my $self = shift;
987 my $ptr = tied(%$self);
988 $OWNER{$ptr} = 1;
989 }
990  
991  
992 ############# Class : Math::GSL::Matrix::_gsl_matrix_complex_const_view ##############
993  
994 package Math::GSL::Matrix::_gsl_matrix_complex_const_view;
995 use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
996 @ISA = qw( Math::GSL::Matrix );
997 %OWNER = ();
998 %ITERATORS = ();
999 *swig_matrix_get = *Math::GSL::Matrixc::_gsl_matrix_complex_const_view_matrix_get;
1000 *swig_matrix_set = *Math::GSL::Matrixc::_gsl_matrix_complex_const_view_matrix_set;
1001 sub new {
1002 my $pkg = shift;
1003 my $self = Math::GSL::Matrixc::new__gsl_matrix_complex_const_view(@_);
1004 bless $self, $pkg if defined($self);
1005 }
1006  
1007 sub DESTROY {
1008 return unless $_[0]->isa('HASH');
1009 my $self = tied(%{$_[0]});
1010 return unless defined $self;
1011 delete $ITERATORS{$self};
1012 if (exists $OWNER{$self}) {
1013 Math::GSL::Matrixc::delete__gsl_matrix_complex_const_view($self);
1014 delete $OWNER{$self};
1015 }
1016 }
1017  
1018 sub DISOWN {
1019 my $self = shift;
1020 my $ptr = tied(%$self);
1021 delete $OWNER{$ptr};
1022 }
1023  
1024 sub ACQUIRE {
1025 my $self = shift;
1026 my $ptr = tied(%$self);
1027 $OWNER{$ptr} = 1;
1028 }
1029  
1030  
1031 ############# Class : Math::GSL::Matrix::gsl_matrix_char ##############
1032  
1033 package Math::GSL::Matrix::gsl_matrix_char;
1034 use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
1035 @ISA = qw( Math::GSL::Matrix );
1036 %OWNER = ();
1037 %ITERATORS = ();
1038 *swig_size1_get = *Math::GSL::Matrixc::gsl_matrix_char_size1_get;
1039 *swig_size1_set = *Math::GSL::Matrixc::gsl_matrix_char_size1_set;
1040 *swig_size2_get = *Math::GSL::Matrixc::gsl_matrix_char_size2_get;
1041 *swig_size2_set = *Math::GSL::Matrixc::gsl_matrix_char_size2_set;
1042 *swig_tda_get = *Math::GSL::Matrixc::gsl_matrix_char_tda_get;
1043 *swig_tda_set = *Math::GSL::Matrixc::gsl_matrix_char_tda_set;
1044 *swig_data_get = *Math::GSL::Matrixc::gsl_matrix_char_data_get;
1045 *swig_data_set = *Math::GSL::Matrixc::gsl_matrix_char_data_set;
1046 *swig_block_get = *Math::GSL::Matrixc::gsl_matrix_char_block_get;
1047 *swig_block_set = *Math::GSL::Matrixc::gsl_matrix_char_block_set;
1048 *swig_owner_get = *Math::GSL::Matrixc::gsl_matrix_char_owner_get;
1049 *swig_owner_set = *Math::GSL::Matrixc::gsl_matrix_char_owner_set;
1050 sub new {
1051 my $pkg = shift;
1052 my $self = Math::GSL::Matrixc::new_gsl_matrix_char(@_);
1053 bless $self, $pkg if defined($self);
1054 }
1055  
1056 sub DESTROY {
1057 return unless $_[0]->isa('HASH');
1058 my $self = tied(%{$_[0]});
1059 return unless defined $self;
1060 delete $ITERATORS{$self};
1061 if (exists $OWNER{$self}) {
1062 Math::GSL::Matrixc::delete_gsl_matrix_char($self);
1063 delete $OWNER{$self};
1064 }
1065 }
1066  
1067 sub DISOWN {
1068 my $self = shift;
1069 my $ptr = tied(%$self);
1070 delete $OWNER{$ptr};
1071 }
1072  
1073 sub ACQUIRE {
1074 my $self = shift;
1075 my $ptr = tied(%$self);
1076 $OWNER{$ptr} = 1;
1077 }
1078  
1079  
1080 ############# Class : Math::GSL::Matrix::_gsl_matrix_char_view ##############
1081  
1082 package Math::GSL::Matrix::_gsl_matrix_char_view;
1083 use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
1084 @ISA = qw( Math::GSL::Matrix );
1085 %OWNER = ();
1086 %ITERATORS = ();
1087 *swig_matrix_get = *Math::GSL::Matrixc::_gsl_matrix_char_view_matrix_get;
1088 *swig_matrix_set = *Math::GSL::Matrixc::_gsl_matrix_char_view_matrix_set;
1089 sub new {
1090 my $pkg = shift;
1091 my $self = Math::GSL::Matrixc::new__gsl_matrix_char_view(@_);
1092 bless $self, $pkg if defined($self);
1093 }
1094  
1095 sub DESTROY {
1096 return unless $_[0]->isa('HASH');
1097 my $self = tied(%{$_[0]});
1098 return unless defined $self;
1099 delete $ITERATORS{$self};
1100 if (exists $OWNER{$self}) {
1101 Math::GSL::Matrixc::delete__gsl_matrix_char_view($self);
1102 delete $OWNER{$self};
1103 }
1104 }
1105  
1106 sub DISOWN {
1107 my $self = shift;
1108 my $ptr = tied(%$self);
1109 delete $OWNER{$ptr};
1110 }
1111  
1112 sub ACQUIRE {
1113 my $self = shift;
1114 my $ptr = tied(%$self);
1115 $OWNER{$ptr} = 1;
1116 }
1117  
1118  
1119 ############# Class : Math::GSL::Matrix::_gsl_matrix_char_const_view ##############
1120  
1121 package Math::GSL::Matrix::_gsl_matrix_char_const_view;
1122 use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
1123 @ISA = qw( Math::GSL::Matrix );
1124 %OWNER = ();
1125 %ITERATORS = ();
1126 *swig_matrix_get = *Math::GSL::Matrixc::_gsl_matrix_char_const_view_matrix_get;
1127 *swig_matrix_set = *Math::GSL::Matrixc::_gsl_matrix_char_const_view_matrix_set;
1128 sub new {
1129 my $pkg = shift;
1130 my $self = Math::GSL::Matrixc::new__gsl_matrix_char_const_view(@_);
1131 bless $self, $pkg if defined($self);
1132 }
1133  
1134 sub DESTROY {
1135 return unless $_[0]->isa('HASH');
1136 my $self = tied(%{$_[0]});
1137 return unless defined $self;
1138 delete $ITERATORS{$self};
1139 if (exists $OWNER{$self}) {
1140 Math::GSL::Matrixc::delete__gsl_matrix_char_const_view($self);
1141 delete $OWNER{$self};
1142 }
1143 }
1144  
1145 sub DISOWN {
1146 my $self = shift;
1147 my $ptr = tied(%$self);
1148 delete $OWNER{$ptr};
1149 }
1150  
1151 sub ACQUIRE {
1152 my $self = shift;
1153 my $ptr = tied(%$self);
1154 $OWNER{$ptr} = 1;
1155 }
1156  
1157  
1158 # ------- VARIABLE STUBS --------
1159  
1160 package Math::GSL::Matrix;
1161  
1162 *GSL_VERSION = *Math::GSL::Matrixc::GSL_VERSION;
1163 *GSL_MAJOR_VERSION = *Math::GSL::Matrixc::GSL_MAJOR_VERSION;
1164 *GSL_MINOR_VERSION = *Math::GSL::Matrixc::GSL_MINOR_VERSION;
1165 *GSL_POSZERO = *Math::GSL::Matrixc::GSL_POSZERO;
1166 *GSL_NEGZERO = *Math::GSL::Matrixc::GSL_NEGZERO;
1167 *GSL_SUCCESS = *Math::GSL::Matrixc::GSL_SUCCESS;
1168 *GSL_FAILURE = *Math::GSL::Matrixc::GSL_FAILURE;
1169 *GSL_CONTINUE = *Math::GSL::Matrixc::GSL_CONTINUE;
1170 *GSL_EDOM = *Math::GSL::Matrixc::GSL_EDOM;
1171 *GSL_ERANGE = *Math::GSL::Matrixc::GSL_ERANGE;
1172 *GSL_EFAULT = *Math::GSL::Matrixc::GSL_EFAULT;
1173 *GSL_EINVAL = *Math::GSL::Matrixc::GSL_EINVAL;
1174 *GSL_EFAILED = *Math::GSL::Matrixc::GSL_EFAILED;
1175 *GSL_EFACTOR = *Math::GSL::Matrixc::GSL_EFACTOR;
1176 *GSL_ESANITY = *Math::GSL::Matrixc::GSL_ESANITY;
1177 *GSL_ENOMEM = *Math::GSL::Matrixc::GSL_ENOMEM;
1178 *GSL_EBADFUNC = *Math::GSL::Matrixc::GSL_EBADFUNC;
1179 *GSL_ERUNAWAY = *Math::GSL::Matrixc::GSL_ERUNAWAY;
1180 *GSL_EMAXITER = *Math::GSL::Matrixc::GSL_EMAXITER;
1181 *GSL_EZERODIV = *Math::GSL::Matrixc::GSL_EZERODIV;
1182 *GSL_EBADTOL = *Math::GSL::Matrixc::GSL_EBADTOL;
1183 *GSL_ETOL = *Math::GSL::Matrixc::GSL_ETOL;
1184 *GSL_EUNDRFLW = *Math::GSL::Matrixc::GSL_EUNDRFLW;
1185 *GSL_EOVRFLW = *Math::GSL::Matrixc::GSL_EOVRFLW;
1186 *GSL_ELOSS = *Math::GSL::Matrixc::GSL_ELOSS;
1187 *GSL_EROUND = *Math::GSL::Matrixc::GSL_EROUND;
1188 *GSL_EBADLEN = *Math::GSL::Matrixc::GSL_EBADLEN;
1189 *GSL_ENOTSQR = *Math::GSL::Matrixc::GSL_ENOTSQR;
1190 *GSL_ESING = *Math::GSL::Matrixc::GSL_ESING;
1191 *GSL_EDIVERGE = *Math::GSL::Matrixc::GSL_EDIVERGE;
1192 *GSL_EUNSUP = *Math::GSL::Matrixc::GSL_EUNSUP;
1193 *GSL_EUNIMPL = *Math::GSL::Matrixc::GSL_EUNIMPL;
1194 *GSL_ECACHE = *Math::GSL::Matrixc::GSL_ECACHE;
1195 *GSL_ETABLE = *Math::GSL::Matrixc::GSL_ETABLE;
1196 *GSL_ENOPROG = *Math::GSL::Matrixc::GSL_ENOPROG;
1197 *GSL_ENOPROGJ = *Math::GSL::Matrixc::GSL_ENOPROGJ;
1198 *GSL_ETOLF = *Math::GSL::Matrixc::GSL_ETOLF;
1199 *GSL_ETOLX = *Math::GSL::Matrixc::GSL_ETOLX;
1200 *GSL_ETOLG = *Math::GSL::Matrixc::GSL_ETOLG;
1201 *GSL_EOF = *Math::GSL::Matrixc::GSL_EOF;
1202  
1203  
1204 use strict;
1205 use warnings;
1206 use Carp qw/croak/;
1207 use Scalar::Util 'blessed';
1208  
1209 use Math::GSL qw/:all/;
1210 use Math::GSL::Errno qw/:all/;
1211 use Math::GSL::Eigen qw/:all/;
1212 use Math::GSL::Vector qw/:all/;
1213 use Math::GSL::Complex qw/:all/;
1214 use Math::GSL::Test qw/is_similar/;
1215 use Math::GSL::BLAS qw/gsl_blas_dgemm/;
1216 use Math::GSL::CBLAS qw/$CblasNoTrans/;
1217 use Math::GSL::Permutation;
1218 use Math::GSL::Linalg qw/
1219 gsl_linalg_LU_decomp
1220 gsl_linalg_LU_det
1221 gsl_linalg_LU_lndet
1222 gsl_linalg_LU_invert
1223 /;
1224  
1225 # should only include needed methods
1226 use Math::GSL::MatrixComplex qw/:all/;
1227 use Math::GSL::VectorComplex qw/:all/;
1228 use Data::Dumper;
1229  
1230 use overload
1231 '*' => \&_multiplication,
1232 '+' => \&_addition,
1233 '-' => \&_subtract,
1234 '==' => \&_equal,
1235 '!=' => \&_not_equal,
1236 fallback => 1;
1237  
1238 our @EXPORT_OK = qw/
1239 gsl_matrix_alloc gsl_matrix_calloc gsl_matrix_alloc_from_block
1240 gsl_matrix_alloc_from_matrix gsl_vector_alloc_row_from_matrix
1241 gsl_vector_alloc_col_from_matrix gsl_matrix_free gsl_matrix_submatrix
1242 gsl_matrix_row gsl_matrix_column gsl_matrix_diagonal
1243 gsl_matrix_subdiagonal gsl_matrix_superdiagonal gsl_matrix_subrow
1244 gsl_matrix_subcolumn gsl_matrix_view_array
1245 gsl_matrix_view_array_with_tda gsl_matrix_view_vector
1246 gsl_matrix_view_vector_with_tda gsl_matrix_const_submatrix
1247 gsl_matrix_const_row gsl_matrix_const_column gsl_matrix_const_diagonal
1248 gsl_matrix_const_subdiagonal gsl_matrix_const_superdiagonal
1249 gsl_matrix_const_subrow gsl_matrix_const_subcolumn
1250 gsl_matrix_const_view_array gsl_matrix_const_view_array_with_tda
1251 gsl_matrix_const_view_vector gsl_matrix_const_view_vector_with_tda
1252 gsl_matrix_get gsl_matrix_set gsl_matrix_ptr gsl_matrix_const_ptr
1253 gsl_matrix_set_zero gsl_matrix_set_identity gsl_matrix_set_all
1254 gsl_matrix_fread gsl_matrix_fwrite gsl_matrix_fscanf gsl_matrix_fprintf
1255 gsl_matrix_memcpy gsl_matrix_swap gsl_matrix_swap_rows
1256 gsl_matrix_swap_columns gsl_matrix_swap_rowcol gsl_matrix_transpose
1257 gsl_matrix_transpose_memcpy gsl_matrix_max gsl_matrix_min
1258 gsl_matrix_minmax gsl_matrix_max_index gsl_matrix_min_index
1259 gsl_matrix_minmax_index gsl_matrix_isnull gsl_matrix_ispos
1260 gsl_matrix_isneg gsl_matrix_isnonneg gsl_matrix_add gsl_matrix_sub
1261 gsl_matrix_mul_elements gsl_matrix_div_elements gsl_matrix_scale
1262 gsl_matrix_add_constant gsl_matrix_add_diagonal
1263 gsl_matrix_char_alloc gsl_matrix_char_calloc gsl_matrix_char_alloc_from_block
1264 gsl_matrix_char_alloc_from_matrix gsl_vector_char_alloc_row_from_matrix gsl_vector_char_alloc_col_from_matrix
1265 gsl_matrix_char_free gsl_matrix_char_submatrix
1266 gsl_matrix_char_row gsl_matrix_char_column
1267 gsl_matrix_char_diagonal gsl_matrix_char_subdiagonal gsl_matrix_char_superdiagonal
1268 gsl_matrix_char_subrow gsl_matrix_char_subcolumn gsl_matrix_char_view_array
1269 gsl_matrix_char_view_array_with_tda gsl_matrix_char_view_vector gsl_matrix_char_view_vector_with_tda
1270 gsl_matrix_char_const_submatrix gsl_matrix_char_const_row gsl_matrix_char_const_column
1271 gsl_matrix_char_const_diagonal gsl_matrix_char_const_subdiagonal gsl_matrix_char_const_superdiagonal
1272 gsl_matrix_char_const_subrow gsl_matrix_char_const_subcolumn gsl_matrix_char_const_view_array
1273 gsl_matrix_char_const_view_array_with_tda gsl_matrix_char_const_view_vector gsl_matrix_char_const_view_vector_with_tda
1274 gsl_matrix_char_get gsl_matrix_char_set gsl_matrix_char_ptr gsl_matrix_char_const_ptr
1275 gsl_matrix_char_set_zero gsl_matrix_char_set_identity
1276 gsl_matrix_char_set_all gsl_matrix_char_fread
1277 gsl_matrix_char_fwrite gsl_matrix_char_fscanf gsl_matrix_char_fprintf
1278 gsl_matrix_char_memcpy gsl_matrix_char_swap
1279 gsl_matrix_char_swap_rows gsl_matrix_char_swap_columns
1280 gsl_matrix_char_swap_rowcol gsl_matrix_char_transpose gsl_matrix_char_transpose_memcpy
1281 gsl_matrix_char_max gsl_matrix_char_min
1282 gsl_matrix_char_minmax gsl_matrix_char_max_index
1283 gsl_matrix_char_min_index gsl_matrix_char_minmax_index
1284 gsl_matrix_char_isnull gsl_matrix_char_ispos gsl_matrix_char_isneg
1285 gsl_matrix_char_isnonneg gsl_matrix_char_add
1286 gsl_matrix_char_sub gsl_matrix_char_mul_elements gsl_matrix_char_div_elements
1287 gsl_matrix_char_scale gsl_matrix_char_add_constant gsl_matrix_char_add_diagonal
1288 gsl_matrix_int_alloc gsl_matrix_int_calloc gsl_matrix_int_alloc_from_block
1289 gsl_matrix_int_alloc_from_matrix gsl_vector_int_alloc_row_from_matrix gsl_vector_int_alloc_col_from_matrix
1290 gsl_matrix_int_free gsl_matrix_int_submatrix gsl_matrix_int_row
1291 gsl_matrix_int_column gsl_matrix_int_diagonal gsl_matrix_int_subdiagonal
1292 gsl_matrix_int_superdiagonal gsl_matrix_int_subrow gsl_matrix_int_subcolumn gsl_matrix_int_view_array
1293 gsl_matrix_int_view_array_with_tda gsl_matrix_int_view_vector gsl_matrix_int_view_vector_with_tda
1294 gsl_matrix_int_const_submatrix gsl_matrix_int_const_row gsl_matrix_int_const_column
1295 gsl_matrix_int_const_diagonal gsl_matrix_int_const_subdiagonal gsl_matrix_int_const_superdiagonal
1296 gsl_matrix_int_const_subrow gsl_matrix_int_const_subcolumn gsl_matrix_int_const_view_array
1297 gsl_matrix_int_const_view_array_with_tda gsl_matrix_int_const_view_vector gsl_matrix_int_const_view_vector_with_tda
1298 gsl_matrix_int_get gsl_matrix_int_set
1299 gsl_matrix_int_ptr gsl_matrix_int_const_ptr
1300 gsl_matrix_int_set_zero gsl_matrix_int_set_identity gsl_matrix_int_set_all
1301 gsl_matrix_int_fread gsl_matrix_int_fwrite
1302 gsl_matrix_int_fscanf gsl_matrix_int_fprintf
1303 gsl_matrix_int_memcpy gsl_matrix_int_swap
1304 gsl_matrix_int_swap_rows gsl_matrix_int_swap_columns gsl_matrix_int_swap_rowcol
1305 gsl_matrix_int_transpose gsl_matrix_int_transpose_memcpy
1306 gsl_matrix_int_max gsl_matrix_int_min gsl_matrix_int_minmax
1307 gsl_matrix_int_max_index gsl_matrix_int_min_index
1308 gsl_matrix_int_minmax_index gsl_matrix_int_isnull
1309 gsl_matrix_int_ispos gsl_matrix_int_isneg gsl_matrix_int_isnonneg
1310 gsl_matrix_int_add gsl_matrix_int_sub
1311 gsl_matrix_int_mul_elements gsl_matrix_int_div_elements gsl_matrix_int_scale
1312 gsl_matrix_int_add_constant gsl_matrix_int_add_diagonal
1313 gsl_matrix_get_row gsl_matrix_get_col gsl_matrix_set_row gsl_matrix_set_col
1314 /;
1315  
1316 our %EXPORT_TAGS = ( all => [ @EXPORT_OK ],
1317 char => [ qw/
1318 gsl_matrix_char_alloc
1319 gsl_matrix_char_calloc
1320 gsl_matrix_char_alloc_from_block
1321 gsl_matrix_char_alloc_from_matrix
1322 gsl_vector_char_alloc_row_from_matrix
1323 gsl_vector_char_alloc_col_from_matrix
1324 gsl_matrix_char_free
1325 gsl_matrix_char_submatrix
1326 gsl_matrix_char_row
1327 gsl_matrix_char_column
1328 gsl_matrix_char_diagonal
1329 gsl_matrix_char_subdiagonal
1330 gsl_matrix_char_superdiagonal
1331 gsl_matrix_char_subrow
1332 gsl_matrix_char_subcolumn
1333 gsl_matrix_char_view_array
1334 gsl_matrix_char_view_array_with_tda
1335 gsl_matrix_char_view_vector
1336 gsl_matrix_char_view_vector_with_tda
1337 gsl_matrix_char_const_submatrix
1338 gsl_matrix_char_const_row
1339 gsl_matrix_char_const_column
1340 gsl_matrix_char_const_diagonal
1341 gsl_matrix_char_const_subdiagonal
1342 gsl_matrix_char_const_superdiagonal
1343 gsl_matrix_char_const_subrow
1344 gsl_matrix_char_const_subcolumn
1345 gsl_matrix_char_const_view_array
1346 gsl_matrix_char_const_view_array_with_tda
1347 gsl_matrix_char_const_view_vector
1348 gsl_matrix_char_const_view_vector_with_tda
1349 gsl_matrix_char_get
1350 gsl_matrix_char_set
1351 gsl_matrix_char_ptr
1352 gsl_matrix_char_const_ptr
1353 gsl_matrix_char_set_zero
1354 gsl_matrix_char_set_identity
1355 gsl_matrix_char_set_all
1356 gsl_matrix_char_fread
1357 gsl_matrix_char_fwrite
1358 gsl_matrix_char_fscanf
1359 gsl_matrix_char_fprintf
1360 gsl_matrix_char_memcpy
1361 gsl_matrix_char_swap
1362 gsl_matrix_char_swap_rows
1363 gsl_matrix_char_swap_columns
1364 gsl_matrix_char_swap_rowcol
1365 gsl_matrix_char_transpose
1366 gsl_matrix_char_transpose_memcpy
1367 gsl_matrix_char_max
1368 gsl_matrix_char_min
1369 gsl_matrix_char_minmax
1370 gsl_matrix_char_max_index
1371 gsl_matrix_char_min_index
1372 gsl_matrix_char_minmax_index
1373 gsl_matrix_char_isnull
1374 gsl_matrix_char_ispos
1375 gsl_matrix_char_isneg
1376 gsl_matrix_char_isnonneg
1377 gsl_matrix_char_add
1378 gsl_matrix_char_sub
1379 gsl_matrix_char_mul_elements
1380 gsl_matrix_char_div_elements
1381 gsl_matrix_char_scale
1382 gsl_matrix_char_add_constant
1383 gsl_matrix_char_add_diagonal
1384 /],
1385  
1386 double => [ qw/
1387 gsl_matrix_alloc
1388 gsl_matrix_calloc
1389 gsl_matrix_alloc_from_block
1390 gsl_matrix_alloc_from_matrix
1391 gsl_vector_alloc_row_from_matrix
1392 gsl_vector_alloc_col_from_matrix
1393 gsl_matrix_free
1394 gsl_matrix_submatrix
1395 gsl_matrix_row
1396 gsl_matrix_column
1397 gsl_matrix_diagonal
1398 gsl_matrix_subdiagonal
1399 gsl_matrix_superdiagonal
1400 gsl_matrix_subrow
1401 gsl_matrix_subcolumn
1402 gsl_matrix_view_array
1403 gsl_matrix_view_array_with_tda
1404 gsl_matrix_view_vector
1405 gsl_matrix_view_vector_with_tda
1406 gsl_matrix_const_submatrix
1407 gsl_matrix_const_row
1408 gsl_matrix_const_column
1409 gsl_matrix_const_diagonal
1410 gsl_matrix_const_subdiagonal
1411 gsl_matrix_const_superdiagonal
1412 gsl_matrix_const_subrow
1413 gsl_matrix_const_subcolumn
1414 gsl_matrix_const_view_array
1415 gsl_matrix_const_view_array_with_tda
1416 gsl_matrix_const_view_vector
1417 gsl_matrix_const_view_vector_with_tda
1418 gsl_matrix_get
1419 gsl_matrix_set
1420 gsl_matrix_ptr
1421 gsl_matrix_const_ptr
1422 gsl_matrix_set_zero
1423 gsl_matrix_set_identity
1424 gsl_matrix_set_all
1425 gsl_matrix_fread
1426 gsl_matrix_fwrite
1427 gsl_matrix_fscanf
1428 gsl_matrix_fprintf
1429 gsl_matrix_memcpy
1430 gsl_matrix_swap
1431 gsl_matrix_swap_rows
1432 gsl_matrix_swap_columns
1433 gsl_matrix_swap_rowcol
1434 gsl_matrix_transpose
1435 gsl_matrix_transpose_memcpy
1436 gsl_matrix_max
1437 gsl_matrix_minmax
1438 gsl_matrix_max_index
1439 gsl_matrix_min_index
1440 gsl_matrix_minmax_index
1441 gsl_matrix_isnull
1442 gsl_matrix_ispos
1443 gsl_matrix_isneg
1444 gsl_matrix_isnonneg
1445 gsl_matrix_add
1446 gsl_matrix_mul_elements
1447 gsl_matrix_div_elements
1448 gsl_matrix_scale
1449 gsl_matrix_add_constant
1450 gsl_matrix_add_diagonal
1451 /],
1452 int => [ qw/
1453 gsl_matrix_int_alloc
1454 gsl_matrix_int_alloc_from_matrix
1455 gsl_matrix_int_free
1456 gsl_matrix_int_column
1457 gsl_matrix_int_superdiagonal
1458 gsl_matrix_int_view_array_with_tda
1459 gsl_matrix_int_const_submatrix
1460 gsl_matrix_int_const_diagonal
1461 gsl_matrix_int_const_subrow
1462 gsl_matrix_int_const_view_array_with_tda
1463 gsl_matrix_int_get
1464 gsl_matrix_int_ptr
1465 gsl_matrix_int_set_zero
1466 gsl_matrix_int_fread
1467 gsl_matrix_int_fscanf
1468 gsl_matrix_int_memcpy
1469 gsl_matrix_int_swap_rows
1470 gsl_matrix_int_transpose
1471 gsl_matrix_int_max
1472 gsl_matrix_int_max_index
1473 gsl_matrix_int_minmax_index
1474 gsl_matrix_int_ispos
1475 gsl_matrix_int_add
1476 gsl_matrix_int_mul_elements
1477 gsl_matrix_int_add_constant
1478 /],
1479 );
1480  
1481  
1482 =encoding utf8
1483  
1484 =head1 NAME
1485  
1486 Math::GSL::Matrix - Mathematical functions concerning Matrices
1487  
1488 =head1 SYNOPSIS
1489  
1490 use Math::GSL::Matrix qw/:all/;
1491 my $matrix1 = Math::GSL::Matrix->new(5,5); # OO interface
1492 my $matrix2 = $matrix1 + 4; # You can add or substract values or matrices to OO matrices
1493 my $matrix3 = $matrix1 - 4;
1494 my $matrix4 = $matrix2 + $matrix1;
1495 my $matrix5 = $matrix2 . $matrix1; # This is a scalar product, it simply multiply each element
1496 # with the element of $matrix1 that have the same position
1497 # See Math::GSL::BLAS if you want scalar product
1498  
1499 my $matrix6 = $matrix2 . 8; # Multiply every elements of $matrix2 by 8
1500 my $matrix7 = $matrix2 * $matrix1; # scalar product of two matrices
1501 if($matrix1 == $matrix4) ...
1502 if($matrix1 != $matrix3) ...
1503 my $matrix8 = gsl_matrix_alloc(5,5); # standard interface
1504  
1505 =head1 DESCRIPTION
1506  
1507 This module is part of the L<Math::GSL> distribution. It defines a Perl insterface
1508 to GNU Scientific Library matrices.
1509  
1510 There are two different (but not exclusive) ways to use this module: using the
1511 OO API, built manually over the GSL functions, or using directly the
1512 functions defined by GSL library.
1513  
1514 =head1 OBJECT ORIENTED API
1515  
1516 =head2 Constructor
1517  
1518 =head3 Math::GSL::Matrix->new()
1519  
1520 Creates a new Matrix of the given size.
1521  
1522 my $matrix = Math::GSL::Matrix->new(10,10);
1523  
1524 If by any chance you already have a gsl_matrix and want to "objectify" it, you
1525 can use the following constructor:
1526  
1527 my $m = gsl_matrix_alloc(10, 20);
1528 # ... something
1529 my $matrix = Math::GSL::Matrix->new($m);
1530  
1531 Note that C<$m> is B<NOT> copied. The new object will just refer to the old gsl_matrix.
1532  
1533 =cut
1534  
1535 sub new {
1536 return _new_from_matrix(@_) if @_ == 2;
1537 return _new_from_dims(@_) if @_ == 3;
1538  
1539 croak( __PACKAGE__ .
1540 sprintf("::new(...) - unknown Matrix constructor with %d args", scalar(@_)));
1541 }
1542  
1543 sub _new_from_matrix
1544 {
1545 my ($class, $m) = @_;
1546 if (!defined($m) || !blessed($m) || ref($m) ne "Math::GSL::Matrix::gsl_matrix") {
1547 croak( __PACKAGE__.'::new($m) - $m should be a gsl_matrix');
1548 }
1549  
1550 return bless {
1551 _rows => $m->swig_size1_get(),
1552 _cols => $m->swig_size2_get(),
1553 _matrix => $m,
1554 }, $class;
1555 }
1556  
1557 sub _new_from_dims
1558 {
1559 my ($class, $rows, $cols) = @_;
1560 my $this = {};
1561 my $matrix;
1562 if ( defined $rows && defined $cols &&
1563 $rows > 0 && $cols > 0 &&
1564 (int $rows == $rows) && (int $cols == $cols)){
1565  
1566 $matrix = gsl_matrix_alloc($rows,$cols);
1567 } else {
1568 croak( __PACKAGE__.'::new($x,$y) - $x and $y must be positive integers');
1569 }
1570 gsl_matrix_set_zero($matrix);
1571 $this->{_matrix} = $matrix;
1572 ($this->{_rows}, $this->{_cols}) = ($rows,$cols);
1573 bless $this, $class;
1574 }
1575  
1576 =head2 Getters
1577  
1578 =head3 raw()
1579  
1580 Get the underlying GSL matrix object created by SWIG, useful for using gsl_matrix_* functions which do not have an OO counterpart.
1581  
1582 my $matrix = Math::GSL::Matrix->new(3,3);
1583 my $gsl_matrix = $matrix->raw;
1584 my $stuff = gsl_matrix_get($gsl_matrix, 1, 2);
1585  
1586 =cut
1587  
1588 sub raw { (shift)->{_matrix} }
1589  
1590  
1591 =head3 dim()
1592  
1593 Returns the number of rows and columns in a matrix as an array.
1594  
1595 my ($rows, $cols) = $matrix->dim;
1596  
1597 Basically a shortcut to C<rows> and C<cols> methods.
1598  
1599 =cut
1600  
1601 sub dim { ($_[0]->rows, $_[0]->cols) }
1602  
1603 =head3 rows()
1604  
1605 Returns the number of rows in the matrix.
1606  
1607 my $rows = $matrix->rows;
1608 =cut
1609  
1610 sub rows { (shift)->{_rows} }
1611  
1612 =head3 cols()
1613  
1614 Returns the number of columns in the matrix.
1615  
1616 my $cols = $matrix->cols;
1617 =cut
1618  
1619 sub cols { (shift)->{_cols} }
1620  
1621 =head3 as_list()
1622  
1623 Get the contents of a Math::GSL::Matrix object as a Perl list.
1624  
1625 my $matrix = Math::GSL::Matrix->new(3,3);
1626 ...
1627 my @matrix = $matrix->as_list;
1628 =cut
1629  
1630 sub as_list($)
1631 {
1632 my $self = shift;
1633 my @matrix;
1634 for my $row ( 0 .. $self->rows-1) {
1635 push @matrix, map { gsl_matrix_get($self->raw, $row, $_) } (0 .. $self->cols-1 );
1636 }
1637 return @matrix;
1638 }
1639  
1640 =head3 as_vector()
1641  
1642 Returns a 1xN or Nx1 matrix as a Math::GSL::Vector object. Dies if called on a matrix that is not a single row or column. Useful for turning the output of C<col()> or C<row()> into a vector, like so:
1643  
1644 my $vector1 = $matrix->col(0)->as_vector;
1645 my $vector2 = $matrix->row(1)->as_vector;
1646  
1647 =cut
1648  
1649 sub as_vector($)
1650 {
1651 my ($self) = @_;
1652 croak(__PACKAGE__.'::as_vector() - must be a single row or column matrix') unless ($self->cols == 1 or $self->rows == 1);
1653  
1654 # TODO: there is a faster way to do this
1655 return Math::GSL::Vector->new([ $self->as_list ] );
1656  
1657 }
1658  
1659 =head3 get_elem()
1660  
1661 Returns an element of a matrix.
1662  
1663 my $matrix = Math::GSL::Matrix->new(3,3);
1664 ...
1665 my $middle = $matrix->get_elem(1,1);
1666  
1667 B<NOTE:> just like any other method on this module, rows and arrays start
1668 with indice 0.
1669  
1670 =cut
1671  
1672 sub get_elem {
1673 my ($self, $row, $col) = @_;
1674 die __PACKAGE__.'::get_elem($x, $y, $v) - $x must be a valid row number'
1675 if ($row < 0 || $row >= $self->rows);
1676 die __PACKAGE__.'::get_elem($x, $y, $v) - $y must be a valid column number'
1677 if ($col < 0 || $col >= $self->cols);
1678 return gsl_matrix_get($self->raw, $row, $col);
1679 }
1680  
1681 =head3 row()
1682  
1683 Returns a row matrix of the row you enter.
1684  
1685 my $matrix = Math::GSL::Matrix->new(3,3);
1686 ...
1687 my $matrix_row = $matrix->row(0);
1688  
1689 =cut
1690  
1691 sub row
1692 {
1693 my ($self, $row) = @_;
1694 croak (__PACKAGE__.'::$matrix->row($row) - invalid $row value')
1695 unless (($row < $self->rows) and $row >= 0);
1696  
1697 my $rowmat = Math::GSL::Matrix->new(1,$self->cols);
1698  
1699 for my $n (0 .. $self->cols-1) {
1700 gsl_matrix_set( $rowmat->raw, 0, $n,
1701 gsl_matrix_get($self->raw, $row, $n)
1702 );
1703 }
1704  
1705 return $rowmat;
1706 }
1707  
1708 =head3 col()
1709  
1710 Returns a col matrix of the column you enter.
1711  
1712 my $matrix = Math::GSL::Matrix->new(3,3);
1713 ...
1714 my $matrix_col = $matrix->col(0);
1715  
1716 =cut
1717  
1718 sub col
1719 {
1720 my ($self, $col) = @_;
1721 croak (__PACKAGE__."::\$matrix->col(\$col) - $col not a valid column")
1722 unless ($col < $self->cols and $col >= 0);
1723  
1724 my $colmat = Math::GSL::Matrix->new($self->rows, 1);
1725  
1726 map { gsl_matrix_set($colmat->raw, $_, 0,
1727 gsl_matrix_get($self->raw, $_, $col),
1728 )
1729 } (0 .. $self->rows-1);
1730  
1731 return $colmat;
1732 }
1733  
1734  
1735 =head3 max()
1736  
1737 Computes the maximum value of a matrix. In array context returns the maximum
1738 value and the position of that element in the matrix. If the matrix is a
1739 vector (being it vertical or horizontal) only one coordinate is returned: the
1740 position of the element in the vector.
1741  
1742 $max = $matrix->max();
1743 ($max, $i, $j) = $matrix->max();
1744  
1745 =cut
1746  
1747 sub max {
1748 my $matrix = shift;
1749  
1750 my $max = gsl_matrix_max($matrix->raw);
1751  
1752 if (wantarray) {
1753 my ($i, $j) = gsl_matrix_max_index($matrix->raw);
1754  
1755 return ($max, $j) if $matrix->rows == 1;
1756 return ($max, $i) if $matrix->cols == 1;
1757 return ($max, $i, $j);
1758  
1759 } else {
1760 return $max;
1761 }
1762 }
1763  
1764 =head3 min()
1765  
1766 Computes the minimum value of a matrix. In array context returns the minimum
1767 value and the position of that element in the matrix. If the matrix is a
1768 vector (being it vertical or horizontal) only one coordinate is returned: the
1769 position of the element in the vector.
1770  
1771 $min = $matrix->min();
1772 ($min, $i, $j) = $matrix->min();
1773  
1774 =cut
1775  
1776 sub min {
1777 my $matrix = shift;
1778  
1779 my $min = gsl_matrix_min($matrix->raw);
1780  
1781 if (wantarray) {
1782 my ($i, $j) = gsl_matrix_min_index($matrix->raw);
1783  
1784 return ($min, $j) if $matrix->rows == 1;
1785 return ($min, $i) if $matrix->cols == 1;
1786 return ($min, $i, $j);
1787  
1788 } else {
1789 return $min;
1790 }
1791 }
1792  
1793  
1794  
1795 =head2 Setters
1796  
1797 =head3 identity()
1798  
1799 Set a matrix to the identity matrix, i.e. one on the diagonal and zero elsewhere.
1800  
1801 my $I = $matrix->identity;
1802  
1803 =cut
1804  
1805 sub identity
1806 {
1807 my $self=shift;
1808 gsl_matrix_set_identity($self->raw);
1809 return $self;
1810 }
1811  
1812 =head3 zero()
1813  
1814 Set a matrix to the zero matrix.
1815  
1816 $matrix->zero;
1817  
1818 =cut
1819  
1820 sub zero # brrr!
1821 {
1822 my $self=shift;
1823 gsl_matrix_set_zero($self->raw);
1824 return $self;
1825 }
1826  
1827 =head3 set_elem()
1828  
1829 Sets a specific value in the matrix.
1830  
1831 my $matrix = Math::GSL::Matrix->new(2,2);
1832 $matrix->set_elem(0, 0, $value);
1833  
1834 You can set multiple elements at once with chained calls:
1835  
1836 $matrix->set_elem(0,0,1)->set_elem(1,1,1);
1837  
1838 B<NOTE:> just like any other method on this module, rows and arrays start
1839 with indice 0.
1840  
1841 =cut
1842  
1843 sub set_elem {
1844 my ($self, $row, $col, $value) = @_;
1845 die __PACKAGE__.'::set_elem($x, $y, $v) - $x must be a valid row number'
1846 if ($row < 0 || $row >= $self->rows);
1847 die __PACKAGE__.'::set_elem($x, $y, $v) - $y must be a valid column number'
1848 if ($col < 0 || $col >= $self->cols);
1849 gsl_matrix_set($self->raw, $row, $col, $value);
1850 return $self;
1851 }
1852  
1853 =head3 set_row()
1854  
1855 Sets a the values of a row with the elements of an array.
1856  
1857 my $matrix = Math::GSL::Matrix->new(3,3);
1858 $matrix->set_row(0, [8, 6, 2]);
1859  
1860 You can also set multiple rows at once with chained calls:
1861  
1862 my $matrix = Math::GSL::Matrix->new(3,3);
1863 $matrix->set_row(0, [8, 6, 2])
1864 ->set_row(1, [2, 4, 1]);
1865 ...
1866  
1867 =cut
1868  
1869 sub set_row {
1870 my ($self, $row, $values) = @_;
1871 my $length = $#$values;
1872 die __PACKAGE__.'::set_row($x, $values) - $values must be a nonempty array reference' if $length == -1;
1873 die __PACKAGE__.'::set_row($x, $values) - $x must be a valid row number'
1874 if ($row < 0 || $row >= $self->rows);
1875 die __PACKAGE__.'::set_row($x, $values) - $values must contains the same number of elements as there is columns in the matrix'
1876 if($length != $self->cols-1);
1877 map { gsl_matrix_set($self->raw, $row, $_, $values->[$_]) } (0..$length);
1878 return $self;
1879 }
1880  
1881 =head3 set_col()
1882  
1883 Sets a the values of a column with the elements of an array.
1884  
1885 my $matrix = Math::GSL::Matrix->new(3,3);
1886 $matrix->set_col(0, [8, 6, 2]);
1887  
1888 You can also set multiple columns at once with chained calls:
1889 my $matrix = Math::GSL::Matrix->new(3,3);
1890 $matrix->set_col(0, [8, 6, 2])
1891 ->set_col(1, [2, 4, 1]);
1892 ...
1893  
1894 =cut
1895  
1896 sub set_col {
1897 my ($self, $col, $values) = @_;
1898 my $length = $#$values;
1899  
1900 die __PACKAGE__.'::set_col($x, $values) - $values must be a nonempty array reference' if $length == -1;
1901 die __PACKAGE__.'::set_col($x, $values) - $x must be a valid column number'
1902 if ($col < 0 || $col >= $self->cols);
1903 die __PACKAGE__.'::set_col($x, $values) - $values must contains the same number of elements as there is rowss in the matrix'
1904 if($length != $self->rows-1);
1905  
1906 map { gsl_matrix_set($self->raw, $_, $col, $values->[$_]) } (0..$length);
1907 return $self;
1908 }
1909  
1910 =head2 Utility Functions
1911  
1912 =head3 copy()
1913  
1914 Returns a copy of the matrix, which has the same size and values but resides at a different location in memory.
1915  
1916 my $matrix = Math::GSL::Matrix->new(5,5);
1917 my $copy = $matrix->copy;
1918  
1919 =cut
1920  
1921 sub copy {
1922 my $self = shift;
1923 my $copy = Math::GSL::Matrix->new( $self->rows, $self->cols );
1924 if ( gsl_matrix_memcpy($copy->raw, $self->raw) != $GSL_SUCCESS ) {
1925 croak "Math::GSL - error copying memory, aborting";
1926 }
1927 return $copy;
1928 }
1929  
1930  
1931  
1932  
1933 =head3 is_square()
1934  
1935 Returns true if a matrix is square, i.e. it has the same number of rows as columns, false otherwise.
1936  
1937 =cut
1938  
1939 sub is_square($)
1940 {
1941 my $self = shift;
1942 return ($self->rows == $self->cols) ? 1 : 0 ;
1943 }
1944  
1945 =head3 det()
1946  
1947 Returns the determinant of a matrix (computed by LU decomposition) or dies if called on a non-square matrix.
1948  
1949 my $det = $matrix->det();
1950  
1951 =cut
1952  
1953 sub det($)
1954 {
1955 my $self = shift;
1956 croak(__PACKAGE__."- determinant only exists for square matrices") unless $self->is_square;
1957  
1958 my $p = Math::GSL::Permutation->new( $self->rows );
1959 my $LU = $self->copy;
1960  
1961 my ($result, $s) = gsl_linalg_LU_decomp($LU->raw, $p->raw);
1962 return gsl_linalg_LU_det($LU->raw, $s );
1963 }
1964  
1965 =head3 write
1966  
1967 Saves B<ONE> matrix into a file using the GSL binary format.
1968  
1969 $matrix->save("matrix.dat");
1970  
1971 Note that this method always overwrite the file if it exists. In case more
1972 than one GSL object will be written to the file, please use the C<gsl_fopen>,
1973 C<gsl_matrix_fwrite> and C<gsl_fclose> manually. Future versions might include
1974 helper for this task.
1975  
1976 B<NOTE>: in order to allow the read of one of these files without needing
1977 to know in advance the size of the matrix, an horizontal matrix with two
1978 elements is saved in the beginning of the file with the number of rows
1979 and columns of the saved matrix.
1980  
1981 =cut
1982  
1983 sub write
1984 {
1985 my ($self, $filename) = @_;
1986  
1987 my $fh = gsl_fopen($filename, "w");
1988 croak __PACKAGE__."::write - error opening file $filename for writing" unless $fh;
1989  
1990 # create a temporary matrix with the main matrix dimensions
1991 my $dim = gsl_matrix_alloc(1, 2);
1992 my ($rows, $cols) = $self->dim;
1993 gsl_matrix_set($dim, 0, 0, $rows);
1994 gsl_matrix_set($dim, 0, 1, $cols);
1995  
1996 my $err = gsl_matrix_fwrite($fh, $dim);
1997 croak __PACKAGE__."::write - error writing matrix" if $err;
1998  
1999 gsl_matrix_free($dim);
2000  
2001 $err = gsl_matrix_fwrite($fh, $self->raw);
2002 croak __PACKAGE__."::write - error writing matrix" if $err;
2003  
2004 gsl_fclose($fh);
2005 }
2006  
2007 =head3 read
2008  
2009 Loads a matrix from a GSL binary file (saved using the C<save> method,
2010 as it stores some extra information on the file).
2011  
2012 my $matrix = Math::GSL::Matrix->read("matrix.dat");
2013  
2014 =cut
2015  
2016 sub read
2017 {
2018 my ($class, $filename) = @_;
2019 croak __PACKAGE__."::read - $filename does not exist" unless -f $filename;
2020  
2021 my $fh = gsl_fopen($filename, "r");
2022 croak __PACKAGE__."::read - error opening file $filename for reading" unless $fh;
2023  
2024 my $dim = gsl_matrix_alloc(1, 2);
2025 my $err = gsl_matrix_fread($fh, $dim);
2026 croak __PACKAGE__."::read - error reading matrix" if $err;
2027  
2028 my $m = gsl_matrix_alloc(gsl_matrix_get($dim, 0, 0),
2029 gsl_matrix_get($dim, 0, 1));
2030 $err = gsl_matrix_fread($fh, $m);
2031 croak __PACKAGE__."::read - error reading matrix" if $err;
2032  
2033 gsl_matrix_free($dim);
2034  
2035 gsl_fclose($fh);
2036 return Math::GSL::Matrix->new($m);
2037 }
2038  
2039 =head3 lndet()
2040  
2041 Returns the natural log of the absolute value of the determinant of a matrix (computed by LU decomposition) or dies if called on a non-square matrix.
2042  
2043 my $lndet = $matrix->lndet();
2044  
2045 =cut
2046  
2047 sub lndet($)
2048 {
2049 my $self = shift;
2050 croak(__PACKAGE__."- log determinant only exists for square matrices") unless $self->is_square;
2051  
2052 my $p = Math::GSL::Permutation->new( $self->rows );
2053 my $LU = $self->copy;
2054  
2055 gsl_linalg_LU_decomp($LU->raw, $p->raw);
2056 return gsl_linalg_LU_lndet($LU->raw);
2057 }
2058  
2059 =head3 inverse()
2060  
2061 Returns the inverse of a matrix or dies when called on a non-square matrix.
2062  
2063 my $inverse = $matrix->inverse;
2064  
2065 =cut
2066  
2067 sub inverse($)
2068 {
2069 my $self = shift;
2070 croak(__PACKAGE__."- inverse only exists for square matrices") unless $self->is_square;
2071  
2072 my $p = Math::GSL::Permutation->new( $self->rows );
2073 my $LU = $self->copy;
2074 my $inverse = $self->copy;
2075  
2076 # should check return status
2077 gsl_linalg_LU_decomp($LU->raw, $p->raw);
2078 gsl_linalg_LU_invert($LU->raw, $p->raw,$inverse->raw);
2079  
2080 return $inverse;
2081  
2082 }
2083  
2084 =head3 transpose()
2085  
2086 Returns the transpose of a matrix or dies when called on a non-square matrix.
2087  
2088 my $transposed = $matrix->transpose;
2089  
2090 =cut
2091  
2092 sub transpose($)
2093 {
2094 my $self = shift;
2095 croak(__PACKAGE__."- transpose only exists for square matrices") unless $self->is_square;
2096  
2097 my $copy = $self->copy;
2098  
2099 # should check return status
2100 gsl_matrix_transpose($copy->raw);
2101  
2102 return $copy;
2103 }
2104  
2105 =head3 eigenvalues()
2106  
2107 Computes the a matrix eigen values.
2108  
2109 =cut
2110  
2111  
2112 sub eigenvalues($)
2113 {
2114 my $self=shift;
2115 my ($r,$c) = ($self->rows,$self->cols);
2116 croak "Math::GSL::Matrix : \$matrix->eigenvalues - \$matrix must be square" unless ($r == $c);
2117 my $evec = gsl_matrix_complex_alloc($r,$c);
2118 my $eigen = gsl_eigen_nonsymmv_alloc($r);
2119 my $vector = gsl_vector_complex_alloc($r);
2120  
2121 gsl_eigen_nonsymmv($self->raw, $vector, $evec, $eigen);
2122  
2123 my $x = gsl_vector_complex_real($vector); # vector of real components
2124 my $y = gsl_vector_complex_imag($vector); # vector of imaginary components
2125  
2126 return map {
2127 _as_complex( gsl_vector_get($x->{vector}, $_) ,
2128 gsl_vector_get($y->{vector}, $_) )
2129 } (0 .. $r-1);
2130  
2131 }
2132  
2133 =head3 eigenpair()
2134  
2135 =cut
2136  
2137  
2138 sub eigenpair($)
2139 {
2140 my $self=shift;
2141 my ($r,$c) = ($self->rows,$self->cols);
2142 croak "Math::GSL::Matrix : \$matrix->eigenvalues - \$matrix must be square" unless ($r == $c);
2143 my $evec = Math::GSL::MatrixComplex->new($r,$c);
2144 my $eigen = gsl_eigen_nonsymmv_alloc($r);
2145 my $vector = Math::GSL::VectorComplex->new($r);
2146  
2147 gsl_eigen_nonsymmv($self->raw, $vector->raw, $evec->raw, $eigen);
2148  
2149 my $eigenvectors = [ map { $evec->col($_)->as_vector } (0 .. $r-1) ];
2150  
2151 my $x = gsl_vector_complex_real($vector->raw); # vector of real components
2152 my $y = gsl_vector_complex_imag($vector->raw); # vector of imaginary components
2153 my $eigenvalues = [
2154 map {
2155 _as_complex( gsl_vector_get($x->{vector}, $_) ,
2156 gsl_vector_get($y->{vector}, $_) )
2157 } (0 .. $r-1)
2158 ];
2159 return ($eigenvalues, $eigenvectors);
2160 }
2161  
2162 sub _as_complex {
2163 my ($w,$v) = @_;
2164 my ($x,$y) = ($w,$v);
2165 if( ref $w eq 'Math::GSL::Complex') {
2166 ($x,$y) = (gsl_real($w),gsl_imag($w));
2167 }
2168 my $z = Math::Complex->make( $x, $y);
2169 }
2170  
2171  
2172 =head3 ieach()
2173  
2174 Applied a function to each element of a matrix.
2175  
2176 # compute exp to each element of matrix
2177 $matrix->ieach( sub { exp(shift) });
2178  
2179 This method B<changes> the original matrix. See C<each> for a
2180 non destructive method.
2181  
2182 =cut
2183  
2184 sub ieach($&) {
2185 my ($matrix, $func) = @_;
2186  
2187 die __PACKAGE__.'::ieach($func) - $func must be a code reference'
2188 unless ref($func) eq "CODE";
2189  
2190  
2191 for my $i (0 .. $matrix->rows-1) {
2192 for my $j (0 .. $matrix->cols-1) {
2193 # should be faster than use ->set_elem and ->get_elem
2194 gsl_matrix_set($matrix->raw, $i, $j,
2195 $func->(gsl_matrix_get($matrix->raw, $i, $j)));
2196 }
2197 }
2198 return $matrix;
2199 }
2200  
2201  
2202 =head3 each()
2203  
2204 Applied a function to each element of a matrix.
2205  
2206 # compute exp to each element of matrix
2207 $matrix->each( sub { exp(shift) });
2208  
2209 This method returns a B<new> matrix.
2210  
2211 =cut
2212  
2213 sub each($&) {
2214 my ($matrix, $func) = @_;
2215  
2216 die __PACKAGE__.'::each($func) - $func must be a code reference'
2217 unless ref($func) eq "CODE";
2218  
2219 my $result = Math::GSL::Matrix->new($matrix->rows, $matrix->cols);
2220 for my $i (0 .. $matrix->rows-1) {
2221 for my $j (0 .. $matrix->cols-1) {
2222 # should be faster than use ->set_elem and ->get_elem
2223 gsl_matrix_set($result->raw, $i, $j,
2224 $func->(gsl_matrix_get($matrix->raw, $i, $j)));
2225 }
2226 }
2227 return $result;
2228 }
2229  
2230 =head3 vconcat ()
2231  
2232 Concatenates vertically a new matrix with the object matrix, where the
2233 object matrix is above in the final matrix.
2234 Note that both matrices need to have the same number of columns.
2235 The method returns a B<new> matrix.
2236  
2237 my $final = $m1->vconcat($m2);
2238 # $final is $m1 on top of $m2
2239  
2240 =cut
2241  
2242 sub vconcat {
2243 my ($self, $b) = @_;
2244  
2245 die __PACKAGE__.'::vconcat($m) - $m must be a Math::GSL::Matrix object'
2246 unless blessed($b) && $b->isa('Math::GSL::Matrix');
2247 die __PACKAGE__.'::vconcat($m) - $self and $m should have same number of columns'
2248 unless $self->cols == $b->cols;
2249  
2250 bless {
2251 _matrix => gsl_matrix_vconcat($self->raw, $b->raw),
2252 _rows => $self->rows + $b->rows,
2253 _cols => $self->cols
2254 }, 'Math::GSL::Matrix'
2255 }
2256  
2257 =head3 hconcat ()
2258  
2259 Concatenates horizontally a new matrix with the object matrix, where the
2260 object matrix is at the left in the final matrix.
2261 Note that both matrices need to have the same number of rows.
2262 The method returns a B<new> matrix.
2263  
2264 my $final = $m1->hconcat($m2);
2265 # $final is $m1 at the left of $m2
2266  
2267 =cut
2268  
2269 sub hconcat {
2270 my ($self, $b) = @_;
2271  
2272 die __PACKAGE__.'::hconcat($m) - $m must be a Math::GSL::Matrix object'
2273 unless blessed($b) && $b->isa('Math::GSL::Matrix');
2274 die __PACKAGE__.'::hconcat($m) - $self and $m should have same number of rows'
2275 unless $self->rows == $b->rows;
2276  
2277 bless {
2278 _matrix => gsl_matrix_hconcat($self->raw, $b->raw),
2279 _rows => $self->rows,
2280 _cols => $self->cols + $b->cols,
2281 }, 'Math::GSL::Matrix'
2282 }
2283  
2284 =head3 random ()
2285  
2286 Fills a matrix with random values between 0 and 1
2287  
2288 =cut
2289  
2290 sub random {
2291 my ($self) = @_;
2292
2293 gsl_matrix_random($self->raw);
2294
2295 return $self;
2296 }
2297  
2298  
2299  
2300  
2301 sub _addition {
2302 my ($left, $right) = @_;
2303  
2304 my $lcopy = $left->copy;
2305  
2306 if ( blessed $right && $right->isa('Math::GSL::Matrix') && blessed $left && $left->isa('Math::GSL::Matrix') ) {
2307 if ( $left->cols == $right->cols && $left->rows == $right->rows ) {
2308 gsl_matrix_add($lcopy->raw, $right->raw);
2309 } else {
2310 croak "Math::GSL - addition of matrices must be called with two objects matrices and must have the same number of columns and rows";
2311 }
2312 } else {
2313 gsl_matrix_add_constant($lcopy->raw, $right);
2314 }
2315 return $lcopy;
2316 }
2317  
2318 sub _subtract {
2319 my ($left, $right) = @_;
2320  
2321 my $lcopy = $left->copy;
2322  
2323 if ( blessed $right && $right->isa('Math::GSL::Matrix') && blessed $left && $left->isa('Math::GSL::Matrix') ) {
2324 if ( $left->cols == $right->cols && $left->rows == $right->rows ) {
2325 gsl_matrix_sub($lcopy->raw, $right->raw);
2326 } else {
2327 croak "Math::GSL - subtraction of matrices must be called with two objects matrices and must have the same number of columns and rows";
2328 }
2329 } else {
2330 gsl_matrix_add_constant($lcopy->raw, $right*-1);
2331 }
2332 return $lcopy;
2333 }
2334  
2335 sub _multiplication {
2336 my ($left,$right) = @_;
2337 my $lcopy = $left->copy;
2338  
2339 if ( blessed $right && $right->isa('Math::GSL::Matrix') ) {
2340 return _dot_product($left,$right);
2341 } else {
2342 gsl_matrix_scale($lcopy->raw, $right);
2343 }
2344 return $lcopy;
2345 }
2346  
2347 sub _equal {
2348 my ($left, $right) = @_;
2349  
2350 return is_similar( [ $left->as_list ], [ $right->as_list ] );
2351 }
2352  
2353 sub _not_equal {
2354 my ($left, $right) = @_;
2355 return !is_similar( [ $left->as_list ], [ $right->as_list ] );
2356 }
2357  
2358 sub _dot_product {
2359 my ($left,$right) = @_;
2360  
2361 croak "Math::GSL::Matrix - incompatible matrices in multiplication"
2362 unless ( blessed $right && $right->isa('Math::GSL::Matrix') and $left->cols == $right->rows );
2363 my $C = Math::GSL::Matrix->new($left->rows, $right->cols);
2364 gsl_blas_dgemm($CblasNoTrans, $CblasNoTrans, 1, $left->raw, $right->raw, 0, $C->raw);
2365 return $C;
2366 }
2367  
2368 sub DESTROY {
2369 my $self = shift;
2370  
2371 # during global phase of destruction there is no
2372 # sure that objects are destroyed in order. So, when
2373 # going out, just do not destroy anything. The Operating
2374 # System should do us for us.
2375 return if defined(${^GLOBAL_PHASE}) && ${^GLOBAL_PHASE} eq 'DESTRUCT';
2376  
2377 gsl_matrix_free($self->raw) if defined($self->raw);
2378 }
2379  
2380 =head1 GSL FUNCTION INTERFACE
2381  
2382 Here is a list of all the functions included in this module :
2383  
2384 =over 1
2385  
2386 =item C<gsl_matrix_alloc($i, $j)> - Return a gsl_matrix of $i rows and $j columns
2387  
2388 =item C<gsl_matrix_calloc($i, $j)> - Return a gsl_matrix of $i rows and $j columns and initialize all of the elements of the matrix to zero
2389  
2390 =item C<gsl_matrix_alloc_from_block> -
2391  
2392 =item C<gsl_matrix_free> -
2393  
2394 =item C<gsl_matrix_alloc_from_matrix > -
2395  
2396 =item C<gsl_vector_alloc_row_from_matrix> -
2397  
2398 =item C<gsl_vector_alloc_col_from_matrix > -
2399  
2400 =item C<gsl_matrix_submatrix($m, $k1, $k2, $n1, $n2)> - Return a matrix view of the matrix $m. The upper-left element of the submatrix is the element ($k1,$k2) of the original matrix. The submatrix has $n1 rows and $n2 columns.
2401  
2402 =item C<gsl_matrix_row($m , $i)> - Return a vector view of the $i-th row of the matrix $m
2403  
2404 =item C<gsl_matrix_column($m, $j)> - Return a vector view of the $j-th column of the matrix $m
2405  
2406 =item C<gsl_matrix_diagonal($m)> - Return a vector view of the diagonal of the vector. The matrix doesn't have to be square.
2407  
2408 =item C<gsl_matrix_subdiagonal($m, $k)> - Return a vector view of the $k-th subdiagonal of the matrix $m. The diagonal of the matrix corresponds to k=0.
2409  
2410 =item C<gsl_matrix_superdiagonal($m, $k)> - Return a vector view of the $k-th superdiagonal of the matrix $m. The matrix doesn't have to be square.
2411  
2412 =item C<gsl_matrix_subrow($m, $i, $offset, $n)> - Return a vector view of the $i-th row of the matrix $m beginning at offset elements and containing n elements.
2413  
2414 =item C<gsl_matrix_subcolumn($m, $j, $offset, $n)> - Return a vector view of the $j-th column of the matrix $m beginning at offset elements and containing n elements.
2415  
2416 =item C<gsl_matrix_view_array($base, $n1, $n2)> - This function returns a matrix view of the array reference $base. The matrix has $n1 rows and $n2 columns. The physical number of columns in memory is also given by $n2. Mathematically, the (i,j)-th element of the new matrix is given by, m'(i,j) = $base->[i*$n2 + j] where the index i runs from 0 to $n1-1 and the index j runs from 0 to $n2-1. The new matrix is only a view of the array reference $base. When the view goes out of scope the original array reference $base will continue to exist. The original memory can only be deallocated by freeing the original array. Of course, the original array should not be deallocated while the view is still in use.
2417  
2418 =item C<gsl_matrix_view_array_with_tda($base, $n1, $n2, $tda)> - This function returns a matrix view of the array reference $base with a physical number of columns $tda which may differ from the corresponding dimension of the matrix. The matrix has $n1 rows and $n2 columns, and the physical number of columns in memory is given by $tda. Mathematically, the (i,j)-th element of the new matrix is given by, m'(i,j) = $base->[i*$tda + j] where the index i runs from 0 to $n1-1 and the index j runs from 0 to $n2-1. The new matrix is only a view of the array reference $base. When the view goes out of scope the original array reference $base will continue to exist. The original memory can only be deallocated by freeing the original array. Of course, the original array should not be deallocated while the view is still in use.
2419  
2420 =item C<gsl_matrix_view_vector> -
2421  
2422 =item C<gsl_matrix_view_vector_with_tda> -
2423  
2424 =item C<gsl_matrix_const_submatrix> -
2425  
2426 =item C<gsl_matrix_get($m, $i, $j)> - Return the (i,j)-th element of the matrix $m
2427  
2428 =item C<gsl_matrix_set($m, $i, $j, $x)> - Set the value of the (i,j)-th element of the matrix $m to $x
2429  
2430 =item C<gsl_matrix_ptr> -
2431  
2432 =item C<gsl_matrix_const_ptr> -
2433  
2434 =item C<gsl_matrix_set_zero($m)> - Set all the elements of the matrix $m to zero
2435  
2436 =item C<gsl_matrix_set_identity($m)> - Set the elements of the matrix $m to the corresponding elements of the identity matrix
2437  
2438 =item C<gsl_matrix_set_all($m, $x)> - Set all the elements of the matrix $m to the value $x
2439  
2440 =item C<gsl_matrix_fread($fh, $m)> - Read a file which has been written with gsl_matrix_fwrite from the stream $fh opened with the gsl_fopen function from the Math::GSL module and stores the data inside the matrix $m
2441  
2442 =item C<gsl_matrix_fwrite($fh, $m)> - Write the elements of the matrix $m in binary format to a stream $fh opened with the gsl_fopen function from the Math::GSL module
2443  
2444 =item C<gsl_matrix_fscanf($fh, $m)> - Read a file which has been written with gsl_matrix_fprintf from the stream $fh opened with the gsl_fopenfunction from the Math::GSL module and stores the data inside the matrix $m
2445  
2446 =item C<gsl_matrix_fprintf($fh, $m, $format)> - Write the elements of the matrix $m in the format $format (for example "%f" is the format for double) to a stream $fh opened with the gsl_fopen function from the Math::GSL module
2447  
2448 =item C<gsl_matrix_memcpy($dest, $src)> - Copy the elements of the matrix $src to the matrix $dest. The two matrices must have the same size.
2449  
2450 =item C<gsl_matrix_swap($m1, $m2)> - Exchange the elements of the matrices $m1 and $m2 by copying. The two matrices must have the same size.
2451  
2452 =item C<gsl_matrix_swap_rows($m, $i, $j)> - Exchange the $i-th and $j-th row of the matrix $m. The function returns 0 if the operation suceeded, 1 otherwise.
2453  
2454 =item C<gsl_matrix_swap_columns($m, $i, $j)> - Exchange the $i-th and $j-th column of the matrix $m. The function returns 0 if the operation suceeded, 1 otherwise.
2455  
2456 =item C<gsl_matrix_swap_rowcol($m, $i, $j)> - Exchange the $i-th row and the $j-th column of the matrix $m. The matrix must be square. The function returns 0 if the operation suceeded, 1 otherwise.
2457  
2458 =item C<gsl_matrix_transpose($m)> - This function replaces the matrix m by its transpose by copying the elements of the matrix in-place. The matrix must be square for this operation to be possible.
2459  
2460 =item C<gsl_matrix_transpose_memcpy($dest, $src)> - Make the matrix $dest the transpose of the matrix $src. This function works for all matrices provided that the dimensions of the matrix dest match the transposed dimensions of the matrix src.
2461  
2462 =item C<gsl_matrix_max($m)> - Return the maximum value in the matrix $m
2463  
2464 =item C<gsl_matrix_min($m)> - Return the minimum value in the matrix $m
2465  
2466 =item C<gsl_matrix_minmax($m)> - Return two values, the first is the minimum value of the Matrix $m and the second is the maximum of the same the same matrix.
2467  
2468 =item C<gsl_matrix_max_index($m)> - Return two values, the first is the the i indice of the maximum value of the matrix $m and the second is the j indice of the same value.
2469  
2470 =item C<gsl_matrix_min_index($m)> - Return two values, the first is the the i indice of the minimum value of the matrix $m and the second is the j indice of the same value.
2471  
2472 =item C<gsl_matrix_minmax_index($m)> - Return four values, the first is the i indice of the minimum of the matrix $m, the second is the j indice of the same value, the third is the i indice of the maximum of the matrix $m and the fourth is the j indice of the same value
2473  
2474 =item C<gsl_matrix_isnull($m)> - Return 1 if all the elements of the matrix $m are zero, 0 otherwise
2475  
2476 =item C<gsl_matrix_ispos($m)> - Return 1 if all the elements of the matrix $m are strictly positve, 0 otherwise
2477  
2478 =item C<gsl_matrix_isneg($m)> - Return 1 if all the elements of the matrix $m are strictly negative, 0 otherwise
2479  
2480 =item C<gsl_matrix_isnonneg($m)> - Return 1 if all the elements of the matrix $m are non-negatuive, 0 otherwise
2481  
2482 =item C<gsl_matrix_add($a, $b)> - Add the elements of matrix $b to the elements of matrix $a
2483  
2484 =item C<gsl_matrix_sub($a, $b)> - Subtract the elements of matrix $b from the elements of matrix $a
2485  
2486 =item C<gsl_matrix_mul_elements($a, $b)> - Multiplie the elements of matrix $a by the elements of matrix $b
2487  
2488 =item C<gsl_matrix_div_elements($a, $b)> - Divide the elements of matrix $a by the elements of matrix $b
2489  
2490 =item C<gsl_matrix_scale($a, $x)> - Multiplie the elements of matrix $a by the constant factor $x
2491  
2492 =item C<gsl_matrix_add_constant($a, $x)> - Add the constant value $x to the elements of the matrix $a
2493  
2494 =item C<gsl_matrix_add_diagonal($a, $x)> - Add the constant value $x to the elements of the diagonal of the matrix $a
2495  
2496 =item C<gsl_matrix_get_row($v, $m, $i)> - Copy the elements of the $i-th row of the matrix $m into the vector $v. The lenght of the vector must be of the same as the lenght of the row. The function returns 0 if it succeded, 1 otherwise.
2497  
2498 =item C<gsl_matrix_get_col($v, $m, $i)> - Copy the elements of the $j-th column of the matrix $m into the vector $v. The lenght of the vector must be of the same as the lenght of the column. The function returns 0 if it succeded, 1 otherwise.
2499  
2500 =item C<gsl_matrix_set_row($m, $i, $v)> - Copy the elements of vector $v into the $i-th row of the matrix $m The lenght of the vector must be of the same as the lenght of the row. The function returns 0 if it succeded, 1 otherwise.
2501  
2502 =item C<gsl_matrix_set_col($m, $j, $v)> - Copy the elements of vector $v into the $j-th row of the matrix $m The lenght of the vector must be of the same as the lenght of the column. The function returns 0 if it succeded, 1 otherwise.
2503  
2504 =back
2505  
2506 These are related to constant views of a matrix.
2507  
2508 =over 1
2509  
2510  
2511 =item C<gsl_matrix_const_row>
2512  
2513 =item C<gsl_matrix_const_column>
2514  
2515 =item C<gsl_matrix_const_diagonal>
2516  
2517 =item C<gsl_matrix_const_subdiagonal>
2518  
2519 =item C<gsl_matrix_const_superdiagonal>
2520  
2521 =item C<gsl_matrix_const_subrow>
2522  
2523 =item C<gsl_matrix_const_subcolumn>
2524  
2525 =item C<gsl_matrix_const_view_array>
2526  
2527 =item C<gsl_matrix_const_view_array_with_tda>
2528  
2529 =back
2530  
2531  
2532 The following functions are similar to those above but work with C<char>'s and C<int>'s. We are not quite
2533 sure if anyone wants these. Please speak up if you do and/or submit some patches to this documentation, please!
2534  
2535 =over 1
2536  
2537  
2538 =item gsl_matrix_const_view_vector
2539  
2540 =item gsl_matrix_const_view_vector_with_tda
2541  
2542 =item gsl_matrix_char_alloc
2543  
2544 =item gsl_matrix_char_calloc
2545  
2546 =item gsl_matrix_char_alloc_from_block
2547  
2548 =item gsl_matrix_char_alloc_from_matrix
2549  
2550 =item gsl_vector_char_alloc_row_from_matrix
2551  
2552 =item gsl_vector_char_alloc_col_from_matrix
2553  
2554 =item gsl_matrix_char_free
2555  
2556 =item gsl_matrix_char_submatrix
2557  
2558 =item gsl_matrix_char_row
2559  
2560 =item gsl_matrix_char_column
2561  
2562 =item gsl_matrix_char_diagonal
2563  
2564 =item gsl_matrix_char_subdiagonal
2565  
2566 =item gsl_matrix_char_superdiagonal
2567  
2568 =item gsl_matrix_char_subrow
2569  
2570 =item gsl_matrix_char_subcolumn
2571  
2572 =item gsl_matrix_char_view_array
2573  
2574 =item gsl_matrix_char_view_array_with_tda
2575  
2576 =item gsl_matrix_char_view_vector
2577  
2578 =item gsl_matrix_char_view_vector_with_tda
2579  
2580 =item gsl_matrix_char_const_submatrix
2581  
2582 =item gsl_matrix_char_const_row
2583  
2584 =item gsl_matrix_char_const_column
2585  
2586 =item gsl_matrix_char_const_diagonal
2587  
2588 =item gsl_matrix_char_const_subdiagonal
2589  
2590 =item gsl_matrix_char_const_superdiagonal
2591  
2592 =item gsl_matrix_char_const_subrow
2593  
2594 =item gsl_matrix_char_const_subcolumn
2595  
2596 =item gsl_matrix_char_const_view_array
2597  
2598 =item gsl_matrix_char_const_view_array_with_tda
2599  
2600 =item gsl_matrix_char_const_view_vector
2601  
2602 =item gsl_matrix_char_const_view_vector_with_tda
2603  
2604 =item gsl_matrix_char_get
2605  
2606 =item gsl_matrix_char_set
2607  
2608 =item gsl_matrix_char_ptr
2609  
2610 =item gsl_matrix_char_const_ptr
2611  
2612 =item gsl_matrix_char_set_zero
2613  
2614 =item gsl_matrix_char_set_identity
2615  
2616 =item gsl_matrix_char_set_all
2617  
2618 =item gsl_matrix_char_fread
2619  
2620 =item gsl_matrix_char_fwrite
2621  
2622 =item gsl_matrix_char_fscanf
2623  
2624 =item gsl_matrix_char_fprintf
2625  
2626 =item gsl_matrix_char_memcpy
2627  
2628 =item gsl_matrix_char_swap
2629  
2630 =item gsl_matrix_char_swap_rows
2631  
2632 =item gsl_matrix_char_swap_columns
2633  
2634 =item gsl_matrix_char_swap_rowcol
2635  
2636 =item gsl_matrix_char_transpose
2637  
2638 =item gsl_matrix_char_transpose_memcpy
2639  
2640 =item gsl_matrix_char_max
2641  
2642 =item gsl_matrix_char_min
2643  
2644 =item gsl_matrix_char_minmax
2645  
2646 =item gsl_matrix_char_max_index
2647  
2648 =item gsl_matrix_char_min_index
2649  
2650 =item gsl_matrix_char_minmax_index
2651  
2652 =item gsl_matrix_char_isnull
2653  
2654 =item gsl_matrix_char_ispos
2655  
2656 =item gsl_matrix_char_isneg
2657  
2658 =item gsl_matrix_char_isnonneg
2659  
2660 =item gsl_matrix_char_add
2661  
2662 =item gsl_matrix_char_sub
2663  
2664 =item gsl_matrix_char_mul_elements
2665  
2666 =item gsl_matrix_char_div_elements
2667  
2668 =item gsl_matrix_char_scale
2669  
2670 =item gsl_matrix_char_add_constant
2671  
2672 =item gsl_matrix_char_add_diagonal
2673  
2674 =item gsl_matrix_int_alloc
2675  
2676 =item gsl_matrix_int_calloc
2677  
2678 =item gsl_matrix_int_alloc_from_block
2679  
2680 =item gsl_matrix_int_alloc_from_matrix
2681  
2682 =item gsl_vector_int_alloc_row_from_matrix
2683  
2684 =item gsl_vector_int_alloc_col_from_matrix
2685  
2686 =item gsl_matrix_int_free
2687  
2688 =item gsl_matrix_int_submatrix
2689  
2690 =item gsl_matrix_int_row
2691  
2692 =item gsl_matrix_int_column
2693  
2694 =item gsl_matrix_int_diagonal
2695  
2696 =item gsl_matrix_int_subdiagonal
2697  
2698 =item gsl_matrix_int_superdiagonal
2699  
2700 =item gsl_matrix_int_subrow
2701  
2702 =item gsl_matrix_int_subcolumn
2703  
2704 =item gsl_matrix_int_view_array
2705  
2706 =item gsl_matrix_int_view_array_with_tda
2707  
2708 =item gsl_matrix_int_view_vector
2709  
2710 =item gsl_matrix_int_view_vector_with_tda
2711  
2712 =item gsl_matrix_int_const_submatrix
2713  
2714 =item gsl_matrix_int_const_row
2715  
2716 =item gsl_matrix_int_const_column
2717  
2718 =item gsl_matrix_int_ptr
2719  
2720 =item gsl_matrix_int_const_ptr
2721  
2722 =item gsl_matrix_int_set_zero
2723  
2724 =item gsl_matrix_int_set_identity
2725  
2726 =item gsl_matrix_int_set_all
2727  
2728 =item gsl_matrix_int_fread
2729  
2730 =item gsl_matrix_int_fwrite
2731  
2732 =item gsl_matrix_int_fscanf
2733  
2734 =item gsl_matrix_int_fprintf
2735  
2736 =item gsl_matrix_int_memcpy
2737  
2738 =item gsl_matrix_int_swap
2739  
2740 =item gsl_matrix_int_swap_rows
2741  
2742 =item gsl_matrix_int_swap_columns
2743  
2744 =item gsl_matrix_int_swap_rowcol
2745  
2746 =item gsl_matrix_int_transpose
2747  
2748 =item gsl_matrix_int_transpose_memcpy
2749  
2750 =item gsl_matrix_int_max
2751  
2752 =item gsl_matrix_int_min
2753  
2754 =item gsl_matrix_int_minmax
2755  
2756 =item gsl_matrix_int_max_index
2757  
2758 =item gsl_matrix_int_min_index
2759  
2760 =item gsl_matrix_int_minmax_index
2761  
2762 =item gsl_matrix_int_isnull
2763  
2764 =item gsl_matrix_int_ispos
2765  
2766 =item gsl_matrix_int_isneg
2767  
2768 =item gsl_matrix_int_isnonneg
2769  
2770 =item gsl_matrix_int_add
2771  
2772 =item gsl_matrix_int_sub
2773  
2774 =item gsl_matrix_int_mul_elements
2775  
2776 =item gsl_matrix_int_div_elements
2777  
2778 =item gsl_matrix_int_scale
2779  
2780 =item gsl_matrix_int_add_constant
2781  
2782 =item gsl_matrix_int_add_diagonal
2783  
2784 =back
2785  
2786 You have to add the functions you want to use inside the qw /put_function_here /.
2787 You can also write use Math::GSL::Matrix qw/:all/ to use all available functions of the module.
2788 Other tags are also available, here is a complete list of all tags for this module :
2789  
2790 =over 1
2791  
2792 =item C<all>
2793  
2794 =item C<int>
2795  
2796 =item C<double>
2797  
2798 =item C<char>
2799  
2800 =item C<complex>
2801  
2802 =back
2803  
2804 For more informations on the functions, we refer you to the GSL official documentation
2805 L<http://www.gnu.org/software/gsl/manual/html_node/>
2806  
2807  
2808  
2809 =head1 EXAMPLES
2810  
2811 Most of the examples from this section are perl versions of the examples at L<http://www.gnu.org/software/gsl/manual/html_node/Example-programs-for-matrices.html>
2812  
2813 The program below shows how to allocate, initialize and read from a matrix using the functions gsl_matrix_alloc, gsl_matrix_set and gsl_matrix_get.
2814  
2815 use Math::GSL::Matrix qw/:all/;
2816 my $m = gsl_matrix_alloc (10,3);
2817 for my $i (0..9){
2818 for my $j (0..2){
2819 gsl_matrix_set($m, $i, $j, 0.23 + 100*$i + $j);
2820 }
2821 }
2822  
2823 for my $i (0..99){ # OUT OF RANGE ERROR
2824 for my $j (0..2){
2825 print "m($i, $j) = " . gsl_matrix_get ($m, $i, $j) . "\n";
2826 }
2827 }
2828 gsl_matrix_free ($m);
2829  
2830  
2831 use Math::GSL::Matrix qw/:all/;
2832  
2833 my $m = gsl_matrix_alloc (100, 100);
2834 my $a = gsl_matrix_alloc (100, 100);
2835  
2836 for my $i (0..99){
2837 for my $j (0..99){
2838 gsl_matrix_set ($m, $i, $j, 0.23 + $i + $j);
2839 }
2840 }
2841  
2842 The next program shows how to write a matrix to a file.
2843  
2844 my $out = gsl_fopen("test.dat", "wb");
2845 gsl_matrix_fwrite ($out, $m);
2846 gsl_fclose ($out);
2847  
2848 my $in = gsl_fopen("test.dat", "rb");
2849 gsl_matrix_fread ($in, $a);
2850 gsl_fclose($in);
2851  
2852 my $k=0;
2853 for my $i (0..99){
2854 for my $j (0..99){
2855 $mij = gsl_matrix_get ($m, $i, $j);
2856 $aij = gsl_matrix_get ($a, $i, $j);
2857 $k++ if ($mij != $aij);
2858 }
2859 }
2860  
2861 gsl_matrix_free($m);
2862 gsl_matrix_free($a);
2863  
2864 print "differences = $k (should be zero)\n";
2865  
2866 =head1 AUTHORS
2867  
2868 Jonathan "Duke" Leto <jonathan@leto.net> and Thierry Moisan <thierry.moisan@gmail.com>
2869  
2870 =head1 COPYRIGHT AND LICENSE
2871  
2872 Copyright (C) 2008-2024 Jonathan "Duke" Leto and Thierry Moisan
2873  
2874 This program is free software; you can redistribute it and/or modify it
2875 under the same terms as Perl itself.
2876  
2877 =cut
2878  
2879 1;