| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Statistics::R::REXP::Complex; |
|
2
|
|
|
|
|
|
|
# ABSTRACT: an R numeric vector |
|
3
|
|
|
|
|
|
|
$Statistics::R::REXP::Complex::VERSION = '1.0001'; |
|
4
|
12
|
|
|
12
|
|
18336
|
use 5.010; |
|
|
12
|
|
|
|
|
27
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
12
|
|
|
12
|
|
40
|
use Scalar::Util qw(blessed looks_like_number); |
|
|
12
|
|
|
|
|
12
|
|
|
|
12
|
|
|
|
|
521
|
|
|
7
|
12
|
|
|
12
|
|
6411
|
use Math::Complex qw(); |
|
|
12
|
|
|
|
|
84850
|
|
|
|
12
|
|
|
|
|
294
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
12
|
|
|
12
|
|
894
|
use Class::Tiny::Antlers qw(-default around); |
|
|
12
|
|
|
|
|
3978
|
|
|
|
12
|
|
|
|
|
75
|
|
|
10
|
12
|
|
|
12
|
|
1613
|
use namespace::clean; |
|
|
12
|
|
|
|
|
9412
|
|
|
|
12
|
|
|
|
|
60
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
extends 'Statistics::R::REXP::Vector'; |
|
13
|
12
|
|
|
12
|
|
1680
|
use overload; |
|
|
12
|
|
|
|
|
13
|
|
|
|
12
|
|
|
|
|
43
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
12
|
|
|
12
|
|
365
|
use constant sexptype => 'CPLXSXP'; |
|
|
12
|
|
|
|
|
13
|
|
|
|
12
|
|
|
|
|
3998
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub BUILDARGS { |
|
20
|
194
|
|
|
194
|
0
|
91201
|
my $class = shift; |
|
21
|
194
|
|
|
|
|
637
|
my $attributes = $class->SUPER::BUILDARGS(@_); |
|
22
|
|
|
|
|
|
|
|
|
23
|
193
|
100
|
|
|
|
499
|
if (ref($attributes->{elements}) eq 'ARRAY') { |
|
24
|
|
|
|
|
|
|
$attributes->{elements} = [ |
|
25
|
318
|
100
|
66
|
|
|
3528
|
map { (blessed($_) && $_->isa('Math::Complex')) ? $_ : |
|
|
|
100
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
looks_like_number $_ ? Math::Complex::cplx($_) : |
|
27
|
|
|
|
|
|
|
undef } |
|
28
|
179
|
|
|
|
|
194
|
Statistics::R::REXP::Vector::_flatten(@{$attributes->{elements}}) |
|
|
179
|
|
|
|
|
793
|
|
|
29
|
|
|
|
|
|
|
] |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
$attributes |
|
32
|
193
|
|
|
|
|
1089
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub BUILD { |
|
36
|
190
|
|
|
190
|
0
|
4305
|
my ($self, $args) = @_; |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# Required attribute type |
|
39
|
|
|
|
|
|
|
die "Elements of the 'elements' attribute must be scalar numbers or instances of Math::Complex" if |
|
40
|
|
|
|
|
|
|
defined $self->elements && |
|
41
|
318
|
100
|
33
|
|
|
2869
|
grep { defined($_) && !(blessed($_) && $_->isa('Math::Complex') || |
|
42
|
|
|
|
|
|
|
Scalar::Util::looks_like_number($_)) } |
|
43
|
190
|
50
|
33
|
|
|
2564
|
@{$self->elements} |
|
|
190
|
|
|
|
|
3141
|
|
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
around _eq => sub { |
|
48
|
|
|
|
|
|
|
my $orig = shift; |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
return unless Statistics::R::REXP::_eq(@_); |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
my ($self, $obj) = (shift, shift); |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
my $a = $self->elements; |
|
55
|
|
|
|
|
|
|
my $b = $obj->elements; |
|
56
|
|
|
|
|
|
|
return undef unless scalar(@$a) == scalar(@$b); |
|
57
|
|
|
|
|
|
|
for (my $i = 0; $i < scalar(@{$a}); $i++) { |
|
58
|
|
|
|
|
|
|
my $x = $a->[$i]; |
|
59
|
|
|
|
|
|
|
my $y = $b->[$i]; |
|
60
|
|
|
|
|
|
|
if (defined($x) && defined($y)) { |
|
61
|
|
|
|
|
|
|
return undef unless |
|
62
|
|
|
|
|
|
|
$x == $y; |
|
63
|
|
|
|
|
|
|
} else { |
|
64
|
|
|
|
|
|
|
return undef if defined($x) or defined($y); |
|
65
|
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1 |
|
69
|
|
|
|
|
|
|
}; |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
|
72
|
4
|
|
|
4
|
|
10
|
sub _type { 'complex'; } |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; # End of Statistics::R::REXP::Complex |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
__END__ |