# HG changeset patch # User Chris Cannam # Date 1367063464 -3600 # Node ID 9ade635dbad651906d7b52bd0f504dc620f40aca # Parent 9852a273e559a54411ae3826876bfdc697f098e5 Add complex.zeros diff -r 9852a273e559 -r 9ade635dbad6 yetilab/block/complex.yeti --- a/yetilab/block/complex.yeti Thu Apr 25 16:23:33 2013 +0100 +++ b/yetilab/block/complex.yeti Sat Apr 27 12:51:04 2013 +0100 @@ -60,6 +60,9 @@ scale r c is number -> ~Cplx -> ~Cplx = complex (r * real c) (r * imaginary c); +zeros n is number -> array<~Cplx> = + array (map \(complex 0 0) [1..n]); + { real, imaginary, @@ -68,6 +71,7 @@ angle, add, scale, + zeros, } as { real is cplx -> number, imaginary is cplx -> number, @@ -76,5 +80,6 @@ angle is cplx -> number, add is cplx -> cplx -> cplx, scale is number -> cplx -> cplx, + zeros is number -> array, } diff -r 9852a273e559 -r 9ade635dbad6 yetilab/block/test/test_complex.yeti --- a/yetilab/block/test/test_complex.yeti Thu Apr 25 16:23:33 2013 +0100 +++ b/yetilab/block/test/test_complex.yeti Sat Apr 27 12:51:04 2013 +0100 @@ -1,6 +1,6 @@ module yetilab.block.test.test_complex; -{ real, imaginary, complex, magnitude, angle, add, scale } +{ real, imaginary, complex, magnitude, angle, add, scale, zeros } = load yetilab.block.complex; { compare } = load yetilab.test.test; @@ -40,6 +40,11 @@ compare (scale 4 (complex 2 3)) (complex 8 12) ), +"zeros": \( + compare (zeros 0) (array []) and + compare (zeros 3) (array [complex 0 0, complex 0 0, complex 0 0]) +), + ] is hash boolean>;