Merge pull request #229 from adrianVmariano/master

move submatrix to arrays and relax input restrictions
This commit is contained in:
Revar Desmera
2020-08-04 00:38:23 -07:00
committed by GitHub
4 changed files with 53 additions and 29 deletions

View File

@@ -853,22 +853,6 @@ module test_real_roots(){
}
test_real_roots();
// Need decision about behavior for out of bounds ranges, empty ranges
module test_submatrix(){
M = [[1,2,3,4,5],
[6,7,8,9,10],
[11,12,13,14,15],
[16,17,18,19,20],
[21,22,23,24,25]];
assert_equal(submatrix(M,[1:2], [3:4]), [[9,10],[14,15]]);
assert_equal(submatrix(M,[1], [3,4]), [[9,10]]);
assert_equal(submatrix(M,1, [3,4]), [[9,10]]);
assert_equal(submatrix(M, [3,4],1), [[17],[22]]);
assert_equal(submatrix(M, [1,3],[2,4]), [[8,10],[18,20]]);
}
test_submatrix();
module test_qr_factor() {
// Check that R is upper triangular