Mercurial > hg > may
diff yetilab/matrix/test/test_matrix.yeti @ 259:fae62dca8048
Make concat also return sparse when all its inputs are sparse
author | Chris Cannam |
---|---|
date | Wed, 22 May 2013 09:22:10 +0100 |
parents | f3b7b5d20f88 |
children | de770971a628 |
line wrap: on
line diff
--- a/yetilab/matrix/test/test_matrix.yeti Wed May 22 08:56:51 2013 +0100 +++ b/yetilab/matrix/test/test_matrix.yeti Wed May 22 09:22:10 2013 +0100 @@ -382,6 +382,15 @@ (newMatrix (ColumnMajor ()) [[1,4],[0,5],[3,6]]) ), +"sparseConcat-horiz-\(name)": \( + s = mat.concat (Horizontal ()) + [mat.toSparse (newMatrix (ColumnMajor ()) [[1,4],[0,5]]), + mat.toSparse (newMatrix (RowMajor ()) [[3],[6]])]; + compareMatrices s (newMatrix (ColumnMajor ()) [[1,4],[0,5],[3,6]]) and + compare (mat.isSparse? s) true and + compare (mat.density s) (5/6) +), + "concatFail-horiz-\(name)": \( try \() (mat.concat (Horizontal ()) @@ -401,6 +410,15 @@ (newMatrix (ColumnMajor ()) [[1,4,3],[0,5,6]]) ), +"sparseConcat-vert-\(name)": \( + s = mat.concat (Vertical ()) + [mat.toSparse (newMatrix (ColumnMajor ()) [[1,4],[0,5]]), + mat.toSparse (newMatrix (RowMajor ()) [[3,6]])]; + compareMatrices s (newMatrix (ColumnMajor ()) [[1,4,3],[0,5,6]]) and + compare (mat.isSparse? s) true and + compare (mat.density s) (5/6) +), + "concatFail-vert-\(name)": \( try \() (mat.concat (Vertical ())