Skip to content

Commit 9c356c1

Browse files
committed
replace CopyBadStatusCode with conditional STATESETBAD
1 parent 2d206fc commit 9c356c1

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

lib/PDL/Primitive.pd

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2066,6 +2066,7 @@ pp_def('vcos',
20662066
GenericTypes => [ppdefs_all],
20672067
HandleBad => 1,
20682068
Code => pp_line_numbers(__LINE__, <<'EOF'),
2069+
broadcastloop %{
20692070
$GENERIC(vcos) bnorm = 0;
20702071
loop(M) %{
20712072
PDL_IF_BAD(if ($ISBAD(b())) continue;,)
@@ -2097,12 +2098,10 @@ loop (N) %{
20972098
$vcos() = NAN;
20982099
}
20992100
%}
2101+
%}
2102+
if ( $PDLSTATEISBAD(a) || $PDLSTATEISBAD(b) )
2103+
$PDLSTATESETBAD(vcos);
21002104
EOF
2101-
CopyBadStatusCode => q{
2102-
if ( $ISPDLSTATEBAD(a) || $ISPDLSTATEBAD(b) ) {
2103-
$SETPDLSTATEBAD(vcos);
2104-
}
2105-
},
21062105
Doc => q{
21072106
Computes the vector cosine similarity of a dense vector $b() with respect
21082107
to each row $a(*,i) of a dense PDL $a(). This is basically the same

0 commit comments

Comments
 (0)