line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package AI::NeuralNet::FastSOM::Rect; |
2
|
|
|
|
|
|
|
|
3
|
8
|
|
|
8
|
|
96238
|
use strict; |
|
8
|
|
|
|
|
32
|
|
|
8
|
|
|
|
|
317
|
|
4
|
8
|
|
|
8
|
|
48
|
use warnings; |
|
8
|
|
|
|
|
15
|
|
|
8
|
|
|
|
|
287
|
|
5
|
|
|
|
|
|
|
|
6
|
8
|
|
|
8
|
|
3529
|
use AI::NeuralNet::FastSOM; |
|
8
|
|
|
|
|
21
|
|
|
8
|
|
|
|
|
6192
|
|
7
|
|
|
|
|
|
|
our @ISA = qw/AI::NeuralNet::FastSOM/; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.18'; |
10
|
|
|
|
|
|
|
|
11
|
0
|
|
|
0
|
|
0
|
sub _old_radius { shift->{_R} } |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub initialize { |
14
|
12
|
|
|
12
|
0
|
45979
|
my $self = shift; |
15
|
12
|
|
|
|
|
48
|
my @data = @_; |
16
|
|
|
|
|
|
|
|
17
|
12
|
|
|
|
|
21
|
my $i = 0; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
my $get_from_stream = sub { |
20
|
0
|
0
|
|
0
|
|
0
|
$i = 0 if $i > $#data; |
21
|
0
|
|
|
|
|
0
|
return [ @{ $data[$i++] } ]; # cloning ! |
|
0
|
|
|
|
|
0
|
|
22
|
12
|
50
|
|
|
|
87
|
} if @data; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
$get_from_stream ||= sub { |
25
|
360
|
|
|
360
|
|
1382
|
return [ map { rand( 1 ) - 0.5 } 1..$self->{_Z} ]; |
|
1080
|
|
|
|
|
4090
|
|
26
|
12
|
|
100
|
|
|
104
|
}; |
27
|
|
|
|
|
|
|
|
28
|
12
|
|
|
|
|
123
|
for my $x (0 .. $self->{_X}-1) { |
29
|
60
|
|
|
|
|
292
|
for my $y (0 .. $self->{_Y}-1) { |
30
|
360
|
|
|
|
|
477
|
$self->{map}->[$x]->[$y] = &$get_from_stream; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub as_string { |
36
|
4
|
|
|
4
|
0
|
30296
|
my $self = shift; |
37
|
4
|
|
|
|
|
9
|
my $s = ''; |
38
|
|
|
|
|
|
|
|
39
|
4
|
|
|
|
|
9
|
$s .= " "; |
40
|
4
|
|
|
|
|
48
|
for my $y (0 .. $self->{_Y}-1){ |
41
|
24
|
|
|
|
|
77
|
$s .= sprintf (" %02d ",$y); |
42
|
|
|
|
|
|
|
} |
43
|
4
|
|
|
|
|
178
|
$s .= sprintf "\n","-"x107,"\n"; |
44
|
|
|
|
|
|
|
|
45
|
4
|
|
|
|
|
13
|
my $dim = scalar @{ $self->{map}->[0]->[0] }; |
|
4
|
|
|
|
|
54
|
|
46
|
|
|
|
|
|
|
|
47
|
4
|
|
|
|
|
65
|
for my $x (0 .. $self->{_X}-1) { |
48
|
20
|
|
|
|
|
46
|
for my $w ( 0 .. $dim-1 ){ |
49
|
60
|
|
|
|
|
181
|
$s .= sprintf ("%02d | ",$x); |
50
|
60
|
|
|
|
|
283
|
for my $y (0 .. $self->{_Y}-1){ |
51
|
360
|
|
|
|
|
3524
|
$s .= sprintf ("% 2.2f ", $self->{map}->[$x]->[$y]->[$w]); |
52
|
|
|
|
|
|
|
} |
53
|
60
|
|
|
|
|
131
|
$s .= sprintf "\n"; |
54
|
|
|
|
|
|
|
} |
55
|
20
|
|
|
|
|
31
|
$s .= sprintf "\n"; |
56
|
|
|
|
|
|
|
} |
57
|
4
|
|
|
|
|
39
|
return $s; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub as_data { |
61
|
4
|
|
|
4
|
1
|
9
|
my $self = shift; |
62
|
4
|
|
|
|
|
7
|
my $s = ''; |
63
|
|
|
|
|
|
|
|
64
|
4
|
|
|
|
|
9
|
my $dim = scalar @{ $self->{map}->[0]->[0] }; |
|
4
|
|
|
|
|
39
|
|
65
|
4
|
|
|
|
|
30
|
for my $x (0 .. $self->{_X}-1) { |
66
|
20
|
|
|
|
|
136
|
for my $y (0 .. $self->{_Y}-1){ |
67
|
120
|
|
|
|
|
180
|
for my $w ( 0 .. $dim-1 ){ |
68
|
360
|
|
|
|
|
3355
|
$s .= sprintf ("\t%f", $self->{map}->[$x]->[$y]->[$w]); |
69
|
|
|
|
|
|
|
} |
70
|
120
|
|
|
|
|
178
|
$s .= sprintf "\n"; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
} |
73
|
4
|
|
|
|
|
31
|
return $s; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
1; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
__END__ |