next up previous contents
Next: The Fast Fourier Transform Up: Implementation: The Complex_POLY_CELL Class: Previous: Integration:

The Inner Product:

First, we need the conjugation method as the complex inner product is


< P, Q > = $\displaystyle \int_{a}^{b}$ P(tQ*(tdt  

where Q* denotes the polynomial whose coefficients are the complex conjugates of the coefficients of Q.

    // ***************************************** //
    //             Conjugation Function          //
    // ***************************************** //
Complex_POLY& Complex_POLY::conjugate()
{
  for(ComplexPOLYIter next(*this); next;++next)
    next()->element = next()->element.conjugate();
  return(*this);
}

    // ********************************************** //
    //              Inner Product                     //
    // ********************************************** //
Complex Complex_POLY::inner_product(Complex a,
                                    Complex b,
                                    Complex_POLY& P)
{
  Complex value;
  if(P.head==NULL && head!=NULL){
    //the incoming polynomial is degenerate
    value = 0;
    return(value);
    }
  if(P.head!=NULL && head==NULL){
    //this is NULL
    value = 0;
    return(value);
    } 
  if(P.head==NULL && head==NULL){
    //both are NULL
    value = 0;
    return(value);
    }   
  if(P.head!=NULL && head!=NULL){
    //both are non NULL
    Complex_POLY R = P*(*this);
    value = R.definite_integral(a,b);
    return(value);
    }
}



Jim Peterson
1999-04-22