Reply by glen herrmannsfeldt December 18, 20112011-12-18
robert bristow-johnson <rbj@audioimagination.com> wrote:
> >> But: a "true" complex-valued filter and the discussed structure with four >> real-valued filters are one and the same thing. >> A complex-valued multiplication needs four real-valued multiplications.
> i dunno, but a long time ago someone posted here how to do an arbitrary > complex multiplication with *three* real mults and a whole shitload of > addition operations. can't remember how it was done (someone like Clay > will know, i'll bet).
It is, at least, in Knuth's "The Art of Computer Programming." I should know which volume, but I am not so sure right now. Best is to have them all.
> i wonder what implication that three-mult complex multiplication might > have on a complex-in, complex-out filter. can that be done with 3 real > filters (and a shitload of adds)?
The multiplication algorithms generalize such that you can do multiple precision (as many digits as you want) faster than N**2 though the use of the FFT. Yes, it is a strange place to put the FFT, but it is fast. Using this, pi has been computed to a really huge number of digits and verified. -- glen
Reply by mnentwig December 18, 20112011-12-18
Alright, never mind my comment counting the multipliers. 
What I was trying to say is: A complex-valued FIR convolves complex-valued
data with a complex-valued impulse response. I can treat it as a "black
box", and won't be able to tell from the outside, how exactly it is
implemented.

