Created
July 29, 2011 00:12
-
-
Save anonymous/1112869 to your computer and use it in GitHub Desktop.
The following works find on my float arrays, but not for int arrays
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# First, the definitions needed for the signatures: | |
dlfunc nci, lib, 'gsl_stats_max', 'dpll' | |
set_global ['GSL'], 'gsl_stats_max', nci | |
dlfunc nci, lib, 'gsl_stats_int_max', 'ipll' | |
set_global ['GSL'], 'gsl_stats_int_max', nci | |
# $arg will be a Resizable*Array | |
my sub max ($arg) { | |
if (pir::typeof($arg[0]) eq 'Float') { | |
my @ans := pir::new("ResizableFloatArray"); | |
my $fun := | |
Q:PIR { %r = get_global ['GSL'], 'gsl_stats_max' }; | |
@ans[0] := $fun($arg, 1, length($arg)[0]); | |
return @ans; | |
} | |
if (pir::typeof($arg[0]) eq 'Integer') { | |
print("max(Integer) is buggy, sorry"); | |
my @ans := pir::new("ResizableIntegerArray"); | |
my $fun := | |
Q:PIR { %r = get_global ['GSL'], 'gsl_stats_int_max' }; | |
@ans[0] := $fun($arg, 1, length($arg)[0]); | |
return @ans; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment