Mercurial > hg > may
changeset 512:a165dbdc7ffb sized_matrix
Matrix construction fixes
author | Chris Cannam |
---|---|
date | Wed, 20 Nov 2013 14:43:14 +0000 |
parents | 395d644dcb71 |
children | d4bd9303a239 |
files | src/may/matrix.yeti src/may/matrix/test/test_complexmatrix.yeti src/may/matrix/test/test_matrix.yeti src/may/stream/test/test_channels.yeti src/may/stream/test/test_convolve.yeti src/may/vamp/test/test_vamp.yeti |
diffstat | 6 files changed, 110 insertions(+), 107 deletions(-) [+] |
line wrap: on
line diff
--- a/src/may/matrix.yeti Wed Nov 20 14:43:04 2013 +0000 +++ b/src/may/matrix.yeti Wed Nov 20 14:43:14 2013 +0000 @@ -301,6 +301,7 @@ // makeSparse and is also used to discard out-of-range cells from // resizedTo. //!!! doc: i is row number, j is column number (throughout, for sparse stuff). Would calling them row/column be better? +//!!! what to do with this, now that it doesn't match the former newMatrix? newSparseMatrix type size data = makeSparse type size (filter @@ -406,6 +407,7 @@ equal = equal' (==) vec.equal; +//!!! nb makeSparse takes type,size while this currently takes size,type - fix newMatrixOfSize size type rowscols = //!!! NB does not copy data if type == RowMajor () then { @@ -440,7 +442,7 @@ else vec.length (head cols) fi, }, - data = DenseRows (array cols) + data = DenseCols (array cols) }; newRowVector data = //!!! NB does not copy data
--- a/src/may/matrix/test/test_complexmatrix.yeti Wed Nov 20 14:43:04 2013 +0000 +++ b/src/may/matrix/test/test_complexmatrix.yeti Wed Nov 20 14:43:14 2013 +0000 @@ -11,8 +11,8 @@ aTestMatrix () = (// 1+0i 0-2i 3.5+6i // 0+0i 4-3i 1-0.2i - reals = mat.newMatrix (RowMajor ()) (map vec.fromList [[1,0,3.5],[0,4,1]]); - imags = mat.newMatrix (RowMajor ()) (map vec.fromList [[0,-2,6],[0,-3,-0.2]]); + reals = mat.fromRows (map vec.fromList [[1,0,3.5],[0,4,1]]); + imags = mat.fromRows (map vec.fromList [[0,-2,6],[0,-3,-0.2]]); cm.complex reals imags); [ @@ -21,10 +21,10 @@ // 1+0i 0-2i 3+0i // 4-1i 5-3i 0+0i reals = mat.toSparse - (mat.newMatrix (RowMajor ()) + (mat.fromRows (map vec.fromList [[1,0,3],[4,5,0]])); imags = mat.toSparse - (mat.newMatrix (ColumnMajor ()) + (mat.fromColumns (map vec.fromList [[0,-1],[-2,-3],[0,0]])); m = cm.complex reals imags; e = cm.enumerate m; @@ -68,22 +68,22 @@ "magnitudes": \( // 1+0i 0-2i // 0+0i 4-3i - reals = mat.newMatrix (RowMajor ()) (map vec.fromList [[1,0],[0,4]]); - imags = mat.newMatrix (RowMajor ()) (map vec.fromList [[0,-2],[0,-3]]); + reals = mat.fromRows (map vec.fromList [[1,0],[0,4]]); + imags = mat.fromRows (map vec.fromList [[0,-2],[0,-3]]); m = cm.complex reals imags; mags = cm.magnitudes m; compare (map vec.list (mat.asRows mags)) [[1,2],[0,5]]; ), "magnitudes-real": \( - reals = mat.newMatrix (RowMajor ()) (map vec.fromList [[1,0],[0,4]]); + reals = mat.fromRows (map vec.fromList [[1,0],[0,4]]); m = cm.fromReal reals; mags = cm.magnitudes m; compare (map vec.list (mat.asRows mags)) (map vec.list (mat.asRows reals)); ), "magnitudes-imag": \( - reals = mat.newMatrix (RowMajor ()) (map vec.fromList [[1,0],[0,4]]); + reals = mat.fromRows (map vec.fromList [[1,0],[0,4]]); m = cm.fromImaginary reals; mags = cm.magnitudes m; compare (map vec.list (mat.asRows mags)) (map vec.list (mat.asRows reals)); @@ -92,8 +92,8 @@ "density": \( // 1+0i 0-2i // 0+0i 4-3i - reals = mat.newMatrix (RowMajor ()) (map vec.fromList [[1,0],[0,4]]); - imags = mat.newMatrix (RowMajor ()) (map vec.fromList [[0,-2],[0,-3]]); + reals = mat.fromRows (map vec.fromList [[1,0],[0,4]]); + imags = mat.fromRows (map vec.fromList [[0,-2],[0,-3]]); compare (cm.density (cm.complex reals imags)) 0.75 and compare (cm.nonZeroValues (cm.complex reals imags)) 3 and compare (cm.density (cm.fromReal reals)) 0.5 and @@ -105,8 +105,8 @@ "angles": \( // 1+0i 0-2i // 0+0i -4-4i - reals = mat.newMatrix (RowMajor ()) (map vec.fromList [[1,0],[0,-4]]); - imags = mat.newMatrix (RowMajor ()) (map vec.fromList [[0,-2],[0,-4]]); + reals = mat.fromRows (map vec.fromList [[1,0],[0,-4]]); + imags = mat.fromRows (map vec.fromList [[0,-2],[0,-4]]); m = cm.complex reals imags; mags = cm.angles m; compare (map vec.list (mat.asRows mags)) [[0,-pi/2],[0,-3*pi/4]];
--- a/src/may/matrix/test/test_matrix.yeti Wed Nov 20 14:43:04 2013 +0000 +++ b/src/may/matrix/test/test_matrix.yeti Wed Nov 20 14:43:14 2013 +0000 @@ -16,7 +16,8 @@ randomMatrix s = flipper (mat.randomMatrix s); identityMatrix s = flipper (mat.identityMatrix s); generate f s = flipper (mat.generate f s); - newMatrix t d = flipper (mat.newMatrix t (map vec.fromList d)); + fromRows d = flipper (mat.fromRows (map vec.fromList d)); + fromColumns d = flipper (mat.fromColumns (map vec.fromList d)); [ "constMatrixEmpty-\(name)": \( @@ -95,11 +96,11 @@ ), "equal-\(name)": \( - m = newMatrix (ColumnMajor ()) [[1,4],[0,5],[3,6]]; + m = fromColumns [[1,4],[0,5],[3,6]]; n = m; - p = newMatrix (RowMajor ()) [[1,0,3],[4,5,6]]; - q = newMatrix (ColumnMajor ()) [[1,0,3],[4,5,6]]; - r = newMatrix (ColumnMajor ()) [[1,4],[0,5]]; + p = fromRows [[1,0,3],[4,5,6]]; + q = fromColumns [[1,0,3],[4,5,6]]; + r = fromColumns [[1,4],[0,5]]; compareMatrices m n and compareMatrices m p and compareMatrices n p and @@ -108,11 +109,11 @@ ), "equalUnder-\(name)": \( - p = newMatrix (ColumnMajor ()) [[1,2,3],[4,5,6]]; - q = newMatrix (ColumnMajor ()) [[1,2,3],[4,5,6]]; - r = newMatrix (ColumnMajor ()) [[4,3,1],[3,1,2]]; - s = newMatrix (ColumnMajor ()) [[1,4,5],[6,7,8]]; - t = newMatrix (ColumnMajor ()) [[1,4,5],[6,7,9]]; + p = fromColumns [[1,2,3],[4,5,6]]; + q = fromColumns [[1,2,3],[4,5,6]]; + r = fromColumns [[4,3,1],[3,1,2]]; + s = fromColumns [[1,4,5],[6,7,8]]; + t = fromColumns [[1,4,5],[6,7,9]]; mat.equalUnder (==) p p and mat.equalUnder (==) p q and mat.equalUnder (!=) p r and @@ -151,20 +152,20 @@ ), "transposed-back-\(name)": \( - m = newMatrix (ColumnMajor ()) [[1,4],[2,5],[3,6]]; + m = fromColumns [[1,4],[2,5],[3,6]]; compareMatrices m (mat.transposed (mat.transposed m)) and not mat.equal m (mat.transposed m); ), "flipped-\(name)": \( - m = newMatrix (ColumnMajor ()) [[1,4],[0,5],[3,6]]; + m = fromColumns [[1,4],[0,5],[3,6]]; m' = mat.flipped m; - m'' = newMatrix (RowMajor ()) [[1,0,3],[4,5,6]]; + m'' = fromRows [[1,0,3],[4,5,6]]; compareMatrices m m' and compareMatrices m m'' and compareMatrices m' m''; ), "flipped-back-\(name)": \( - m = newMatrix (ColumnMajor ()) [[1,4],[0,5],[3,6]]; + m = fromColumns [[1,4],[0,5],[3,6]]; compareMatrices m (mat.flipped (mat.flipped m)); ), @@ -174,25 +175,25 @@ ), "toRowMajor-\(name)": \( - m = newMatrix (ColumnMajor ()) [[1,4],[0,5],[3,6]]; + m = fromColumns [[1,4],[0,5],[3,6]]; m' = mat.toRowMajor m; - m'' = newMatrix (RowMajor ()) [[1,0,3],[4,5,6]]; + m'' = fromRows [[1,0,3],[4,5,6]]; m''' = mat.toRowMajor m''; compareMatrices m m' and compareMatrices m m'' and compareMatrices m' m'' and compareMatrices m m'''; ), "toColumnMajor-\(name)": \( - m = newMatrix (RowMajor ()) [[1,4],[0,5],[3,6]]; + m = fromRows [[1,4],[0,5],[3,6]]; m' = mat.toColumnMajor m; - m'' = newMatrix (ColumnMajor ()) [[1,0,3],[4,5,6]]; + m'' = fromColumns [[1,0,3],[4,5,6]]; m''' = mat.toColumnMajor m''; compareMatrices m m' and compareMatrices m m'' and compareMatrices m' m'' and compareMatrices m m'''; ), "diagonal-\(name)": \( - m = newMatrix (RowMajor ()) [[1,4],[0,5],[3,6]]; + m = fromRows [[1,4],[0,5],[3,6]]; compare (vec.list (mat.getDiagonal 0 m)) [1,5] and compare (vec.list (mat.getDiagonal 1 m)) [4] and compare (vec.list (mat.getDiagonal (-1) m)) [0,6] @@ -211,17 +212,17 @@ ), "transformRows-\(name)": \( - m = newMatrix (RowMajor ()) [[1,4],[0,5],[3,6]]; - m' = newMatrix (ColumnMajor ()) [[1,0,3],[4,5,6]]; - m'' = newMatrix (RowMajor ()) [[2,8],[0,10],[6,12]]; + m = fromRows [[1,4],[0,5],[3,6]]; + m' = fromColumns [[1,0,3],[4,5,6]]; + m'' = fromRows [[2,8],[0,10],[6,12]]; compareMatrices (mat.transformRows (vec.scaled 2) m) m'' and compareMatrices (mat.transformRows (vec.scaled 2) m') m'' ), "transformColumns-\(name)": \( - m = newMatrix (RowMajor ()) [[1,4],[0,5],[3,6]]; - m' = newMatrix (ColumnMajor ()) [[1,0,3],[4,5,6]]; - m'' = newMatrix (RowMajor ()) [[2,8],[0,10],[6,12]]; + m = fromRows [[1,4],[0,5],[3,6]]; + m' = fromColumns [[1,0,3],[4,5,6]]; + m'' = fromRows [[2,8],[0,10],[6,12]]; compareMatrices (mat.transformColumns (vec.scaled 2) m) m'' and compareMatrices (mat.transformColumns (vec.scaled 2) m') m'' ), @@ -314,8 +315,8 @@ "abs-\(name)": \( compareMatrices - (mat.abs (newMatrix (ColumnMajor ()) [[-1,4],[2,-5],[-3,0]])) - (newMatrix (ColumnMajor ()) [[1,4],[2,5],[3,0]]) + (mat.abs (fromColumns [[-1,4],[2,-5],[-3,0]])) + (fromColumns [[1,4],[2,5],[3,0]]) ), "product-\(name)": \( @@ -324,9 +325,9 @@ (constMatrix 3 { rows = 2, columns = 3 })) (constMatrix 12 { rows = 4, columns = 3 }) and compareMatrices - (mat.product (newMatrix (ColumnMajor ()) [[1,4],[2,5],[3,6]]) - (newMatrix (ColumnMajor ()) [[7,9,11],[8,10,12]])) - (newMatrix (ColumnMajor ()) [[58,139],[64,154]]) + (mat.product (fromColumns [[1,4],[2,5],[3,6]]) + (fromColumns [[7,9,11],[8,10,12]])) + (fromColumns [[58,139],[64,154]]) ), "sparseProduct-\(name)": \( @@ -366,34 +367,34 @@ "resizedTo-\(name)": \( compareMatrices (mat.resizedTo { rows = 2, columns = 2 } - (newMatrix (ColumnMajor ()) [[1,4],[2,5],[3,6]])) - (newMatrix (ColumnMajor ()) [[1,4],[2,5]]) and + (fromColumns [[1,4],[2,5],[3,6]])) + (fromColumns [[1,4],[2,5]]) and compareMatrices (mat.resizedTo { rows = 3, columns = 4 } - (newMatrix (ColumnMajor ()) [[1,4],[2,5],[3,6]])) - (newMatrix (ColumnMajor ()) [[1,4,0],[2,5,0],[3,6,0],[0,0,0]]) and + (fromColumns [[1,4],[2,5],[3,6]])) + (fromColumns [[1,4,0],[2,5,0],[3,6,0],[0,0,0]]) and compareMatrices (mat.resizedTo { rows = 1, columns = 1 } - (newMatrix (ColumnMajor ()) [[1,4],[2,5],[3,6]])) - (newMatrix (RowMajor ()) [[1]]) and + (fromColumns [[1,4],[2,5],[3,6]])) + (fromRows [[1]]) and compareMatrices (mat.resizedTo { rows = 2, columns = 3 } (mat.zeroMatrix { rows = 0, columns = 0 })) - (newMatrix (RowMajor ()) [[0,0,0],[0,0,0]]) and + (fromRows [[0,0,0],[0,0,0]]) and mat.isSparse? (mat.resizedTo { rows = 1, columns = 1 } - (mat.toSparse (newMatrix (ColumnMajor ()) [[1,4],[2,5],[3,6]]))) + (mat.toSparse (fromColumns [[1,4],[2,5],[3,6]]))) ), "zeroSizeMatrix-\(name)": \( compareMatrices (mat.zeroMatrix { rows = 0, columns = 0 }) - (newMatrix (ColumnMajor ()) []) and + (fromColumns []) and compareMatrices (mat.zeroMatrix { rows = 0, columns = 1 }) - (newMatrix (ColumnMajor ()) [[]]) and - (not mat.equal (newMatrix (ColumnMajor ()) [[]]) - (newMatrix (RowMajor ()) [[]])) and + (fromColumns [[]]) and + (not mat.equal (fromColumns [[]]) + (fromRows [[]])) and compareMatrices (mat.zeroMatrix { rows = 0, columns = 0 }) (mat.newSparseMatrix (ColumnMajor ()) { rows = 0, columns = 0 } []) and @@ -405,45 +406,45 @@ "asRows-\(name)": \( compare (map vec.list - (mat.asRows (newMatrix (ColumnMajor ()) [[1,4],[0,5],[3,6]]))) + (mat.asRows (fromColumns [[1,4],[0,5],[3,6]]))) [[1,0,3],[4,5,6]]; ), "asColumns-\(name)": \( compare (map vec.list - (mat.asColumns (newMatrix (ColumnMajor ()) [[1,4],[0,5],[3,6]]))) + (mat.asColumns (fromColumns [[1,4],[0,5],[3,6]]))) [[1,4],[0,5],[3,6]]; ), "concat-horiz-\(name)": \( compareMatrices (mat.concatHorizontal - [(newMatrix (ColumnMajor ()) [[1,4],[0,5]]), - (newMatrix (RowMajor ()) [[3],[6]])]) - (newMatrix (ColumnMajor ()) [[1,4],[0,5],[3,6]]) + [(fromColumns [[1,4],[0,5]]), + (fromRows [[3],[6]])]) + (fromColumns [[1,4],[0,5],[3,6]]) ), "concatEmpty-horiz-\(name)": \( compareMatrices (mat.concatHorizontal - [(newMatrix (ColumnMajor ()) [[]]), - (newMatrix (ColumnMajor ()) [[],[]]), + [(fromColumns [[]]), + (fromColumns [[],[]]), (mat.zeroMatrix { rows = 0, columns = 6 })]) (mat.zeroMatrix { rows = 0, columns = 9 }) and compareMatrices (mat.concatHorizontal - [(newMatrix (RowMajor ()) [[]]), - (newMatrix (RowMajor ()) [[1,2]]), + [(fromRows [[]]), + (fromRows [[1,2]]), (mat.zeroMatrix { rows = 1, columns = 0 })]) - (newMatrix (RowMajor ()) [[1,2]]) + (fromRows [[1,2]]) ), "sparseConcat-horiz-\(name)": \( s = mat.concatHorizontal - [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 + [mat.toSparse (fromColumns [[1,4],[0,5]]), + mat.toSparse (fromRows [[3],[6]])]; + compareMatrices s (fromColumns [[1,4],[0,5],[3,6]]) and compare (mat.isSparse? s) true and compare (mat.density s) (5/6) ), @@ -451,8 +452,8 @@ "concatFail-horiz-\(name)": \( try \() (mat.concatHorizontal - [(newMatrix (ColumnMajor ()) [[1,4],[0,5]]), - (newMatrix (ColumnMajor ()) [[3],[6]])]); + [(fromColumns [[1,4],[0,5]]), + (fromColumns [[3],[6]])]); false catch FailureException e: true @@ -462,16 +463,16 @@ "concat-vert-\(name)": \( compareMatrices (mat.concatVertical - [(newMatrix (ColumnMajor ()) [[1,4],[0,5]]), - (newMatrix (RowMajor ()) [[3,6]])]) - (newMatrix (ColumnMajor ()) [[1,4,3],[0,5,6]]) + [(fromColumns [[1,4],[0,5]]), + (fromRows [[3,6]])]) + (fromColumns [[1,4,3],[0,5,6]]) ), "sparseConcat-vert-\(name)": \( s = mat.concatVertical - [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 + [mat.toSparse (fromColumns [[1,4],[0,5]]), + mat.toSparse (fromRows [[3,6]])]; + compareMatrices s (fromColumns [[1,4,3],[0,5,6]]) and compare (mat.isSparse? s) true and compare (mat.density s) (5/6) ), @@ -479,8 +480,8 @@ "concatFail-vert-\(name)": \( try \() (mat.concatVertical - [(newMatrix (ColumnMajor ()) [[1,4],[0,5]]), - (newMatrix (RowMajor ()) [[3],[6]])]); + [(fromColumns [[1,4],[0,5]]), + (fromRows [[3],[6]])]); false catch FailureException e: true @@ -489,58 +490,58 @@ "rowSlice-\(name)": \( compareMatrices - (mat.rowSlice (newMatrix (RowMajor ()) [[1,0],[3,4],[0,6],[7,8]]) 1 3) - (newMatrix (RowMajor ()) [[3,4],[0,6]]) and + (mat.rowSlice (fromRows [[1,0],[3,4],[0,6],[7,8]]) 1 3) + (fromRows [[3,4],[0,6]]) and compareMatrices - (mat.rowSlice (newMatrix (RowMajor ()) [[1,0],[3,4],[0,6],[7,8]]) 3 6) - (newMatrix (RowMajor ()) [[7,8]]) + (mat.rowSlice (fromRows [[1,0],[3,4],[0,6],[7,8]]) 3 6) + (fromRows [[7,8]]) ), "columnSlice-\(name)": \( compareMatrices - (mat.columnSlice (newMatrix (RowMajor ()) [[1,0,3,4],[0,6,7,8]]) 1 3) - (newMatrix (RowMajor ()) [[0,3],[6,7]]) and + (mat.columnSlice (fromRows [[1,0,3,4],[0,6,7,8]]) 1 3) + (fromRows [[0,3],[6,7]]) and compareMatrices - (mat.columnSlice (newMatrix (RowMajor ()) [[1,0,3,4],[0,6,7,8]]) 2 5) - (newMatrix (RowMajor ()) [[3,4],[7,8]]) + (mat.columnSlice (fromRows [[1,0,3,4],[0,6,7,8]]) 2 5) + (fromRows [[3,4],[7,8]]) ), "density-\(name)": \( - compare (mat.density (newMatrix (ColumnMajor ()) [[1,2,0],[0,5,0]])) (3/6) and - compare (mat.density (newMatrix (ColumnMajor ()) [[1,2,3],[4,5,6]])) (6/6) and - compare (mat.density (newMatrix (ColumnMajor ()) [[0,0,0],[0,0,0]])) 0 + compare (mat.density (fromColumns [[1,2,0],[0,5,0]])) (3/6) and + compare (mat.density (fromColumns [[1,2,3],[4,5,6]])) (6/6) and + compare (mat.density (fromColumns [[0,0,0],[0,0,0]])) 0 ), "nonZeroValues-\(name)": \( - compare (mat.nonZeroValues (newMatrix (ColumnMajor ()) [[1,2,0],[0,5,0]])) 3 and - compare (mat.nonZeroValues (newMatrix (ColumnMajor ()) [[1,2,3],[4,5,6]])) 6 and - compare (mat.nonZeroValues (newMatrix (ColumnMajor ()) [[0,0,0],[0,0,0]])) 0 + compare (mat.nonZeroValues (fromColumns [[1,2,0],[0,5,0]])) 3 and + compare (mat.nonZeroValues (fromColumns [[1,2,3],[4,5,6]])) 6 and + compare (mat.nonZeroValues (fromColumns [[0,0,0],[0,0,0]])) 0 ), "toSparse-\(name)": \( - m = newMatrix (ColumnMajor ()) [[1,2,0],[-1,-4,6],[0,0,3]]; + m = fromColumns [[1,2,0],[-1,-4,6],[0,0,3]]; compareMatrices (mat.toSparse m) m and compareMatrices (mat.toDense (mat.toSparse m)) m and compare (mat.density (mat.toSparse m)) (6/9) ), "toDense-\(name)": \( - m = newMatrix (ColumnMajor ()) [[1,2,0],[-1,-4,6],[0,0,3]]; + m = fromColumns [[1,2,0],[-1,-4,6],[0,0,3]]; compareMatrices (mat.toDense m) m and compareMatrices (mat.toSparse (mat.toDense m)) m ), "filter-\(name)": \( - m = newMatrix (ColumnMajor ()) [[1,2,0],[-1,-4,6],[0,0,3]]; + m = fromColumns [[1,2,0],[-1,-4,6],[0,0,3]]; compareMatrices (mat.filter (> 2) m) - (newMatrix (ColumnMajor ()) [[0,0,0],[0,0,6],[0,0,3]]) and + (fromColumns [[0,0,0],[0,0,6],[0,0,3]]) and compare (mat.isSparse? (mat.filter (> 2) m)) true and compare (mat.density (mat.filter (> 2) m)) (2/9) ), "all-\(name)": \( - m = newMatrix (ColumnMajor ()) [[1,2,0],[-1,-4,6],[0,0,3]]; + m = fromColumns [[1,2,0],[-1,-4,6],[0,0,3]]; compare (mat.all (== 9) m) false and compare (mat.all (!= 9) m) true and compare (mat.all (== 2) m) false and @@ -548,7 +549,7 @@ ), "any-\(name)": \( - m = newMatrix (ColumnMajor ()) [[1,2,0],[-1,-4,6],[0,0,3]]; + m = fromColumns [[1,2,0],[-1,-4,6],[0,0,3]]; compare (mat.any (== 9) m) false and compare (mat.any (!= 9) m) true and compare (mat.any (== 2) m) true and @@ -576,13 +577,13 @@ ]; compare (mat.density s) (3/6) and compare (mat.density t) (2/6) and - compareMatrices s (newMatrix (RowMajor ()) [[1,0,2],[0,4,0]]) and - compareMatrices t (newMatrix (RowMajor ()) [[1,0,0],[0,4,0]]) and - compareMatrices u (newMatrix (RowMajor ()) [[0,0,0],[0,0,0]]) + compareMatrices s (fromRows [[1,0,2],[0,4,0]]) and + compareMatrices t (fromRows [[1,0,0],[0,4,0]]) and + compareMatrices u (fromRows [[0,0,0],[0,0,0]]) ), "enumerate-\(name)": \( - m = newMatrix (ColumnMajor ()) [[1,2,0],[-1,-4,6],[0,0,3]]; + m = fromColumns [[1,2,0],[-1,-4,6],[0,0,3]]; all = [ { i = 0, j = 0, v = 1 }, { i = 1, j = 0, v = 2 },
--- a/src/may/stream/test/test_channels.yeti Wed Nov 20 14:43:04 2013 +0000 +++ b/src/may/stream/test/test_channels.yeti Wed Nov 20 14:43:14 2013 +0000 @@ -7,7 +7,7 @@ { compare, compareUsing } = load may.test.test; -newMatrix data = mat.newMatrix (ColumnMajor ()) (map vec.fromList data); +newMatrix data = mat.fromColumns (map vec.fromList data); compareBlocks b1 b2 = compare (vec.list b1) (vec.list b2);
--- a/src/may/stream/test/test_convolve.yeti Wed Nov 20 14:43:04 2013 +0000 +++ b/src/may/stream/test/test_convolve.yeti Wed Nov 20 14:43:14 2013 +0000 @@ -85,11 +85,11 @@ "convolvedImpulse-multichannel-\(name)": \( all id (map do opts: - ir = mat.newMatrix (RowMajor ()) + ir = mat.fromRows (map vec.fromList [[0,0,0,1],[8,6,4,2],[1,0,-1,0]]); signal = maybeDuration 4 (syn.precalculated 2 - (mat.newMatrix (RowMajor ()) + (mat.fromRows (map vec.fromList [[1,1,0,0],[0,1,1,0],[0,0,1,1]]))); c = convolve.convolvedWith opts ir signal; if compareClose (map vec.list (mat.asRows (c.read 7)))
--- a/src/may/vamp/test/test_vamp.yeti Wed Nov 20 14:43:04 2013 +0000 +++ b/src/may/vamp/test/test_vamp.yeti Wed Nov 20 14:43:14 2013 +0000 @@ -90,7 +90,7 @@ case processTest "grid-oss" of //!!! test spacing? Grid g: compareUsing mat.equal g - (mat.newMatrix (ColumnMajor ()) + (mat.fromColumns (map do x: (vec.fromList . floats) (map do y: (x + y + 2) / 30 @@ -104,7 +104,7 @@ case processTest "grid-fsr" of //!!! test spacing? Grid g: compareUsing mat.equal g - (mat.newMatrix (ColumnMajor ()) + (mat.fromColumns (map do x: (vec.fromList . floats) (map do y: (x + y + 2) / 20