Is there a way to compute efficiently
where x and y are complex vectors ?
My goal is to reconstruct the signal y, but I can only do it up to a complex number of modulus 1, and so this quantity would be the reconstruction error.
I have looked a bit on the internet and found nothing, the best I can think about is to take random complex numbers of modulus 1 and take the minimum among these values.
Are x and y just complex numbers, or are they whole vectors of values? This answer assumes that they are vectors of values with multiple complex components.
Does this work? Check it against your random trials. (Working at the bottom).
import numpy as np
import math
def minimiseNorm( x, y ):
a, b = np.real( x ), np.imag( x )
p, q = np.real( y ), np.imag( y )
S1 = np.sum( a * p + b * q )
S2 = np.sum( a * q - b * p )
A = math.sqrt( S1 ** 2 + S2 ** 2 )
phi = math.atan2( S2, S1 )
minNorm = math.sqrt( np.sum( a * a + b * b + p * p + q * q ) - 2 * A )
c = math.cos( phi ) + 1j * math.sin( phi )
return minNorm, c
x = np.array( [ 1+2j, 3+ 4j, 5+ 6j ] )
y = np.array( [ 7+8j, 9+10j, 11+12j ] )
N, c = minimiseNorm( x, y )
print( "Minimum norm is", N, " occurring at c=", c )
Somebody had better check my algebra.