Jpp  18.3.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
KM3::TOALIB Namespace Reference

Functions

void vectorMultiply (complex_type *_vectorSrcA, complex_type *_vectorSrcB, complex_type *_vectorDest, size_t _length)
 

Function Documentation

void KM3::TOALIB::vectorMultiply ( complex_type *  _vectorSrcA,
complex_type *  _vectorSrcB,
complex_type *  _vectorDest,
size_t  _length 
)

Definition at line 13 of file km3_toa_utils.cc.

14 {
15 
16  // TODO: there is space for optimization
17  // for instance: how do we manage denormals?
18  // do we use SSE/2?
19  // so: search for a ready-to-use lib and use it
20 
21  /*
22  * given two complex numbers: a = a_real + j*a_imag, b = b_real + j*b_imag
23  * the product c = a*b can be calculated as:
24  * c = (d1-d2) + j*(d1+d3)
25  * with:
26  * d1 = a_real*(b_real+b_imag)
27  * d2 = b_imag*(a_real+b_real)
28  * d3 = b_real*(a_imag-a_real)
29  *
30  * see: http://www.embedded.com/design/real-time-and-performance/4007256/Digital-Signal-Processing-Tricks--Fast-multiplication-of-complex-numbers
31  */
32 
33  real_type a_real, b_real, a_imag, b_imag;
34  real_type k1, k2, k3;
35  for(unsigned int k = 0; k < _length; k++) {
36  a_real = _vectorSrcA[k][0];
37  a_imag = _vectorSrcA[k][1];
38  b_real = _vectorSrcB[k][0];
39  b_imag = _vectorSrcB[k][1];
40 
41  k1 = a_real*(b_real+b_imag);
42  k2 = b_imag*(a_real+a_imag);
43  k3 = b_real*(a_imag-a_real);
44 
45  _vectorDest[k][0] = k1-k2;
46  _vectorDest[k][1] = k1+k3;
47  }
48 
49 }
then fatal No hydrophone data file $HYDROPHONE_TXT fi sort gr k