Skip to content

Commit

Permalink
make Trans::toreal do nothing if given real-typed data
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 committed Jan 6, 2025
1 parent e8b93dd commit b6d2f92
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
- make Trans::toreal do nothing if given real-typed data

0.432 2025-01-04
- uses PDL 2.096+ lib/*.pd format for quicker builds

Expand Down
14 changes: 7 additions & 7 deletions lib/PDL/LinearAlgebra/Trans.pd
Original file line number Diff line number Diff line change
Expand Up @@ -850,13 +850,13 @@ sub PDL::acoth($) {my $tmp = 1/pdl($_[0]) ; $tmp->atanh}

my $_tol = 9.99999999999999e-15;

sub toreal{
return $_[0] if $_[0]->isempty;
$_tol = $_[1] if defined $_[1];
my ($min, $max, $tmp);
($min, $max) = $_[0]->im->minmax;
return $_[0]->re->sever unless (abs($min) > $_tol || abs($max) > $_tol);
$_[0];
sub toreal {
$_tol = $_[1] if defined $_[1];
return $_[0] if $_[0]->isempty or $_[0]->type->real;
my ($min, $max, $tmp);
($min, $max) = $_[0]->im->minmax;
return $_[0]->re->sever unless (abs($min) > $_tol || abs($max) > $_tol);
$_[0];
}

=head2 mlog
Expand Down

0 comments on commit b6d2f92

Please sign in to comment.