Mercurial > hg > may
changeset 457:ba7824b1f440
Add newComplexMatrix
author | Chris Cannam |
---|---|
date | Thu, 24 Oct 2013 18:28:06 +0100 |
parents | fb9399820e55 |
children | a8078de88289 |
files | src/may/matrix/complex.yeti |
diffstat | 1 files changed, 11 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/may/matrix/complex.yeti Thu Oct 24 18:01:59 2013 +0100 +++ b/src/may/matrix/complex.yeti Thu Oct 24 18:28:06 2013 +0100 @@ -2,9 +2,12 @@ module may.matrix.complex; mat = load may.matrix; +vec = load may.vector; +cpx = load may.complex; load may.matrix.type; load may.matrix.complextype; +load may.complex.type; complex real imaginary = (size = mat.size real; @@ -93,6 +96,12 @@ imaginary = addParts (multiplyParts b c) (multiplyParts a d); }); +newComplexMatrix type data = + (newPart f type d = + mat.newMatrix type + (map do cc: vec.fromList (map f cc) done data); + complex (newPart cpx.real type data) (newPart cpx.imaginary type data)); + { complex, fromReal, @@ -101,6 +110,7 @@ imaginary, sum, product, + newComplexMatrix, } as { complex is matrix -> matrix -> complexmatrix, fromReal is matrix -> complexmatrix, @@ -109,5 +119,6 @@ imaginary is complexmatrix -> matrix, sum is complexmatrix -> complexmatrix -> complexmatrix, product is complexmatrix -> complexmatrix -> complexmatrix, + newComplexMatrix is (ColumnMajor () | RowMajor ()) -> list?<list?<cplx>> -> complexmatrix, }