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::VectorComplex;
8use base qw(Exporter);
9use base qw(DynaLoader);
10package Math::GSL::VectorComplexc;
11bootstrap Math::GSL::VectorComplex;
12package Math::GSL::VectorComplex;
13@EXPORT = qw();
14
15# ---------- BASE METHODS -------------
16
17package Math::GSL::VectorComplex;
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::VectorComplex;
51
52*gsl_error = *Math::GSL::VectorComplexc::gsl_error;
53*gsl_stream_printf = *Math::GSL::VectorComplexc::gsl_stream_printf;
54*gsl_strerror = *Math::GSL::VectorComplexc::gsl_strerror;
55*gsl_set_error_handler = *Math::GSL::VectorComplexc::gsl_set_error_handler;
56*gsl_set_error_handler_off = *Math::GSL::VectorComplexc::gsl_set_error_handler_off;
57*gsl_set_stream_handler = *Math::GSL::VectorComplexc::gsl_set_stream_handler;
58*gsl_set_stream = *Math::GSL::VectorComplexc::gsl_set_stream;
59*gsl_vector_alloc = *Math::GSL::VectorComplexc::gsl_vector_alloc;
60*gsl_vector_calloc = *Math::GSL::VectorComplexc::gsl_vector_calloc;
61*gsl_vector_alloc_from_block = *Math::GSL::VectorComplexc::gsl_vector_alloc_from_block;
62*gsl_vector_alloc_from_vector = *Math::GSL::VectorComplexc::gsl_vector_alloc_from_vector;
63*gsl_vector_free = *Math::GSL::VectorComplexc::gsl_vector_free;
64*gsl_vector_view_array = *Math::GSL::VectorComplexc::gsl_vector_view_array;
65*gsl_vector_view_array_with_stride = *Math::GSL::VectorComplexc::gsl_vector_view_array_with_stride;
66*gsl_vector_const_view_array = *Math::GSL::VectorComplexc::gsl_vector_const_view_array;
67*gsl_vector_const_view_array_with_stride = *Math::GSL::VectorComplexc::gsl_vector_const_view_array_with_stride;
68*gsl_vector_subvector = *Math::GSL::VectorComplexc::gsl_vector_subvector;
69*gsl_vector_subvector_with_stride = *Math::GSL::VectorComplexc::gsl_vector_subvector_with_stride;
70*gsl_vector_const_subvector = *Math::GSL::VectorComplexc::gsl_vector_const_subvector;
71*gsl_vector_const_subvector_with_stride = *Math::GSL::VectorComplexc::gsl_vector_const_subvector_with_stride;
72*gsl_vector_set_zero = *Math::GSL::VectorComplexc::gsl_vector_set_zero;
73*gsl_vector_set_all = *Math::GSL::VectorComplexc::gsl_vector_set_all;
74*gsl_vector_set_basis = *Math::GSL::VectorComplexc::gsl_vector_set_basis;
75*gsl_vector_fread = *Math::GSL::VectorComplexc::gsl_vector_fread;
76*gsl_vector_fwrite = *Math::GSL::VectorComplexc::gsl_vector_fwrite;
77*gsl_vector_fscanf = *Math::GSL::VectorComplexc::gsl_vector_fscanf;
78*gsl_vector_fprintf = *Math::GSL::VectorComplexc::gsl_vector_fprintf;
79*gsl_vector_memcpy = *Math::GSL::VectorComplexc::gsl_vector_memcpy;
80*gsl_vector_reverse = *Math::GSL::VectorComplexc::gsl_vector_reverse;
81*gsl_vector_swap = *Math::GSL::VectorComplexc::gsl_vector_swap;
82*gsl_vector_swap_elements = *Math::GSL::VectorComplexc::gsl_vector_swap_elements;
83*gsl_vector_max = *Math::GSL::VectorComplexc::gsl_vector_max;
84*gsl_vector_min = *Math::GSL::VectorComplexc::gsl_vector_min;
85*gsl_vector_minmax = *Math::GSL::VectorComplexc::gsl_vector_minmax;
86*gsl_vector_max_index = *Math::GSL::VectorComplexc::gsl_vector_max_index;
87*gsl_vector_min_index = *Math::GSL::VectorComplexc::gsl_vector_min_index;
88*gsl_vector_minmax_index = *Math::GSL::VectorComplexc::gsl_vector_minmax_index;
89*gsl_vector_add = *Math::GSL::VectorComplexc::gsl_vector_add;
90*gsl_vector_sub = *Math::GSL::VectorComplexc::gsl_vector_sub;
91*gsl_vector_mul = *Math::GSL::VectorComplexc::gsl_vector_mul;
92*gsl_vector_div = *Math::GSL::VectorComplexc::gsl_vector_div;
93*gsl_vector_scale = *Math::GSL::VectorComplexc::gsl_vector_scale;
94*gsl_vector_add_constant = *Math::GSL::VectorComplexc::gsl_vector_add_constant;
95*gsl_vector_equal = *Math::GSL::VectorComplexc::gsl_vector_equal;
96*gsl_vector_isnull = *Math::GSL::VectorComplexc::gsl_vector_isnull;
97*gsl_vector_ispos = *Math::GSL::VectorComplexc::gsl_vector_ispos;
98*gsl_vector_isneg = *Math::GSL::VectorComplexc::gsl_vector_isneg;
99*gsl_vector_isnonneg = *Math::GSL::VectorComplexc::gsl_vector_isnonneg;
100*gsl_vector_get = *Math::GSL::VectorComplexc::gsl_vector_get;
101*gsl_vector_set = *Math::GSL::VectorComplexc::gsl_vector_set;
102*gsl_vector_ptr = *Math::GSL::VectorComplexc::gsl_vector_ptr;
103*gsl_vector_const_ptr = *Math::GSL::VectorComplexc::gsl_vector_const_ptr;
104*gsl_vector_complex_alloc = *Math::GSL::VectorComplexc::gsl_vector_complex_alloc;
105*gsl_vector_complex_calloc = *Math::GSL::VectorComplexc::gsl_vector_complex_calloc;
106*gsl_vector_complex_alloc_from_block = *Math::GSL::VectorComplexc::gsl_vector_complex_alloc_from_block;
107*gsl_vector_complex_alloc_from_vector = *Math::GSL::VectorComplexc::gsl_vector_complex_alloc_from_vector;
108*gsl_vector_complex_free = *Math::GSL::VectorComplexc::gsl_vector_complex_free;
109*gsl_vector_complex_view_array = *Math::GSL::VectorComplexc::gsl_vector_complex_view_array;
110*gsl_vector_complex_view_array_with_stride = *Math::GSL::VectorComplexc::gsl_vector_complex_view_array_with_stride;
111*gsl_vector_complex_const_view_array = *Math::GSL::VectorComplexc::gsl_vector_complex_const_view_array;
112*gsl_vector_complex_const_view_array_with_stride = *Math::GSL::VectorComplexc::gsl_vector_complex_const_view_array_with_stride;
113*gsl_vector_complex_subvector = *Math::GSL::VectorComplexc::gsl_vector_complex_subvector;
114*gsl_vector_complex_subvector_with_stride = *Math::GSL::VectorComplexc::gsl_vector_complex_subvector_with_stride;
115*gsl_vector_complex_const_subvector = *Math::GSL::VectorComplexc::gsl_vector_complex_const_subvector;
116*gsl_vector_complex_const_subvector_with_stride = *Math::GSL::VectorComplexc::gsl_vector_complex_const_subvector_with_stride;
117*gsl_vector_complex_real = *Math::GSL::VectorComplexc::gsl_vector_complex_real;
118*gsl_vector_complex_imag = *Math::GSL::VectorComplexc::gsl_vector_complex_imag;
119*gsl_vector_complex_const_real = *Math::GSL::VectorComplexc::gsl_vector_complex_const_real;
120*gsl_vector_complex_const_imag = *Math::GSL::VectorComplexc::gsl_vector_complex_const_imag;
121*gsl_vector_complex_set_zero = *Math::GSL::VectorComplexc::gsl_vector_complex_set_zero;
122*gsl_vector_complex_set_all = *Math::GSL::VectorComplexc::gsl_vector_complex_set_all;
123*gsl_vector_complex_set_basis = *Math::GSL::VectorComplexc::gsl_vector_complex_set_basis;
124*gsl_vector_complex_fread = *Math::GSL::VectorComplexc::gsl_vector_complex_fread;
125*gsl_vector_complex_fwrite = *Math::GSL::VectorComplexc::gsl_vector_complex_fwrite;
126*gsl_vector_complex_fscanf = *Math::GSL::VectorComplexc::gsl_vector_complex_fscanf;
127*gsl_vector_complex_fprintf = *Math::GSL::VectorComplexc::gsl_vector_complex_fprintf;
128*gsl_vector_complex_memcpy = *Math::GSL::VectorComplexc::gsl_vector_complex_memcpy;
129*gsl_vector_complex_reverse = *Math::GSL::VectorComplexc::gsl_vector_complex_reverse;
130*gsl_vector_complex_swap = *Math::GSL::VectorComplexc::gsl_vector_complex_swap;
131*gsl_vector_complex_swap_elements = *Math::GSL::VectorComplexc::gsl_vector_complex_swap_elements;
132*gsl_vector_complex_equal = *Math::GSL::VectorComplexc::gsl_vector_complex_equal;
133*gsl_vector_complex_isnull = *Math::GSL::VectorComplexc::gsl_vector_complex_isnull;
134*gsl_vector_complex_ispos = *Math::GSL::VectorComplexc::gsl_vector_complex_ispos;
135*gsl_vector_complex_isneg = *Math::GSL::VectorComplexc::gsl_vector_complex_isneg;
136*gsl_vector_complex_isnonneg = *Math::GSL::VectorComplexc::gsl_vector_complex_isnonneg;
137*gsl_vector_complex_add = *Math::GSL::VectorComplexc::gsl_vector_complex_add;
138*gsl_vector_complex_sub = *Math::GSL::VectorComplexc::gsl_vector_complex_sub;
139*gsl_vector_complex_mul = *Math::GSL::VectorComplexc::gsl_vector_complex_mul;
140*gsl_vector_complex_div = *Math::GSL::VectorComplexc::gsl_vector_complex_div;
141*gsl_vector_complex_scale = *Math::GSL::VectorComplexc::gsl_vector_complex_scale;
142*gsl_vector_complex_add_constant = *Math::GSL::VectorComplexc::gsl_vector_complex_add_constant;
143*gsl_vector_complex_get = *Math::GSL::VectorComplexc::gsl_vector_complex_get;
144*gsl_vector_complex_set = *Math::GSL::VectorComplexc::gsl_vector_complex_set;
145*gsl_vector_complex_ptr = *Math::GSL::VectorComplexc::gsl_vector_complex_ptr;
146*gsl_vector_complex_const_ptr = *Math::GSL::VectorComplexc::gsl_vector_complex_const_ptr;
147
148############# Class : Math::GSL::VectorComplex::gsl_complex ##############
149
150package Math::GSL::VectorComplex::gsl_complex;
151use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
152@ISA = qw( Math::GSL::VectorComplex );
153%OWNER = ();
154%ITERATORS = ();
155*swig_dat_get = *Math::GSL::VectorComplexc::gsl_complex_dat_get;
156*swig_dat_set = *Math::GSL::VectorComplexc::gsl_complex_dat_set;
157sub new {
158    my $pkg = shift;
159    my $self = Math::GSL::VectorComplexc::new_gsl_complex(@_);
160    bless $self, $pkg if defined($self);
161}
162
163sub DESTROY {
164    return unless $_[0]->isa('HASH');
165    my $self = tied(%{$_[0]});
166    return unless defined $self;
167    delete $ITERATORS{$self};
168    if (exists $OWNER{$self}) {
169        Math::GSL::VectorComplexc::delete_gsl_complex($self);
170        delete $OWNER{$self};
171    }
172}
173
174sub DISOWN {
175    my $self = shift;
176    my $ptr = tied(%$self);
177    delete $OWNER{$ptr};
178}
179
180sub ACQUIRE {
181    my $self = shift;
182    my $ptr = tied(%$self);
183    $OWNER{$ptr} = 1;
184}
185
186
187############# Class : Math::GSL::VectorComplex::gsl_complex_long_double ##############
188
189package Math::GSL::VectorComplex::gsl_complex_long_double;
190use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
191@ISA = qw( Math::GSL::VectorComplex );
192%OWNER = ();
193%ITERATORS = ();
194*swig_dat_get = *Math::GSL::VectorComplexc::gsl_complex_long_double_dat_get;
195*swig_dat_set = *Math::GSL::VectorComplexc::gsl_complex_long_double_dat_set;
196sub new {
197    my $pkg = shift;
198    my $self = Math::GSL::VectorComplexc::new_gsl_complex_long_double(@_);
199    bless $self, $pkg if defined($self);
200}
201
202sub DESTROY {
203    return unless $_[0]->isa('HASH');
204    my $self = tied(%{$_[0]});
205    return unless defined $self;
206    delete $ITERATORS{$self};
207    if (exists $OWNER{$self}) {
208        Math::GSL::VectorComplexc::delete_gsl_complex_long_double($self);
209        delete $OWNER{$self};
210    }
211}
212
213sub DISOWN {
214    my $self = shift;
215    my $ptr = tied(%$self);
216    delete $OWNER{$ptr};
217}
218
219sub ACQUIRE {
220    my $self = shift;
221    my $ptr = tied(%$self);
222    $OWNER{$ptr} = 1;
223}
224
225
226############# Class : Math::GSL::VectorComplex::gsl_complex_float ##############
227
228package Math::GSL::VectorComplex::gsl_complex_float;
229use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
230@ISA = qw( Math::GSL::VectorComplex );
231%OWNER = ();
232%ITERATORS = ();
233*swig_dat_get = *Math::GSL::VectorComplexc::gsl_complex_float_dat_get;
234*swig_dat_set = *Math::GSL::VectorComplexc::gsl_complex_float_dat_set;
235sub new {
236    my $pkg = shift;
237    my $self = Math::GSL::VectorComplexc::new_gsl_complex_float(@_);
238    bless $self, $pkg if defined($self);
239}
240
241sub DESTROY {
242    return unless $_[0]->isa('HASH');
243    my $self = tied(%{$_[0]});
244    return unless defined $self;
245    delete $ITERATORS{$self};
246    if (exists $OWNER{$self}) {
247        Math::GSL::VectorComplexc::delete_gsl_complex_float($self);
248        delete $OWNER{$self};
249    }
250}
251
252sub DISOWN {
253    my $self = shift;
254    my $ptr = tied(%$self);
255    delete $OWNER{$ptr};
256}
257
258sub ACQUIRE {
259    my $self = shift;
260    my $ptr = tied(%$self);
261    $OWNER{$ptr} = 1;
262}
263
264
265############# Class : Math::GSL::VectorComplex::gsl_vector ##############
266
267package Math::GSL::VectorComplex::gsl_vector;
268use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
269@ISA = qw( Math::GSL::VectorComplex );
270%OWNER = ();
271%ITERATORS = ();
272*swig_size_get = *Math::GSL::VectorComplexc::gsl_vector_size_get;
273*swig_size_set = *Math::GSL::VectorComplexc::gsl_vector_size_set;
274*swig_stride_get = *Math::GSL::VectorComplexc::gsl_vector_stride_get;
275*swig_stride_set = *Math::GSL::VectorComplexc::gsl_vector_stride_set;
276*swig_data_get = *Math::GSL::VectorComplexc::gsl_vector_data_get;
277*swig_data_set = *Math::GSL::VectorComplexc::gsl_vector_data_set;
278*swig_block_get = *Math::GSL::VectorComplexc::gsl_vector_block_get;
279*swig_block_set = *Math::GSL::VectorComplexc::gsl_vector_block_set;
280*swig_owner_get = *Math::GSL::VectorComplexc::gsl_vector_owner_get;
281*swig_owner_set = *Math::GSL::VectorComplexc::gsl_vector_owner_set;
282sub new {
283    my $pkg = shift;
284    my $self = Math::GSL::VectorComplexc::new_gsl_vector(@_);
285    bless $self, $pkg if defined($self);
286}
287
288sub DESTROY {
289    return unless $_[0]->isa('HASH');
290    my $self = tied(%{$_[0]});
291    return unless defined $self;
292    delete $ITERATORS{$self};
293    if (exists $OWNER{$self}) {
294        Math::GSL::VectorComplexc::delete_gsl_vector($self);
295        delete $OWNER{$self};
296    }
297}
298
299sub DISOWN {
300    my $self = shift;
301    my $ptr = tied(%$self);
302    delete $OWNER{$ptr};
303}
304
305sub ACQUIRE {
306    my $self = shift;
307    my $ptr = tied(%$self);
308    $OWNER{$ptr} = 1;
309}
310
311
312############# Class : Math::GSL::VectorComplex::_gsl_vector_view ##############
313
314package Math::GSL::VectorComplex::_gsl_vector_view;
315use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
316@ISA = qw( Math::GSL::VectorComplex );
317%OWNER = ();
318%ITERATORS = ();
319*swig_vector_get = *Math::GSL::VectorComplexc::_gsl_vector_view_vector_get;
320*swig_vector_set = *Math::GSL::VectorComplexc::_gsl_vector_view_vector_set;
321sub new {
322    my $pkg = shift;
323    my $self = Math::GSL::VectorComplexc::new__gsl_vector_view(@_);
324    bless $self, $pkg if defined($self);
325}
326
327sub DESTROY {
328    return unless $_[0]->isa('HASH');
329    my $self = tied(%{$_[0]});
330    return unless defined $self;
331    delete $ITERATORS{$self};
332    if (exists $OWNER{$self}) {
333        Math::GSL::VectorComplexc::delete__gsl_vector_view($self);
334        delete $OWNER{$self};
335    }
336}
337
338sub DISOWN {
339    my $self = shift;
340    my $ptr = tied(%$self);
341    delete $OWNER{$ptr};
342}
343
344sub ACQUIRE {
345    my $self = shift;
346    my $ptr = tied(%$self);
347    $OWNER{$ptr} = 1;
348}
349
350
351############# Class : Math::GSL::VectorComplex::_gsl_vector_const_view ##############
352
353package Math::GSL::VectorComplex::_gsl_vector_const_view;
354use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
355@ISA = qw( Math::GSL::VectorComplex );
356%OWNER = ();
357%ITERATORS = ();
358*swig_vector_get = *Math::GSL::VectorComplexc::_gsl_vector_const_view_vector_get;
359*swig_vector_set = *Math::GSL::VectorComplexc::_gsl_vector_const_view_vector_set;
360sub new {
361    my $pkg = shift;
362    my $self = Math::GSL::VectorComplexc::new__gsl_vector_const_view(@_);
363    bless $self, $pkg if defined($self);
364}
365
366sub DESTROY {
367    return unless $_[0]->isa('HASH');
368    my $self = tied(%{$_[0]});
369    return unless defined $self;
370    delete $ITERATORS{$self};
371    if (exists $OWNER{$self}) {
372        Math::GSL::VectorComplexc::delete__gsl_vector_const_view($self);
373        delete $OWNER{$self};
374    }
375}
376
377sub DISOWN {
378    my $self = shift;
379    my $ptr = tied(%$self);
380    delete $OWNER{$ptr};
381}
382
383sub ACQUIRE {
384    my $self = shift;
385    my $ptr = tied(%$self);
386    $OWNER{$ptr} = 1;
387}
388
389
390############# Class : Math::GSL::VectorComplex::gsl_vector_complex ##############
391
392package Math::GSL::VectorComplex::gsl_vector_complex;
393use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
394@ISA = qw( Math::GSL::VectorComplex );
395%OWNER = ();
396%ITERATORS = ();
397*swig_size_get = *Math::GSL::VectorComplexc::gsl_vector_complex_size_get;
398*swig_size_set = *Math::GSL::VectorComplexc::gsl_vector_complex_size_set;
399*swig_stride_get = *Math::GSL::VectorComplexc::gsl_vector_complex_stride_get;
400*swig_stride_set = *Math::GSL::VectorComplexc::gsl_vector_complex_stride_set;
401*swig_data_get = *Math::GSL::VectorComplexc::gsl_vector_complex_data_get;
402*swig_data_set = *Math::GSL::VectorComplexc::gsl_vector_complex_data_set;
403*swig_block_get = *Math::GSL::VectorComplexc::gsl_vector_complex_block_get;
404*swig_block_set = *Math::GSL::VectorComplexc::gsl_vector_complex_block_set;
405*swig_owner_get = *Math::GSL::VectorComplexc::gsl_vector_complex_owner_get;
406*swig_owner_set = *Math::GSL::VectorComplexc::gsl_vector_complex_owner_set;
407sub new {
408    my $pkg = shift;
409    my $self = Math::GSL::VectorComplexc::new_gsl_vector_complex(@_);
410    bless $self, $pkg if defined($self);
411}
412
413sub DESTROY {
414    return unless $_[0]->isa('HASH');
415    my $self = tied(%{$_[0]});
416    return unless defined $self;
417    delete $ITERATORS{$self};
418    if (exists $OWNER{$self}) {
419        Math::GSL::VectorComplexc::delete_gsl_vector_complex($self);
420        delete $OWNER{$self};
421    }
422}
423
424sub DISOWN {
425    my $self = shift;
426    my $ptr = tied(%$self);
427    delete $OWNER{$ptr};
428}
429
430sub ACQUIRE {
431    my $self = shift;
432    my $ptr = tied(%$self);
433    $OWNER{$ptr} = 1;
434}
435
436
437############# Class : Math::GSL::VectorComplex::_gsl_vector_complex_view ##############
438
439package Math::GSL::VectorComplex::_gsl_vector_complex_view;
440use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
441@ISA = qw( Math::GSL::VectorComplex );
442%OWNER = ();
443%ITERATORS = ();
444*swig_vector_get = *Math::GSL::VectorComplexc::_gsl_vector_complex_view_vector_get;
445*swig_vector_set = *Math::GSL::VectorComplexc::_gsl_vector_complex_view_vector_set;
446sub new {
447    my $pkg = shift;
448    my $self = Math::GSL::VectorComplexc::new__gsl_vector_complex_view(@_);
449    bless $self, $pkg if defined($self);
450}
451
452sub DESTROY {
453    return unless $_[0]->isa('HASH');
454    my $self = tied(%{$_[0]});
455    return unless defined $self;
456    delete $ITERATORS{$self};
457    if (exists $OWNER{$self}) {
458        Math::GSL::VectorComplexc::delete__gsl_vector_complex_view($self);
459        delete $OWNER{$self};
460    }
461}
462
463sub DISOWN {
464    my $self = shift;
465    my $ptr = tied(%$self);
466    delete $OWNER{$ptr};
467}
468
469sub ACQUIRE {
470    my $self = shift;
471    my $ptr = tied(%$self);
472    $OWNER{$ptr} = 1;
473}
474
475
476############# Class : Math::GSL::VectorComplex::_gsl_vector_complex_const_view ##############
477
478package Math::GSL::VectorComplex::_gsl_vector_complex_const_view;
479use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
480@ISA = qw( Math::GSL::VectorComplex );
481%OWNER = ();
482%ITERATORS = ();
483*swig_vector_get = *Math::GSL::VectorComplexc::_gsl_vector_complex_const_view_vector_get;
484*swig_vector_set = *Math::GSL::VectorComplexc::_gsl_vector_complex_const_view_vector_set;
485sub new {
486    my $pkg = shift;
487    my $self = Math::GSL::VectorComplexc::new__gsl_vector_complex_const_view(@_);
488    bless $self, $pkg if defined($self);
489}
490
491sub DESTROY {
492    return unless $_[0]->isa('HASH');
493    my $self = tied(%{$_[0]});
494    return unless defined $self;
495    delete $ITERATORS{$self};
496    if (exists $OWNER{$self}) {
497        Math::GSL::VectorComplexc::delete__gsl_vector_complex_const_view($self);
498        delete $OWNER{$self};
499    }
500}
501
502sub DISOWN {
503    my $self = shift;
504    my $ptr = tied(%$self);
505    delete $OWNER{$ptr};
506}
507
508sub ACQUIRE {
509    my $self = shift;
510    my $ptr = tied(%$self);
511    $OWNER{$ptr} = 1;
512}
513
514
515# ------- VARIABLE STUBS --------
516
517package Math::GSL::VectorComplex;
518
519*GSL_VERSION = *Math::GSL::VectorComplexc::GSL_VERSION;
520*GSL_MAJOR_VERSION = *Math::GSL::VectorComplexc::GSL_MAJOR_VERSION;
521*GSL_MINOR_VERSION = *Math::GSL::VectorComplexc::GSL_MINOR_VERSION;
522*GSL_POSZERO = *Math::GSL::VectorComplexc::GSL_POSZERO;
523*GSL_NEGZERO = *Math::GSL::VectorComplexc::GSL_NEGZERO;
524*GSL_SUCCESS = *Math::GSL::VectorComplexc::GSL_SUCCESS;
525*GSL_FAILURE = *Math::GSL::VectorComplexc::GSL_FAILURE;
526*GSL_CONTINUE = *Math::GSL::VectorComplexc::GSL_CONTINUE;
527*GSL_EDOM = *Math::GSL::VectorComplexc::GSL_EDOM;
528*GSL_ERANGE = *Math::GSL::VectorComplexc::GSL_ERANGE;
529*GSL_EFAULT = *Math::GSL::VectorComplexc::GSL_EFAULT;
530*GSL_EINVAL = *Math::GSL::VectorComplexc::GSL_EINVAL;
531*GSL_EFAILED = *Math::GSL::VectorComplexc::GSL_EFAILED;
532*GSL_EFACTOR = *Math::GSL::VectorComplexc::GSL_EFACTOR;
533*GSL_ESANITY = *Math::GSL::VectorComplexc::GSL_ESANITY;
534*GSL_ENOMEM = *Math::GSL::VectorComplexc::GSL_ENOMEM;
535*GSL_EBADFUNC = *Math::GSL::VectorComplexc::GSL_EBADFUNC;
536*GSL_ERUNAWAY = *Math::GSL::VectorComplexc::GSL_ERUNAWAY;
537*GSL_EMAXITER = *Math::GSL::VectorComplexc::GSL_EMAXITER;
538*GSL_EZERODIV = *Math::GSL::VectorComplexc::GSL_EZERODIV;
539*GSL_EBADTOL = *Math::GSL::VectorComplexc::GSL_EBADTOL;
540*GSL_ETOL = *Math::GSL::VectorComplexc::GSL_ETOL;
541*GSL_EUNDRFLW = *Math::GSL::VectorComplexc::GSL_EUNDRFLW;
542*GSL_EOVRFLW = *Math::GSL::VectorComplexc::GSL_EOVRFLW;
543*GSL_ELOSS = *Math::GSL::VectorComplexc::GSL_ELOSS;
544*GSL_EROUND = *Math::GSL::VectorComplexc::GSL_EROUND;
545*GSL_EBADLEN = *Math::GSL::VectorComplexc::GSL_EBADLEN;
546*GSL_ENOTSQR = *Math::GSL::VectorComplexc::GSL_ENOTSQR;
547*GSL_ESING = *Math::GSL::VectorComplexc::GSL_ESING;
548*GSL_EDIVERGE = *Math::GSL::VectorComplexc::GSL_EDIVERGE;
549*GSL_EUNSUP = *Math::GSL::VectorComplexc::GSL_EUNSUP;
550*GSL_EUNIMPL = *Math::GSL::VectorComplexc::GSL_EUNIMPL;
551*GSL_ECACHE = *Math::GSL::VectorComplexc::GSL_ECACHE;
552*GSL_ETABLE = *Math::GSL::VectorComplexc::GSL_ETABLE;
553*GSL_ENOPROG = *Math::GSL::VectorComplexc::GSL_ENOPROG;
554*GSL_ENOPROGJ = *Math::GSL::VectorComplexc::GSL_ENOPROGJ;
555*GSL_ETOLF = *Math::GSL::VectorComplexc::GSL_ETOLF;
556*GSL_ETOLX = *Math::GSL::VectorComplexc::GSL_ETOLX;
557*GSL_ETOLG = *Math::GSL::VectorComplexc::GSL_ETOLG;
558*GSL_EOF = *Math::GSL::VectorComplexc::GSL_EOF;
559
560use Scalar::Util 'blessed';
561use Data::Dumper;
562use Carp qw/croak/;
563use Math::GSL::Errno qw/:all/;
564use Math::GSL::BLAS qw/gsl_blas_ddot/;
565use Math::GSL::Complex qw/:all/;
566use Math::GSL::Test qw/is_status_ok/;
567use Math::Complex;
568use overload
569    '*'      => \&_multiplication,
570    '+'      => \&_addition,
571    '-'      => \&_subtract,
572    fallback => 1,
573;
574
575@EXPORT_all  = qw/
576                 gsl_vector_complex_alloc gsl_vector_complex_calloc gsl_vector_complex_alloc_from_block gsl_vector_complex_alloc_from_vector
577                 gsl_vector_complex_free gsl_vector_complex_view_array gsl_vector_complex_view_array_with_stride gsl_vector_complex_const_view_array
578                 gsl_vector_complex_const_view_array_with_stride gsl_vector_complex_subvector gsl_vector_complex_subvector_with_stride
579                 gsl_vector_complex_const_subvector gsl_vector_complex_const_subvector_with_stride gsl_vector_complex_real gsl_vector_complex_imag
580                 gsl_vector_complex_const_real gsl_vector_complex_const_imag gsl_vector_complex_get gsl_vector_complex_set
581                 gsl_vector_complex_ptr gsl_vector_complex_const_ptr gsl_vector_complex_set_zero gsl_vector_complex_set_all
582                 gsl_vector_complex_set_basis gsl_vector_complex_fread gsl_vector_complex_fwrite gsl_vector_complex_fscanf
583                 gsl_vector_complex_fprintf gsl_vector_complex_memcpy gsl_vector_complex_reverse gsl_vector_complex_swap
584                 gsl_vector_complex_swap_elements gsl_vector_complex_isnull gsl_vector_complex_ispos gsl_vector_complex_isneg
585/;
586@EXPORT_OK = (@EXPORT_all);
587%EXPORT_TAGS = ( all => \@EXPORT_all );
588
589=encoding utf8
590
591=head1 NAME
592
593Math::GSL::VectorComplex - Complex Vectors
594
595=head1 SYNOPSIS
596
597    use Math::GSL::VectorComplex qw/:all/;
598    my $vec1 = Math::GSL::VectorComplex->new([1 + 2*i, 7*i, 5, -3 ]);
599    my $vec2 = $vec1 * 5;
600    my $vec3 = Math::GSL::Vector>new(10);   # 10 element zero vector
601    my $vec4 = $vec1 + $vec2;
602
603    # set the element at index 1 to -i
604    # and the element at index 3 to i
605    $vec3->set([ 1, -i ], [ 9, i ]);
606
607    my @vec = $vec2->as_list;               # return elements as Perl list
608
609    my $dot_product = $vec1 * $vec2;
610    my $length      = $vec2->length;
611    my $first       = $vec1->get(0);
612
613
614=cut
615
616=head1 Objected Oriented Interface to GSL Math::GSL::VectorComplex
617
618=head2 new()
619
620Creates a new Vector of the given size.
621
622    my $vector = Math::GSL::VectorComplex->new(3);
623
624You can also create and set directly the values of the vector like this :
625
626   my $vector = Math::GSL::VectorComplex->new([2,4,1]);
627
628=cut
629
630sub new {
631    my ($class, $values) = @_;
632    my $length  = $#$values;
633    my $this = {};
634    my $vector;
635
636    # we expect $values to have Math::Complex objects
637    @$values = map { gsl_complex_rect(Re($_), Im($_)) } @$values;
638
639    if ( ref $values eq 'ARRAY' ){
640        die __PACKAGE__.'::new($x) - $x must be a nonempty array reference' if $length == -1;
641        $vector  = gsl_vector_complex_alloc($length+1);
642        map { gsl_vector_complex_set($vector, $_, $values->[$_] ) }  (0 .. $length);
643        $this->{_length} = $length+1;
644    } elsif ( (int($values) == $values) && ($values > 0)) {
645        $vector  = gsl_vector_complex_alloc($values);
646        gsl_vector_complex_set_zero($vector);
647        $this->{_length} = $values;
648    } else {
649        die __PACKAGE__.'::new($x) - $x must be an int or array reference';
650    }
651    $this->{_vector} = $vector;
652    bless $this, $class;
653}
654
655
656=head2 raw()
657
658Get the underlying GSL vector object created by SWIG, useful for using gsl_vector_* functions which do not have an OO counterpart.
659
660    my $vector    = Math::GSL::VectorComplex->new(3);
661    my $gsl_vector = $vector->raw;
662    my $stuff      = gsl_vector_get($gsl_vector, 1);
663
664=cut
665
666sub raw {
667    my $self = shift;
668    return $self->{_vector};
669}
670
671=head2 min()
672
673Returns the minimum value contained in the vector.
674
675   my $vector = Math::GSL::VectorComplex->new([2,4,1]);
676   my $minimum = $vector->min;
677
678=cut
679
680sub min {
681    my $self=shift;
682    return gsl_vector_min($self->raw);
683}
684
685=head2 max()
686
687Returns the minimum value contained in the vector.
688
689   my $vector = Math::GSL::VectorComplex->new([2,4,1]);
690   my $maximum = $vector->max;
691
692=cut
693
694sub max {
695    my $self=shift;
696    return gsl_vector_max($self->raw);
697}
698
699=head2 length()
700
701Returns the number of elements contained in the vector.
702
703   my $vector = Math::GSL::VectorComplex->new([2,4,1]);
704   my $length = $vector->length;
705
706=cut
707
708sub length { my $self=shift; $self->{_length} }
709
710=head2  as_list()
711
712Gets the content of a Math::GSL::Vector object as a Perl list.
713
714    my $vector = Math::GSL::VectorComplex->new(3);
715    ...
716    my @values = $vector->as_list;
717=cut
718
719sub as_list {
720    my $self=shift;
721    # this is wrong
722    return map { cplxe( gsl_complex_abs($_), gsl_complex_arg($_) ) } $self->get( [ 0 .. $self->length - 1  ] );
723}
724
725=head2  get()
726
727Gets the value of an of a Math::GSL::Vector object.
728
729    my $vector = Math::GSL::VectorComplex->new(3);
730    ...
731    my @values = $vector->get(2);
732
733You can also enter an array of indices to receive their corresponding values:
734
735    my $vector = Math::GSL::VectorComplex->new(3);
736    ...
737    my @values = $vector->get([0,2]);
738
739=cut
740
741sub get {
742    my ($self, $indices) = @_;
743    return  map {  gsl_vector_complex_get($self->raw, $_ ) } @$indices ;
744}
745
746=head2 reverse()
747
748Returns the a vector with the elements in reversed order.
749
750    use Math::Complex;
751    my $v1 = Math::GSL::VectorComplex->new([ 1, 2, 3*i]);
752    my $v2 = $v1->reverse;
753
754=cut
755
756sub reverse {
757    my $self = shift;
758    my $copy = $self->copy();
759    unless ( is_status_ok( gsl_vector_complex_reverse( $copy->raw )) ) {
760        die( __PACKAGE__.": error reversing vector " . gsl_strerror($status) );
761    }
762    return $copy;
763}
764
765=head2  set()
766
767Sets values of an of a Math::GSL::Vector object.
768
769    my $vector = Math::GSL::VectorComplex->new(3);
770    $vector->set([1,2], [8,23]);
771
772This sets the second and third value to 8 and 23.
773
774=cut
775
776sub set {
777    my ($self, $indices, $values) = @_;
778    die (__PACKAGE__.'::set($indices, $values) - $indices and $values must be array references of the same length')
779        unless ( ref $indices eq 'ARRAY' && ref $values eq 'ARRAY' &&  $#$indices == $#$values );
780    eval {
781        map {  gsl_vector_complex_set($self->{_vector}, $indices->[$_], $values->[$_] ) } (0..$#$indices);
782    };
783    # better error handling?
784    warn $@ if $@;
785    return;
786}
787
788=head2 copy()
789
790Returns a copy of the vector, which has the same length and values but resides at a different location in memory.
791
792    my $vector = Math::GSL::VectorComplex->new([10 .. 20]);
793    my $copy   = $vector->copy;
794
795=cut
796
797sub copy {
798    my $self = shift;
799    my $copy = Math::GSL::VectorComplex->new( $self->length );
800    my $status = gsl_vector_complex_memcpy($copy->raw, $self->raw);
801    if ( $status != $GSL_SUCCESS ) {
802        croak "Math::GSL - error copying memory, aborting. $! status=$status";
803    }
804    return $copy;
805}
806
807=head2 swap()
808
809Exchanges the values in the vectors $v with $w by copying.
810
811    my $v = Math::GSL::VectorComplex->new([1..5]);
812    my $w = Math::GSL::VectorComplex->new([3..7]);
813    $v->swap( $w );
814
815=cut
816
817sub swap() {
818    my ($self,$other) = @_;
819    croak "Math::GSL::VectorComplex : \$v->swap(\$w) - \$w must be a Math::GSL::VectorComplex"
820        unless ref $other eq 'Math::GSL::VectorComplex';
821    gsl_vector_complex_swap( $self->raw, $other->raw );
822    return $self;
823}
824
825sub _multiplication {
826    my ($left,$right) = @_;
827    my $lcopy = $left->copy;
828
829    if ( blessed $right && $right->isa(__PACKAGE__) ) {
830        return $lcopy->dot_product($right);
831    } else {
832        # will be in upcoming gsl 1.12
833        # gsl_vector_complex_scale($lcopy->raw, $right);
834    }
835    return $lcopy;
836}
837
838sub _subtract {
839    my ($left, $right, $flip) = @_;
840
841    if ($flip) {
842        my $lcopy = $left->copy;
843        # will be in upcoming gsl 1.12
844        # gsl_vector_complex_scale($lcopy->raw, -1 );
845        gsl_vector_add_constant($lcopy->raw, $right);
846        return $lcopy;
847    } else {
848        return _addition($left, -1.0*$right);
849    }
850}
851
852sub _addition {
853    my ($left, $right, $flip) = @_;
854    my $lcopy = $left->copy;
855
856    if ( blessed $right && $right->isa('Math::GSL::Vector') && blessed $left && $left->isa('Math::GSL::Vector') ) {
857        if ( $left->length == $right->length ) {
858            gsl_vector_complex_add($lcopy->raw, $right->raw);
859        } else {
860            croak "Math::GSL - addition of vectors must be called with two objects vectors and must have the same length";
861        }
862    } else {
863        gsl_vector_complex_add_constant($lcopy->raw, $right);
864    }
865    return $lcopy;
866}
867
868sub dot_product_pp {
869    my ($left,$right) = @_;
870    my $sum=0;
871    if ( blessed $right && $right->isa('Math::GSL::Vector') && $left->length == $right->length ) {
872         my @l = $left->as_list;
873         my @r = $right->as_list;
874         map { $sum += $l[$_] * $r[$_] } (0..$#l);
875        return $sum;
876    } else {
877        croak "dot_product() must be called with two vectors";
878    }
879}
880
881sub dot_product {
882    my ($left,$right) = @_;
883
884    my ($status, $product) = gsl_blas_ddot($left->raw,$right->raw);
885    croak sprintf "Math::GSL::dot_product - %s", gsl_strerror($status) if ($status != $GSL_SUCCESS);
886    return $product;
887}
888
889=head1 AUTHORS
890
891Jonathan "Duke" Leto <jonathan@leto.net> and Thierry Moisan <thierry.moisan@gmail.com>
892
893=head1 COPYRIGHT AND LICENSE
894
895Copyright (C) 2008-2021 Jonathan "Duke" Leto and Thierry Moisan
896
897This program is free software; you can redistribute it and/or modify it
898under the same terms as Perl itself.
899
900=cut
901
9021;
903