From 9ff48ebc843a0ff5ec514dec64fe48b3b01873a4 Mon Sep 17 00:00:00 2001 From: Ed J Date: Sat, 20 Jan 2024 11:28:56 +0000 Subject: [PATCH] tidy generate_core_flags, doc those funcs --- Basic/Core/Core.pm | 67 ++++++++++++++++++++++++++++++++++++++++++++-- Basic/Core/Dev.pm | 8 +++--- 2 files changed, 69 insertions(+), 6 deletions(-) diff --git a/Basic/Core/Core.pm b/Basic/Core/Core.pm index 0ce40e710..11b9a83ab 100644 --- a/Basic/Core/Core.pm +++ b/Basic/Core/Core.pm @@ -2102,12 +2102,75 @@ sub alltopdl { return $_[0]->new($_[1]); 0;} +=head2 hdrcpy + +=for ref + +Sets whether an ndarray on being copied, should also have its C +copied, if a (Boolean) value is given. Returns the new value. + +=head2 is_inplace + +=for ref + +Sets whether an ndarray will operate "in-place" for the next operation +if a (Boolean) value is given. Returns the old value. + +=head2 tracedebug + +=for ref + +Sets whether an ndarray will have debugging info printed during use if a +(Boolean) value is given. Returns the new value. + +=head2 fflows + +=for ref + +Returns whether the ndarray's C flag is set. + +=head2 bflows + +=for ref + +Returns whether the ndarray's C flag is set. + +=head2 donttouch + +=for ref + +Returns whether the ndarray's C flag is set. + +=head2 allocated + +=for ref + +Returns whether the ndarray's C flag is set. + +=head2 vaffine + +=for ref + +Returns whether the ndarray's C flag is set. + +=head2 anychgd + +=for ref + +Returns whether the ndarray's C flag is set. + +=head2 dimschgd + +=for ref + +Returns whether the ndarray's C flag is set. =head2 inplace =for ref -Flag an ndarray so that the next operation is done 'in place' +Flag an ndarray so that the next operation is done 'in place', returning +the ndarray. =for usage @@ -2964,7 +3027,7 @@ Convert ndarray indices to perl list @tmp = listindices $x; -C<@tmp> now contains the values C<0..nelem($x)>. +C<@tmp> now contains the values C<0..nelem($x)-1>. Obviously this is grossly inefficient for the large datasets PDL is designed to handle. This was provided as a get out while PDL matured. It should now be mostly diff --git a/Basic/Core/Dev.pm b/Basic/Core/Dev.pm index ab7e73620..2bf4bc42a 100644 --- a/Basic/Core/Dev.pm +++ b/Basic/Core/Dev.pm @@ -490,7 +490,7 @@ my %flags = ( vaffine => { FLAG => "OPT_VAFFTRANSOK" }, anychgd => { FLAG => "ANYCHANGED" }, dimschgd => { FLAG => "PARENTDIMSCHANGED" }, - tracedebug => { set => 1}, + tracedebug => { set => 1 }, ); sub generate_core_flags { @@ -500,11 +500,11 @@ sub generate_core_flags { foreach my $name ( sort keys %flags ) { my $flag = "PDL_" . ($flags{$name}{FLAG} || uc($name)); my $with_mode = $flags{$name}{set} || $flags{$name}{postset}; - printf <<'EOF', $name, ($with_mode ? ",mode=0" : ''), ($with_mode ? " int mode\n" : ''); + printf <<'EOF', $name, $with_mode ? (",mode=0", "\n int mode") : ('', ''); int %s(x%s) - pdl *x -%s CODE: + pdl *x%s + CODE: EOF my $set = " if (items>1) setflag(x->state,$flag,mode);\n"; my $ret = " RETVAL = ((x->state & $flag) > 0);\n";