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