Hi Folks -- In the alpha 0.0.1 version of imfourier(...) I implemented the following features: a) If the input consists of 1 column of N rows, the input is interpreted as N complex numbers in the obvious way. As usual, floats are a subset of complex, and can be freely mixed in. b) If the input consists of 2 columns of N rows, each row is interpreted as a (real, imaginary) pair.
I wish to partially retract feature (b) ... not because the idea is bad, but because it is too good. The feature should not be limited to the imfourier(...) function. It should be more widely available. Therefore I have implemented imjoin(...) which takes an area of N rows of M columns of real numbers, representing (real, imaginary) pairs. It returns an area of N rows by (M+1)/2 columns, representing complex numbers. So now we write =imfourier(imjoin(A1:B4)) ============= As you might imagine, I also implemented imsplit(...) which takes an area of N rows of M columns of complex numbers and returns an area of N rows by 2M columns of floats. =========================== FWIW I wrote a the C code for a collect_complex_values(...) function, rather closely analogous to collect_floats_value(...) function. This makes it noticeably easier to implement spreadsheet features such as imsplit(...) and imjoin(...). It also applies to things like imsumproduct(...) as mentioned in the previous message. ========================== Discussion: I am quite aware that for one or two numbers, one can use complex(...), imreal(...), and imaginary(...). However, when dealing with large two-dimensional arrays of complex numbers, imsplit and imjoin are significantly easier to use. In particular, routinely unpacking the CNS (complex number string) representation to separate (real, imaginary) parts solves all sorts of problems ... starting with the fact that you can *format* the separate representation but cannot format the CNS representation. So, from a user-interface point of view, there is a premium on making the packing and unpacking as simple as possible. _______________________________________________ gnumeric-list mailing list gnumeric-list@gnome.org https://mail.gnome.org/mailman/listinfo/gnumeric-list