Mercurial > hg > may
comparison yetilab/matrix/test/test_matrix.yeti @ 277:678477bf617c
(clumsily) make slice functions handle out-of-range arguments properly
author | Chris Cannam |
---|---|
date | Sat, 25 May 2013 18:41:53 +0100 |
parents | 2c3faf6a2820 |
children | 7f000ae124db |
comparison
equal
deleted
inserted
replaced
276:39b5f3fed12d | 277:678477bf617c |
---|---|
446 ), | 446 ), |
447 | 447 |
448 "rowSlice-\(name)": \( | 448 "rowSlice-\(name)": \( |
449 compareMatrices | 449 compareMatrices |
450 (mat.rowSlice (newMatrix (RowMajor ()) [[1,0],[3,4],[0,6],[7,8]]) 1 3) | 450 (mat.rowSlice (newMatrix (RowMajor ()) [[1,0],[3,4],[0,6],[7,8]]) 1 3) |
451 (newMatrix (RowMajor ()) [[3,4],[0,6]]) | 451 (newMatrix (RowMajor ()) [[3,4],[0,6]]) and |
452 compareMatrices | |
453 (mat.rowSlice (newMatrix (RowMajor ()) [[1,0],[3,4],[0,6],[7,8]]) 3 6) | |
454 (newMatrix (RowMajor ()) [[7,8]]) | |
452 ), | 455 ), |
453 | 456 |
454 "columnSlice-\(name)": \( | 457 "columnSlice-\(name)": \( |
455 compareMatrices | 458 compareMatrices |
456 (mat.columnSlice (newMatrix (RowMajor ()) [[1,0,3,4],[0,6,7,8]]) 1 3) | 459 (mat.columnSlice (newMatrix (RowMajor ()) [[1,0,3,4],[0,6,7,8]]) 1 3) |
457 (newMatrix (RowMajor ()) [[0,3],[6,7]]) | 460 (newMatrix (RowMajor ()) [[0,3],[6,7]]) and |
461 compareMatrices | |
462 (mat.columnSlice (newMatrix (RowMajor ()) [[1,0,3,4],[0,6,7,8]]) 2 5) | |
463 (newMatrix (RowMajor ()) [[3,4],[7,8]]) | |
458 ), | 464 ), |
459 | 465 |
460 "density-\(name)": \( | 466 "density-\(name)": \( |
461 compare (mat.density (newMatrix (ColumnMajor ()) [[1,2,0],[0,5,0]])) (3/6) and | 467 compare (mat.density (newMatrix (ColumnMajor ()) [[1,2,0],[0,5,0]])) (3/6) and |
462 compare (mat.density (newMatrix (ColumnMajor ()) [[1,2,3],[4,5,6]])) (6/6) and | 468 compare (mat.density (newMatrix (ColumnMajor ()) [[1,2,3],[4,5,6]])) (6/6) and |