Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add an ismatrix() function with tests
- Loading branch information
1 parent
3f29530
commit d4c9a30
Showing
2 changed files
with
11 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
plan(2); | ||
is(ismatrix(1), 0, "scalars are not matrices"); | ||
is(ismatrix([1]), 1, "matrices are matrices"); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
function what = ismatrix(var) | ||
code = [".sub '' :anon" | ||
" .param pmc x" | ||
" $I0 = does x, 'matrix'" | ||
" .return($I0)" | ||
".end"]; | ||
what = pir(code, var); | ||
endfunction |