# HG changeset patch # User Chris Cannam # Date 1382635686 -3600 # Node ID ba7824b1f4408e7abd881fae528b96f208ecb9dd # Parent fb9399820e55423d3fe8122e7cf3381824d0e060 Add newComplexMatrix diff -r fb9399820e55 -r ba7824b1f440 src/may/matrix/complex.yeti --- 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?> -> complexmatrix, }