Skip to content

Commit

Permalink
zap at_c as obsoleted by at0 and at_bad_c
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 committed Apr 24, 2021
1 parent c811946 commit 96a69e2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 37 deletions.
35 changes: 0 additions & 35 deletions Basic/Core/Core.xs
Original file line number Diff line number Diff line change
Expand Up @@ -498,41 +498,6 @@ sclr_c(it)
RETVAL


SV *
at_c(x,position)
pdl* x
SV* position
PREINIT:
PDL_Indx * pos;
int npos;
int ipos;
PDL_Anyval result = { -1, 0 };
CODE:
pdl_make_physvaffine( x );

pos = pdl_packdims( position, &npos);

if (pos == NULL || npos < x->ndims)
croak("Invalid position");

/* allow additional trailing indices
* which must be all zero, i.e. a
* [3,1,5] piddle is treated as an [3,1,5,1,1,1,....]
* infinite dim piddle
*/
for (ipos=x->ndims; ipos<npos; ipos++)
if (pos[ipos] != 0)
croak("Invalid position");

result=pdl_at(PDL_REPRP(x), x->datatype, pos, x->dims,
(PDL_VAFFOK(x) ? x->vafftrans->incs : x->dimincs), PDL_REPROFFS(x),
x->ndims);

ANYVAL_TO_SV(RETVAL, result);

OUTPUT:
RETVAL

SV *
at_bad_c(x,position)
pdl* x
Expand Down
4 changes: 2 additions & 2 deletions t/core.t
Original file line number Diff line number Diff line change
Expand Up @@ -301,11 +301,11 @@ SKIP: {
is_deeply(longlong($input)->unpdl, $input, 'back convert of 64bit integers');
my $small_pdl = longlong([ -9000000000000000001, 9000000000000000001 ]);
is($small_pdl->at(0), -9000000000000000001, 'at/1');
is(PDL::Core::at_c($small_pdl, [1]), 9000000000000000001, 'at_c/1');
is(PDL::Core::at_bad_c($small_pdl, [1]), 9000000000000000001, 'at_bad_c/1');
$small_pdl->set(0, -8888888888888888888);
PDL::Core::set_c($small_pdl, [1], 8888888888888888888);
is($small_pdl->at(0), -8888888888888888888, 'at/2');
is(PDL::Core::at_c($small_pdl, [1]), 8888888888888888888, 'at_c/2');
is(PDL::Core::at_bad_c($small_pdl, [1]), 8888888888888888888, 'at_bad_c/2');
is_deeply($small_pdl->unpdl, [ -8888888888888888888, 8888888888888888888 ], 'unpdl/small_pdl');
}

Expand Down

0 comments on commit 96a69e2

Please sign in to comment.