Skip to content

Commit

Permalink
Fix problem with using identity matrix as a constant
Browse files Browse the repository at this point in the history
  • Loading branch information
dpvc committed Aug 2, 2017
1 parent 2da8143 commit 7e91f69
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/Value/Matrix.pm
Expand Up @@ -321,9 +321,10 @@ sub I {
Value::Error("You must provide a dimension for the Identity matrix") unless defined $d;
Value::Error("Dimension must be a positive integer") unless $d =~ m/^[1-9]\d*$/;
my @M = (); my @Z = split('',0 x $d);
my $REAL = $context->Package('Real');
foreach my $i (0..$d-1) {
my @row = @Z; $row[$i] = 1;
push(@M,$self->make($context,@row));
push(@M,$self->make($context, map {$REAL->new($_)} @row));
}
return $self->make($context,@M);
}
Expand Down

0 comments on commit 7e91f69

Please sign in to comment.