Moved submatrix to arrays.scad and relaxed requirement for numerical

input.  Added examples and tests.
This commit is contained in:
Adrian Mariano
2020-08-03 19:49:22 -04:00
parent a05509dc6d
commit 4e36eacca8
4 changed files with 51 additions and 28 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