Skip to content

Commit b6d2f92

Browse files
committed
make Trans::toreal do nothing if given real-typed data
1 parent e8b93dd commit b6d2f92

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

Changes

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
- make Trans::toreal do nothing if given real-typed data
2+
13
0.432 2025-01-04
24
- uses PDL 2.096+ lib/*.pd format for quicker builds
35

lib/PDL/LinearAlgebra/Trans.pd

+7-7
Original file line numberDiff line numberDiff line change
@@ -850,13 +850,13 @@ sub PDL::acoth($) {my $tmp = 1/pdl($_[0]) ; $tmp->atanh}
850850

851851
my $_tol = 9.99999999999999e-15;
852852

853-
sub toreal{
854-
return $_[0] if $_[0]->isempty;
855-
$_tol = $_[1] if defined $_[1];
856-
my ($min, $max, $tmp);
857-
($min, $max) = $_[0]->im->minmax;
858-
return $_[0]->re->sever unless (abs($min) > $_tol || abs($max) > $_tol);
859-
$_[0];
853+
sub toreal {
854+
$_tol = $_[1] if defined $_[1];
855+
return $_[0] if $_[0]->isempty or $_[0]->type->real;
856+
my ($min, $max, $tmp);
857+
($min, $max) = $_[0]->im->minmax;
858+
return $_[0]->re->sever unless (abs($min) > $_tol || abs($max) > $_tol);
859+
$_[0];
860860
}
861861

862862
=head2 mlog

0 commit comments

Comments
 (0)