Skip to content

Commit

Permalink
Add regular {op}over equivalent names
Browse files Browse the repository at this point in the history
The operations in Ufunc along a dimension are mostly named
something ending in -over like 'sumover', except for the
cases of routines with names including average, minimum, and
maximum.  This was a cute but surprising set of special cases.
Adding this following equivalent routines:

  average       -> avgover
  daverage      -> davgover
  maximum       -> maxover
  maximum_ind   -> maxover_ind
  maximum_n_ind -> maxover_n_ind
  minmaximum    -> minmaxover
  minimum       -> minover
  minimum_ind   -> minover_ind
  minimum_n_ind -> minover_n_ind
  • Loading branch information
devel-chm committed May 26, 2016
1 parent dcc862d commit e726bfb
Showing 1 changed file with 136 additions and 0 deletions.
136 changes: 136 additions & 0 deletions Basic/Ufunc/ufunc.pd
Expand Up @@ -376,6 +376,22 @@ pp_def(
Doc => projectdocs( 'average', 'average', '' ),
);

pp_addpm("*PDL::avgover = \\&PDL::average;\n");
pp_addpm("*avgover = \\&PDL::average;\n");
pp_add_exported('PDL::PP avgover');

pp_addpm(<<'EOD');
=head2 avgover
=for ref
Synonym for average.
=cut
EOD


# do the above calculation, but in double precision
pp_def(
'daverage',
Expand All @@ -401,6 +417,22 @@ pp_def(
"precision." ),
);

pp_addpm("*PDL::davgover = \\&PDL::daverage;\n");
pp_addpm("*davgover = \\&PDL::daverage;\n");
pp_add_exported('PDL::PP davgover');

pp_addpm(<<'EOD');
=head2 davgover
=for ref
Synonym for daverage.
=cut
EOD


# Internal utility sorting routine for median/qsort/qsortvec routines.
#
# note: we export them to the PDL Core structure for use in
Expand Down Expand Up @@ -1376,6 +1408,96 @@ otherwise the bad flag is cleared for the output piddle.',

} # foreach: $which

pp_addpm("*PDL::maxover = \\&PDL::maximum;\n");
pp_addpm("*maxover = \\&PDL::maximum;\n");
pp_add_exported('PDL::PP maxover');

pp_addpm(<<'EOD');
=head2 maxover
=for ref
Synonym for maximum.
=cut
EOD

pp_addpm("*PDL::maxover_ind = \\&PDL::maximum_ind;\n");
pp_addpm("*maxover_ind = \\&PDL::maximum_ind;\n");
pp_add_exported('PDL::PP maxover_ind');

pp_addpm(<<'EOD');
=head2 maxover_ind
=for ref
Synonym for maximum_ind.
=cut
EOD

pp_addpm("*PDL::maxover_n_ind = \\&PDL::maximum_n_ind;\n");
pp_addpm("*maxover_n_ind = \\&PDL::maximum_n_ind;\n");
pp_add_exported('PDL::PP maxover_n_ind');

pp_addpm(<<'EOD');
=head2 maxover_n_ind
=for ref
Synonym for maximum_n_ind.
=cut
EOD

pp_addpm("*PDL::minover = \\&PDL::minimum;\n");
pp_addpm("*minover = \\&PDL::minimum;\n");
pp_add_exported('PDL::PP minover');

pp_addpm(<<'EOD');
=head2 minover
=for ref
Synonym for minimum.
=cut
EOD

pp_addpm("*PDL::minover_ind = \\&PDL::minimum_ind;\n");
pp_addpm("*minover_ind = \\&PDL::minimum_ind;\n");
pp_add_exported('PDL::PP minover_ind');

pp_addpm(<<'EOD');
=head2 minover_ind
=for ref
Synonym for minimum_ind.
=cut
EOD

pp_addpm("*PDL::minover_n_ind = \\&PDL::minimum_n_ind;\n");
pp_addpm("*minover_n_ind = \\&PDL::minimum_n_ind;\n");
pp_add_exported('PDL::PP minover_n_ind');

pp_addpm(<<'EOD');
=head2 minover_n_ind
=for ref
Synonym for minimum_n_ind
=cut
EOD

# removed IsNaN handling, even from Code section
# I think it was wrong, since it was
#
Expand Down Expand Up @@ -1456,6 +1578,20 @@ Otherwise they will have their bad flags cleared,
since they will not contain any bad values.',
); # pp_def minmaximum

pp_addpm("*PDL::minmaxover = \\&PDL::minmaximum;\n");
pp_addpm("*minmaxover = \\&PDL::minmaximum;\n");
pp_add_exported('PDL::PP minmaxover');

pp_addpm(<<'EOD');
=head2 minmaxover
=for ref
Synonym for minmaximum.
=cut
EOD

pp_addpm({At=>'Bot'},<<'EOD');
Expand Down

0 comments on commit e726bfb

Please sign in to comment.