# HG changeset patch # User Chris Cannam # Date 1398850513 -3600 # Node ID 9a40a9eedba7f624c28b8f27e3678d21e9663af9 # Parent ab85dfc45e3f9d39e5a237d2e702fc2d637fc96f Better error reporting diff -r ab85dfc45e3f -r 9a40a9eedba7 src/may/matrix.yeti --- a/src/may/matrix.yeti Sat Apr 05 16:02:24 2014 +0100 +++ b/src/may/matrix.yeti Wed Apr 30 10:35:13 2014 +0100 @@ -132,6 +132,7 @@ //!!! better as getXx or just xx? +//!!! arguably getRow, getColumn, getDiagonal should have m as first arg for symmetry with at getColumn j m = case m.data of DenseCols cols: cols[j]; diff -r ab85dfc45e3f -r 9a40a9eedba7 src/may/stream/framer.yeti --- a/src/may/stream/framer.yeti Sat Apr 05 16:02:24 2014 +0100 +++ b/src/may/stream/framer.yeti Wed Apr 30 10:35:13 2014 +0100 @@ -234,6 +234,7 @@ Hop h: hop := h; Padded p: padded := p; Window w: winopt := Some w; + FrequencyDomain f: failWith "Cannot stream from real input with FrequencyDomain true (need to use complexStreamed)"; esac; window = case winopt of @@ -253,6 +254,7 @@ streamOverlapping rate { framesize, hop, window } frames; fi); +//!!! todo: this is not yet tested complexStreamed rate framesize options frames = (streamOptions = array []; var rowTransform = complex.magnitudes; @@ -282,7 +284,7 @@ overlapAdd, - streamed, - complexStreamed, + streamed is number -> number -> list? -> list -> stream_t, + complexStreamed is number -> number -> list? -> list -> stream_t, } diff -r ab85dfc45e3f -r 9a40a9eedba7 src/may/transform/fft.yeti --- a/src/may/transform/fft.yeti Sat Apr 05 16:02:24 2014 +0100 +++ b/src/may/transform/fft.yeti Wed Apr 30 10:35:13 2014 +0100 @@ -71,12 +71,17 @@ realForwardMagnitude n = complex.magnitudes . (realForward n); -//!!! doc: input requires n/2+1 complex values (or should test and throw?) +//!!! doc: input requires n/2+1 complex values //!!! doc: powers of two only? check with jtransforms +//!!! this function fails if the input is the wrong length (and that is the right thing to do I think) but the other functions just resize it. Should they fail too? realInverse n = (d = new DoubleFFT_1D(n); do cplx: - arr = complexToPacked (array cplx); + carr = array cplx; + if length carr != 1 + int (n/2) then + failWith "Complex-to-real inverse FFT of size \(n) expects \(1 + int (n/2)) complex values as input (DC to Nyquist only), not \(length carr) as supplied"; + fi; + arr = complexToPacked carr; d#realInverse(arr, true); vec.vector arr; done);