Reply by kaz December 18, 20112011-12-18
>you're right: >http://mathworld.wolfram.com/ComplexMultiplication.html >>>Surprisingly, complex multiplication can be carried out using only
three
>real multiplications >
I have already snippet on that not far away: http://www.dsprelated.com/showcode/227.php kadhiem
Reply by mnentwig December 18, 20112011-12-18
you're right:
http://mathworld.wolfram.com/ComplexMultiplication.html
>>Surprisingly, complex multiplication can be carried out using only three
real multiplications
Reply by robert bristow-johnson December 18, 20112011-12-18
On 12/18/11 3:27 PM, robert bristow-johnson wrote:
> On 12/18/11 3:18 PM, mnentwig wrote: >> >> But: a "true" complex-valued filter and the discussed structure with four >> real-valued filters are one and the same thing. >> A complex-valued multiplication needs four real-valued multiplications. > > i dunno, but a long time ago someone posted here how to do an arbitrary > complex multiplication with *three* real mults and a whole shitload of > addition operations. can't remember how it was done (someone like Clay > will know, i'll bet). >
check out http://mathworld.wolfram.com/ComplexMultiplication.html . Re{z*w} = Re{z}*Re{w} - Im{z}*Im{w} Im{z*w} = (Re{z}+Im{z})*(Re{w}+Im{w}) - Re{z}*Re{w} - Im{z}*Im{w}
>> That's no coincidence. > > i wonder what implication that three-mult complex multiplication might > have on a complex-in, complex-out filter. can that be done with 3 real > filters (and a shitload of adds)?
would that also work to accomplish arbitrary complex convolution with 3 different real impulse responses??? -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
Reply by robert bristow-johnson December 18, 20112011-12-18
On 12/18/11 3:18 PM, mnentwig wrote:
> > But: a "true" complex-valued filter and the discussed structure with four > real-valued filters are one and the same thing. > A complex-valued multiplication needs four real-valued multiplications.
i dunno, but a long time ago someone posted here how to do an arbitrary complex multiplication with *three* real mults and a whole shitload of addition operations. can't remember how it was done (someone like Clay will know, i'll bet).
> That's no coincidence.
i wonder what implication that three-mult complex multiplication might have on a complex-in, complex-out filter. can that be done with 3 real filters (and a shitload of adds)? -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
Reply by mnentwig December 18, 20112011-12-18
>> I assume a complex filter is needed at times e.g. if you want
asymmetrical control of frequency shaping you can do that. For example, the equalizer chapter in Proakis / Digital Communications shows how to find the complex-valued coefficients LMS-optimally. But: a "true" complex-valued filter and the discussed structure with four real-valued filters are one and the same thing. A complex-valued multiplication needs four real-valued multiplications. That's no coincidence.
Reply by kaz December 18, 20112011-12-18
>On 12/18/11 5:04 AM, kaz wrote: >> >> However, the original post is about complex filter. Above trick implies >> real filter I think. > >lessee, what's a complex filter? one with complex voltages going in and >coming out? (i would like to get my hands on a voltmeter that would >measure the real and imaginary parts of an instantaneous voltage value.) > >a complex filter is one that has derived or contrived imaginary parts in >the input and output signals and, assuming it's LTI, really is 4 real >filters: real in to real out summed with imag in to real out, real in to >imag out and imag in to imag out (also summed). > >and the imag out is a label. not a physical thing. > >now, i think, if that filter behaves appropriately (analytically), the >real to real and imag to imag must be the same transfer function (with a >real impulse response), and the real to imag and imag to real are the >same transfer function (also with a real impulse response), but >negatives of each other. since the two impulse responses are real, if >the two real filters are both causal, the real and imag parts of the >frequency responses are Hilbert pairs, and if the filters are meant to >be minimum phase, the log magnitude and phase responses are Hilbert
pairs.
> >so there are really two real filters with arbitrary magnitude and >*perhaps* arbitrary phase response (it doesn't *have* to be minimum >phase and maybe not even causal). and they can be designed optimally >(in the sense of the minmax norm, not a Euclidian norm) by that trick >that Eric put on the dspguru site. or, as Vlad mentioned, you can >design it less optimally, but easily, by computing the impulse response >of the arbitrary filter and windowing it. i would suggest using a >Kaiser window with beta somewhere around 5. > > >-- > >r b-j rbj@audioimagination.com > >"Imagination is more important than knowledge." >
I assume a complex filter is needed at times e.g. if you want asymmetrical control of frequency shaping of signal where filter is applied at baseband but distortion occurs in higher RF frequency with asymmetrical channel effect on sidebands. Two real filters on I and Q separately will always have mirrored response. It will be great saving of multipliers if one can get away with complex filtering but can we in such situations? kadhiem
Reply by robert bristow-johnson December 18, 20112011-12-18
On 12/18/11 5:04 AM, kaz wrote:
> > However, the original post is about complex filter. Above trick implies > real filter I think.
lessee, what's a complex filter? one with complex voltages going in and coming out? (i would like to get my hands on a voltmeter that would measure the real and imaginary parts of an instantaneous voltage value.) a complex filter is one that has derived or contrived imaginary parts in the input and output signals and, assuming it's LTI, really is 4 real filters: real in to real out summed with imag in to real out, real in to imag out and imag in to imag out (also summed). and the imag out is a label. not a physical thing. now, i think, if that filter behaves appropriately (analytically), the real to real and imag to imag must be the same transfer function (with a real impulse response), and the real to imag and imag to real are the same transfer function (also with a real impulse response), but negatives of each other. since the two impulse responses are real, if the two real filters are both causal, the real and imag parts of the frequency responses are Hilbert pairs, and if the filters are meant to be minimum phase, the log magnitude and phase responses are Hilbert pairs. so there are really two real filters with arbitrary magnitude and *perhaps* arbitrary phase response (it doesn't *have* to be minimum phase and maybe not even causal). and they can be designed optimally (in the sense of the minmax norm, not a Euclidian norm) by that trick that Eric put on the dspguru site. or, as Vlad mentioned, you can design it less optimally, but easily, by computing the impulse response of the arbitrary filter and windowing it. i would suggest using a Kaiser window with beta somewhere around 5. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
Reply by kaz December 18, 20112011-12-18
>On 12/11/11 7:16 PM, klayman wrote: >> Hello! >> >> I am working on a project, and I have to design a optimal complex FIR >> filter with arbitrary amplitude and phase responses. >> I found a MATLAB function 'cfirpm' which looks like a algorithm from
this
>> article: >> "Karam, L.J., and J.H. McClellan. "Complex Chebyshev Approximation for
FIR
>> Filter Design." IEEE Trans. on Circuits and Systems II,March 1995. >> Pgs.207-216." >> >> But I can't realize how to work there with arbitrary phase.. >> >> I think, that is possible to get final filter in convolution of impulse >> responses of two filters - first filter - filter with arbitrary
amplitude
>> response, second - with arbitrary phase. > >there's no simplicity to be gained in optimally designing a filter with >flat amplitude response and arbitrary phase. switching the two around >is not so bad, you can use Parks-McClellan to optimally design an FIR >filter with arbitrary amplitude response and linear phase (conceptually >zero-phase for a non-causal filter with symmetric impulse response about >t=0). > >however a previous incarnation (the Minister of Algorithms) of Eric >Jacobsen thought up an interesting trick at > > >http://www.dspguru.com/dsp/tricks/using-parks-mcclellan-to-design-non-linear-phase-fir-filter
> > >the idea is to split your amplitude and phase specification into real >part and imaginary part. > >for the real part, which is even symmetry in both the frequency and time >domains, use the regular Parks-McClellan for Type 1 (odd length, even >symmetry) or Type 2 (even length, even symmetry) FIRs. > >for the imaginary part, which is odd symmetry in both frequency and time >domains, use the Parks-McClellan algorithm but kick on the "Hilbert >transformer" mode (which designs a linear-phase filter with a 90 degree >offset) for Type 3 (odd length, odd symmetry) or Type 4 (even length, >odd symmetry) FIRs. > >pick the same length (even or odd) design both filters and just add >their FIR coefficients. > >-- > >r b-j rbj@audioimagination.com > >"Imagination is more important than knowledge." > >
However, the original post is about complex filter. Above trick implies real filter I think. I have done digital pre-correction for amplitude and phase of RF channel distortion. The task is no easy (the full package of work took 3 months). For coeff generation I tried both cremez(named cfirpm now) but then moved to a Least Squares Method using pseudoinverse matrix computation, as it was slightly better and resulted in smaller dynamic range coeffs. cremez accepts amp/phase (or groupdelay) as inputs while LMS method I used accepted I/Q. The key points were: 1) apply correction to your signal band only. set distortion to null outside your band. 2)remove any linear gradient from phase(or integer time delay from groupdelay) so that you remove the burden of correcting for pure delay. Admittedly, both algorithms (cremez and LMS) worked within narrow range of distortion and were unpredictable if distortion was a bit high. Kadhiem