From 7e91f69b437d17f8409ce934d1d9debe1aac9d67 Mon Sep 17 00:00:00 2001 From: "Davide P. Cervone" Date: Wed, 2 Aug 2017 06:58:11 -0400 Subject: [PATCH] Fix problem with using identity matrix as a constant --- lib/Value/Matrix.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Value/Matrix.pm b/lib/Value/Matrix.pm index f2253c72a7..f230931256 100644 --- a/lib/Value/Matrix.pm +++ b/lib/Value/Matrix.pm @@ -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); }