Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
ajpotts committed Sep 19, 2024
1 parent 3a366a6 commit 9e7915e
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 8,095 deletions.
12 changes: 6 additions & 6 deletions src/SortMsg.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module SortMsg
/* sort takes pdarray and returns a sorted copy of the array */
@arkouda.registerCommand
proc sort(array: [?d] ?t, alg: string, axis: int): [d] t throws
where ( (t == real) || (t==int) || (t==uint(64)) ) && ( d.rank == 1 ) {
where ((t == real) || (t == int) || (t == uint(64))) && (d.rank == 1) {

var algorithm: SortingAlgorithm = ArgSortMsg.getSortingAlgorithm(alg);
const itemsize = dtypeSize(whichDtype(t));
Expand All @@ -50,7 +50,7 @@ module SortMsg


proc sort(array: [?d] ?t, alg: string, axis: int): [d] t throws
where ( (t == real) || (t==int) || (t==uint(64)) ) && ( d.rank > 1 ) {
where ((t == real) || (t==int) || (t==uint(64))) && (d.rank > 1) {

var algorithm: SortingAlgorithm = ArgSortMsg.getSortingAlgorithm(alg);
const itemsize = dtypeSize(whichDtype(t));
Expand Down Expand Up @@ -94,8 +94,8 @@ module SortMsg


proc sort(array: [?d] ?t, alg: string, axis: int): [d] t throws
where ( (t != real) && (t!=int) && (t!=uint(64)) ) {
throw new Error("Insightful error message.");
where ((t != real) && (t!=int) && (t!=uint(64))) {
throw new Error("sort does not support type %s".format(dtype2str(t)));
}

// https://data-apis.org/array-api/latest/API_specification/generated/array_api.searchsorted.html#array_api.searchsorted
Expand All @@ -104,7 +104,7 @@ module SortMsg
where (t == real) && (t2 == real) && (d1.rank == 1) {

if side != "left" && side != "right" {
throw new Error("searchSorted only supports float64 type.");
throw new Error("searchSorted side must be a string with value 'left' or 'right'.");
}

var ret = makeDistArray((...x2.shape), int);
Expand All @@ -126,7 +126,7 @@ module SortMsg
}

proc searchSorted(x1: [?d1] ?t, x2: [?d2] ?t2, side: string): [d2] int throws
where (d1.rank != 1 ){
where (d1.rank != 1){
throw new Error("searchSorted only arrays x1 of dimension 1.");
}

Expand Down
Loading

0 comments on commit 9e7915e

Please sign in to comment.