Skip to content

Commit 23692a5

Browse files
committed
zap temp vars since lvalue subs work
1 parent 40b1ec5 commit 23692a5

File tree

5 files changed

+22
-23
lines changed

5 files changed

+22
-23
lines changed

demos/test5.p

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ axisvalues($y->slice("(0)")->inplace);
1010
axisvalues($y->slice("(1)")->transpose->inplace);
1111
$y /= $size;
1212
random($y->slice("(2)")->inplace);
13-
(my $tmp = $y->slice("(2)")) /= 5;
13+
$y->slice("(2)") /= 5;
1414
my $c = PDL->zeroes(3,$size,$size);
1515
random($c->inplace);
1616

demos/testimg.p

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ my $r = zeroes(4,5,6,7,2,2,2,2)+0.1;
1414
my $g = zeroes(4,5,6,7,2,2,2,2);
1515
my $b = zeroes(4,5,6,7,2,2,2,2);
1616

17-
(my $tmp = $r->slice(":,:,2,2")) .= 1;
18-
($tmp = $r->slice(":,:,:,1")) .= 0.5;
19-
($tmp = $g->slice("2,:,1,2")) .= 1;
20-
($tmp = $b->slice("2,3,1,:")) .= 1;
17+
$r->slice(":,:,2,2") .= 1;
18+
$r->slice(":,:,:,1") .= 0.5;
19+
$g->slice("2,:,1,2") .= 1;
20+
$b->slice("2,3,1,:") .= 1;
2121

2222
$graph->add_dataseries(PDL::Graphics::TriD::Image->new([$r,$g,$b]));
2323
$graph->scalethings;

lib/PDL/Graphics/TriD/Graph.pm

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ sub finish_scale {
152152
sub transform {
153153
my($this,$point,$data,$inds) = @_;
154154
my ($min, $max) = map $this->{Scale}->slice("0:$#$inds,$_"), 0, 1;
155-
(my $tmp = $point->slice("0:$#$inds")) +=
155+
$point->slice("0:$#$inds") +=
156156
($data->dice_axis(0, $inds) - $min) / ($max - $min);
157157
return $point;
158158
}
@@ -241,14 +241,14 @@ sub transform {
241241
exit;
242242
}
243243
my $pio180 = 0.017453292;
244-
(my $tmp1 = $point->slice("(0)")) +=
244+
$point->slice("(0)") +=
245245
0.5+($data->slice("($inds->[0])")-$this->{Center}[0]) /
246246
($this->{Scale}[0][1] - $this->{Scale}[0][0])
247247
*cos($data->slice("($inds->[1])")*$pio180);
248-
(my $tmp2 = $point->slice("(1)")) +=
248+
$point->slice("(1)") +=
249249
0.5+($data->slice("($inds->[1])")-$this->{Center}[1]) /
250250
($this->{Scale}[1][1] - $this->{Scale}[1][0]);
251-
(my $tmp3 = $point->slice("(2)")) .=
251+
$point->slice("(2)") .=
252252
log($data->slice("($inds->[2])")/1012.5)/log($this->{Scale}[2][1]/1012.5);
253253
return $point;
254254
}
@@ -335,23 +335,23 @@ sub transform {
335335
exit;
336336
}
337337
my $pio180 = 0.017453292;
338-
(my $tmp1 = $point->slice("(0)")) +=
338+
$point->slice("(0)") +=
339339
0.5+($data->slice("($inds->[0])")-$this->{Center}[0]) /
340340
($this->{Scale}[0][1] - $this->{Scale}[0][0])
341341
*cos($data->slice("($inds->[1])")*$pio180);
342-
(my $tmp2 = $point->slice("(1)")) +=
342+
$point->slice("(1)") +=
343343
0.5+($data->slice("($inds->[1])")-$this->{Center}[1]) /
344344
($this->{Scale}[1][1] - $this->{Scale}[1][0])
345345
*cos($data->slice("($inds->[1])")*$pio180);
346346
# Longitude transformation
347-
# (my $tmp = $point->slice("(0)")) =
347+
# $point->slice("(0)") =
348348
# ($this->{Center}[0]-$point->slice("(0)"))*cos($data->slice("(1)"));
349349
# Latitude transformation
350-
# (my $tmp = $point->slice("(1)")) =
350+
# $point->slice("(1)") =
351351
# ($this->{Center}[1]-$data->slice("(1)"))*cos($data->slice("(1)"));
352352
# Vertical transformation
353353
# -7.2*log($data->slice("(2)")/1012.5
354-
(my $tmp3 = $point->slice("(2)")) .=
354+
$point->slice("(2)") .=
355355
log($data->slice("($inds->[2])")/1012.5)/log($this->{Scale}[2][1]/1012.5);
356356
return $point;
357357
}

lib/PDL/Graphics/TriD/Objects.pm

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@ sub smoothn {
213213
my $trip = $p->lags(1,1,2)->slice(':,:,:,1:-1') -
214214
$p->lags(1,1,2)->slice(':,:,:,0:-2');
215215
# coords of diagonals with dim 2 having original and reflected diags
216-
my $tmp;
217216
my $trid = ($p->slice(':,0:-2,1:-1')-$p->slice(':,1:-1,0:-2'))
218217
->dummy(2,2);
219218
# $ortho is a (3D,x-1,left/right triangle,y-1) array that enumerates
@@ -223,13 +222,13 @@ sub smoothn {
223222
# now add to vertices to smooth
224223
my $aver = ref($p)->zeroes($p->dims);
225224
# step 1, upper right tri0, upper left tri1
226-
($tmp=$aver->lags(1,1,2)->slice(':,:,:,1:-1')) += $ortho;
225+
$aver->lags(1,1,2)->slice(':,:,:,1:-1') += $ortho;
227226
# step 2, lower right tri0, lower left tri1
228-
($tmp=$aver->lags(1,1,2)->slice(':,:,:,0:-2')) += $ortho;
227+
$aver->lags(1,1,2)->slice(':,:,:,0:-2') += $ortho;
229228
# step 3, upper left tri0
230-
($tmp=$aver->slice(':,0:-2,1:-1')) += $ortho->slice(':,:,(0)');
229+
$aver->slice(':,0:-2,1:-1') += $ortho->slice(':,:,(0)');
231230
# step 4, lower right tri1
232-
($tmp=$aver->slice(':,1:-1,0:-2')) += $ortho->slice(':,:,(1)');
231+
$aver->slice(':,1:-1,0:-2') += $ortho->slice(':,:,(1)');
233232
$aver->norm($aver);
234233
return $aver;
235234
}

lib/PDL/Graphics/TriD/Polygonize.pm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ sub stupidpolygonize {
1818
my $za = ($x->slice("(0)"))->yvals;
1919
$za *= $mult/2;
2020
$za -= 3.14/2;
21-
(my $tmp0 = $x->slice("(0)")) += cos($ya);
22-
(my $tmp1 = $x->slice("(1)")) += sin($ya);
23-
(my $tmp01 = $x->slice("0:1")) *= cos($za)->dummy(0);
24-
(my $tmp2 = $x->slice("(2)")) += sin($za);
21+
$x->slice("(0)") += cos($ya);
22+
$x->slice("(1)") += sin($ya);
23+
$x->slice("0:1") *= cos($za)->dummy(0);
24+
$x->slice("(2)") += sin($za);
2525
my $add = $x->copy;
2626
$x *= $initrad;
2727
$x += $center;

0 commit comments

Comments
 (0)