# Copyright (c) 2019, Christoph Peters
# All rights reserved.
# 
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#     * Redistributions of source code must retain the above copyright
#       notice, this list of conditions and the following disclaimer.
#     * Redistributions in binary form must reproduce the above copyright
#       notice, this list of conditions and the following disclaimer in the
#       documentation and/or other materials provided with the distribution.
#     * Neither the name of the Karlsruhe Institute of Technology nor the
#       names of its contributors may be used to endorse or promote products
#       derived from this software without specific prior written permission.
# 
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.



def trigonometricToExponentialMomentsReal3(pOutExponentialMoment,pTrigonometricMoment):
    zerothMomentPhase=3.1415926535897931*pTrigonometricMoment[0]-1.5707963267948966;
    pOutExponentialMoment[0]=np.exp(1.0j*zerothMomentPhase);
    pOutExponentialMoment[0]=0.079577471545947673*pOutExponentialMoment[0];
    pOutExponentialMoment[1]=pTrigonometricMoment[1]*6.2831853071795862j*pOutExponentialMoment[0];
    pOutExponentialMoment[2]=pTrigonometricMoment[2]*6.2831853071795862j*pOutExponentialMoment[0]+pTrigonometricMoment[1]*3.1415926535897931j*pOutExponentialMoment[1];
    pOutExponentialMoment[0]=2.0*pOutExponentialMoment[0];

def trigonometricToExponentialMomentsReal4(pOutExponentialMoment,pTrigonometricMoment):
    zerothMomentPhase=3.1415926535897931*pTrigonometricMoment[0]-1.5707963267948966;
    pOutExponentialMoment[0]=np.exp(1.0j*zerothMomentPhase);
    pOutExponentialMoment[0]=0.079577471545947673*pOutExponentialMoment[0];
    pOutExponentialMoment[1]=pTrigonometricMoment[1]*6.2831853071795862j*pOutExponentialMoment[0];
    pOutExponentialMoment[2]=pTrigonometricMoment[2]*6.2831853071795862j*pOutExponentialMoment[0]+pTrigonometricMoment[1]*3.1415926535897931j*pOutExponentialMoment[1];
    pOutExponentialMoment[3]=pTrigonometricMoment[3]*6.2831853071795862j*pOutExponentialMoment[0]+pTrigonometricMoment[2]*4.1887902047863905j*pOutExponentialMoment[1]+pTrigonometricMoment[1]*2.0943951023931953j*pOutExponentialMoment[2];
    pOutExponentialMoment[0]=2.0*pOutExponentialMoment[0];

def trigonometricToExponentialMomentsReal5(pOutExponentialMoment,pTrigonometricMoment):
    zerothMomentPhase=3.1415926535897931*pTrigonometricMoment[0]-1.5707963267948966;
    pOutExponentialMoment[0]=np.exp(1.0j*zerothMomentPhase);
    pOutExponentialMoment[0]=0.079577471545947673*pOutExponentialMoment[0];
    pOutExponentialMoment[1]=pTrigonometricMoment[1]*6.2831853071795862j*pOutExponentialMoment[0];
    pOutExponentialMoment[2]=pTrigonometricMoment[2]*6.2831853071795862j*pOutExponentialMoment[0]+pTrigonometricMoment[1]*3.1415926535897931j*pOutExponentialMoment[1];
    pOutExponentialMoment[3]=pTrigonometricMoment[3]*6.2831853071795862j*pOutExponentialMoment[0]+pTrigonometricMoment[2]*4.1887902047863905j*pOutExponentialMoment[1]+pTrigonometricMoment[1]*2.0943951023931953j*pOutExponentialMoment[2];
    pOutExponentialMoment[4]=pTrigonometricMoment[4]*6.2831853071795862j*pOutExponentialMoment[0]+pTrigonometricMoment[3]*4.7123889803846897j*pOutExponentialMoment[1]+pTrigonometricMoment[2]*3.1415926535897931j*pOutExponentialMoment[2]+pTrigonometricMoment[1]*1.5707963267948966j*pOutExponentialMoment[3];
    pOutExponentialMoment[0]=2.0*pOutExponentialMoment[0];

def trigonometricToExponentialMomentsReal6(pOutExponentialMoment,pTrigonometricMoment):
    zerothMomentPhase=3.1415926535897931*pTrigonometricMoment[0]-1.5707963267948966;
    pOutExponentialMoment[0]=np.exp(1.0j*zerothMomentPhase);
    pOutExponentialMoment[0]=0.079577471545947673*pOutExponentialMoment[0];
    pOutExponentialMoment[1]=pTrigonometricMoment[1]*6.2831853071795862j*pOutExponentialMoment[0];
    pOutExponentialMoment[2]=pTrigonometricMoment[2]*6.2831853071795862j*pOutExponentialMoment[0]+pTrigonometricMoment[1]*3.1415926535897931j*pOutExponentialMoment[1];
    pOutExponentialMoment[3]=pTrigonometricMoment[3]*6.2831853071795862j*pOutExponentialMoment[0]+pTrigonometricMoment[2]*4.1887902047863905j*pOutExponentialMoment[1]+pTrigonometricMoment[1]*2.0943951023931953j*pOutExponentialMoment[2];
    pOutExponentialMoment[4]=pTrigonometricMoment[4]*6.2831853071795862j*pOutExponentialMoment[0]+pTrigonometricMoment[3]*4.7123889803846897j*pOutExponentialMoment[1]+pTrigonometricMoment[2]*3.1415926535897931j*pOutExponentialMoment[2]+pTrigonometricMoment[1]*1.5707963267948966j*pOutExponentialMoment[3];
    pOutExponentialMoment[5]=pTrigonometricMoment[5]*6.2831853071795862j*pOutExponentialMoment[0]+pTrigonometricMoment[4]*5.026548245743669j*pOutExponentialMoment[1]+pTrigonometricMoment[3]*3.7699111843077517j*pOutExponentialMoment[2]+pTrigonometricMoment[2]*2.5132741228718345j*pOutExponentialMoment[3]+pTrigonometricMoment[1]*1.2566370614359172j*pOutExponentialMoment[4];
    pOutExponentialMoment[0]=2.0*pOutExponentialMoment[0];

def trigonometricToExponentialMomentsReal7(pOutExponentialMoment,pTrigonometricMoment):
    zerothMomentPhase=3.1415926535897931*pTrigonometricMoment[0]-1.5707963267948966;
    pOutExponentialMoment[0]=np.exp(1.0j*zerothMomentPhase);
    pOutExponentialMoment[0]=0.079577471545947673*pOutExponentialMoment[0];
    pOutExponentialMoment[1]=pTrigonometricMoment[1]*6.2831853071795862j*pOutExponentialMoment[0];
    pOutExponentialMoment[2]=pTrigonometricMoment[2]*6.2831853071795862j*pOutExponentialMoment[0]+pTrigonometricMoment[1]*3.1415926535897931j*pOutExponentialMoment[1];
    pOutExponentialMoment[3]=pTrigonometricMoment[3]*6.2831853071795862j*pOutExponentialMoment[0]+pTrigonometricMoment[2]*4.1887902047863905j*pOutExponentialMoment[1]+pTrigonometricMoment[1]*2.0943951023931953j*pOutExponentialMoment[2];
    pOutExponentialMoment[4]=pTrigonometricMoment[4]*6.2831853071795862j*pOutExponentialMoment[0]+pTrigonometricMoment[3]*4.7123889803846897j*pOutExponentialMoment[1]+pTrigonometricMoment[2]*3.1415926535897931j*pOutExponentialMoment[2]+pTrigonometricMoment[1]*1.5707963267948966j*pOutExponentialMoment[3];
    pOutExponentialMoment[5]=pTrigonometricMoment[5]*6.2831853071795862j*pOutExponentialMoment[0]+pTrigonometricMoment[4]*5.026548245743669j*pOutExponentialMoment[1]+pTrigonometricMoment[3]*3.7699111843077517j*pOutExponentialMoment[2]+pTrigonometricMoment[2]*2.5132741228718345j*pOutExponentialMoment[3]+pTrigonometricMoment[1]*1.2566370614359172j*pOutExponentialMoment[4];
    pOutExponentialMoment[6]=pTrigonometricMoment[6]*6.2831853071795862j*pOutExponentialMoment[0]+pTrigonometricMoment[5]*5.2359877559829888j*pOutExponentialMoment[1]+pTrigonometricMoment[4]*4.1887902047863905j*pOutExponentialMoment[2]+pTrigonometricMoment[3]*3.1415926535897931j*pOutExponentialMoment[3]+pTrigonometricMoment[2]*2.0943951023931953j*pOutExponentialMoment[4]+pTrigonometricMoment[1]*1.0471975511965976j*pOutExponentialMoment[5];
    pOutExponentialMoment[0]=2.0*pOutExponentialMoment[0];

def trigonometricToExponentialMomentsReal8(pOutExponentialMoment,pTrigonometricMoment):
    zerothMomentPhase=3.1415926535897931*pTrigonometricMoment[0]-1.5707963267948966;
    pOutExponentialMoment[0]=np.exp(1.0j*zerothMomentPhase);
    pOutExponentialMoment[0]=0.079577471545947673*pOutExponentialMoment[0];
    pOutExponentialMoment[1]=pTrigonometricMoment[1]*6.2831853071795862j*pOutExponentialMoment[0];
    pOutExponentialMoment[2]=pTrigonometricMoment[2]*6.2831853071795862j*pOutExponentialMoment[0]+pTrigonometricMoment[1]*3.1415926535897931j*pOutExponentialMoment[1];
    pOutExponentialMoment[3]=pTrigonometricMoment[3]*6.2831853071795862j*pOutExponentialMoment[0]+pTrigonometricMoment[2]*4.1887902047863905j*pOutExponentialMoment[1]+pTrigonometricMoment[1]*2.0943951023931953j*pOutExponentialMoment[2];
    pOutExponentialMoment[4]=pTrigonometricMoment[4]*6.2831853071795862j*pOutExponentialMoment[0]+pTrigonometricMoment[3]*4.7123889803846897j*pOutExponentialMoment[1]+pTrigonometricMoment[2]*3.1415926535897931j*pOutExponentialMoment[2]+pTrigonometricMoment[1]*1.5707963267948966j*pOutExponentialMoment[3];
    pOutExponentialMoment[5]=pTrigonometricMoment[5]*6.2831853071795862j*pOutExponentialMoment[0]+pTrigonometricMoment[4]*5.026548245743669j*pOutExponentialMoment[1]+pTrigonometricMoment[3]*3.7699111843077517j*pOutExponentialMoment[2]+pTrigonometricMoment[2]*2.5132741228718345j*pOutExponentialMoment[3]+pTrigonometricMoment[1]*1.2566370614359172j*pOutExponentialMoment[4];
    pOutExponentialMoment[6]=pTrigonometricMoment[6]*6.2831853071795862j*pOutExponentialMoment[0]+pTrigonometricMoment[5]*5.2359877559829888j*pOutExponentialMoment[1]+pTrigonometricMoment[4]*4.1887902047863905j*pOutExponentialMoment[2]+pTrigonometricMoment[3]*3.1415926535897931j*pOutExponentialMoment[3]+pTrigonometricMoment[2]*2.0943951023931953j*pOutExponentialMoment[4]+pTrigonometricMoment[1]*1.0471975511965976j*pOutExponentialMoment[5];
    pOutExponentialMoment[7]=pTrigonometricMoment[7]*6.2831853071795862j*pOutExponentialMoment[0]+pTrigonometricMoment[6]*5.3855874061539311j*pOutExponentialMoment[1]+pTrigonometricMoment[5]*4.4879895051282759j*pOutExponentialMoment[2]+pTrigonometricMoment[4]*3.5903916041026207j*pOutExponentialMoment[3]+pTrigonometricMoment[3]*2.6927937030769655j*pOutExponentialMoment[4]+pTrigonometricMoment[2]*1.7951958020513104j*pOutExponentialMoment[5]+pTrigonometricMoment[1]*0.89759790102565518j*pOutExponentialMoment[6];
    pOutExponentialMoment[0]=2.0*pOutExponentialMoment[0];

def trigonometricToExponentialMomentsReal9(pOutExponentialMoment,pTrigonometricMoment):
    zerothMomentPhase=3.1415926535897931*pTrigonometricMoment[0]-1.5707963267948966;
    pOutExponentialMoment[0]=np.exp(1.0j*zerothMomentPhase);
    pOutExponentialMoment[0]=0.079577471545947673*pOutExponentialMoment[0];
    pOutExponentialMoment[1]=pTrigonometricMoment[1]*6.2831853071795862j*pOutExponentialMoment[0];
    pOutExponentialMoment[2]=pTrigonometricMoment[2]*6.2831853071795862j*pOutExponentialMoment[0]+pTrigonometricMoment[1]*3.1415926535897931j*pOutExponentialMoment[1];
    pOutExponentialMoment[3]=pTrigonometricMoment[3]*6.2831853071795862j*pOutExponentialMoment[0]+pTrigonometricMoment[2]*4.1887902047863905j*pOutExponentialMoment[1]+pTrigonometricMoment[1]*2.0943951023931953j*pOutExponentialMoment[2];
    pOutExponentialMoment[4]=pTrigonometricMoment[4]*6.2831853071795862j*pOutExponentialMoment[0]+pTrigonometricMoment[3]*4.7123889803846897j*pOutExponentialMoment[1]+pTrigonometricMoment[2]*3.1415926535897931j*pOutExponentialMoment[2]+pTrigonometricMoment[1]*1.5707963267948966j*pOutExponentialMoment[3];
    pOutExponentialMoment[5]=pTrigonometricMoment[5]*6.2831853071795862j*pOutExponentialMoment[0]+pTrigonometricMoment[4]*5.026548245743669j*pOutExponentialMoment[1]+pTrigonometricMoment[3]*3.7699111843077517j*pOutExponentialMoment[2]+pTrigonometricMoment[2]*2.5132741228718345j*pOutExponentialMoment[3]+pTrigonometricMoment[1]*1.2566370614359172j*pOutExponentialMoment[4];
    pOutExponentialMoment[6]=pTrigonometricMoment[6]*6.2831853071795862j*pOutExponentialMoment[0]+pTrigonometricMoment[5]*5.2359877559829888j*pOutExponentialMoment[1]+pTrigonometricMoment[4]*4.1887902047863905j*pOutExponentialMoment[2]+pTrigonometricMoment[3]*3.1415926535897931j*pOutExponentialMoment[3]+pTrigonometricMoment[2]*2.0943951023931953j*pOutExponentialMoment[4]+pTrigonometricMoment[1]*1.0471975511965976j*pOutExponentialMoment[5];
    pOutExponentialMoment[7]=pTrigonometricMoment[7]*6.2831853071795862j*pOutExponentialMoment[0]+pTrigonometricMoment[6]*5.3855874061539311j*pOutExponentialMoment[1]+pTrigonometricMoment[5]*4.4879895051282759j*pOutExponentialMoment[2]+pTrigonometricMoment[4]*3.5903916041026207j*pOutExponentialMoment[3]+pTrigonometricMoment[3]*2.6927937030769655j*pOutExponentialMoment[4]+pTrigonometricMoment[2]*1.7951958020513104j*pOutExponentialMoment[5]+pTrigonometricMoment[1]*0.89759790102565518j*pOutExponentialMoment[6];
    pOutExponentialMoment[8]=pTrigonometricMoment[8]*6.2831853071795862j*pOutExponentialMoment[0]+pTrigonometricMoment[7]*5.497787143782138j*pOutExponentialMoment[1]+pTrigonometricMoment[6]*4.7123889803846897j*pOutExponentialMoment[2]+pTrigonometricMoment[5]*3.9269908169872414j*pOutExponentialMoment[3]+pTrigonometricMoment[4]*3.1415926535897931j*pOutExponentialMoment[4]+pTrigonometricMoment[3]*2.3561944901923448j*pOutExponentialMoment[5]+pTrigonometricMoment[2]*1.5707963267948966j*pOutExponentialMoment[6]+pTrigonometricMoment[1]*0.78539816339744828j*pOutExponentialMoment[7];
    pOutExponentialMoment[0]=2.0*pOutExponentialMoment[0];

def trigonometricToExponentialMoments2(pOutExponentialMoment,pTrigonometricMoment):
    zerothMomentPhase=3.1415926535897931*pTrigonometricMoment[0].real-1.5707963267948966;
    pOutExponentialMoment[0]=np.exp(1.0j*zerothMomentPhase);
    pOutExponentialMoment[0]=0.079577471545947673*pOutExponentialMoment[0];
    pOutExponentialMoment[1]=6.2831853071795862j*pOutExponentialMoment[0]*pTrigonometricMoment[1];
    pOutExponentialMoment[0]=2.0*pOutExponentialMoment[0];

def trigonometricToExponentialMoments3(pOutExponentialMoment,pTrigonometricMoment):
    zerothMomentPhase=3.1415926535897931*pTrigonometricMoment[0].real-1.5707963267948966;
    pOutExponentialMoment[0]=np.exp(1.0j*zerothMomentPhase);
    pOutExponentialMoment[0]=0.079577471545947673*pOutExponentialMoment[0];
    pOutExponentialMoment[1]=6.2831853071795862j*pOutExponentialMoment[0]*pTrigonometricMoment[1];
    pOutExponentialMoment[2]=6.2831853071795862j*pOutExponentialMoment[0]*pTrigonometricMoment[2]+3.1415926535897931j*pOutExponentialMoment[1]*pTrigonometricMoment[1];
    pOutExponentialMoment[0]=2.0*pOutExponentialMoment[0];

def trigonometricToExponentialMoments4(pOutExponentialMoment,pTrigonometricMoment):
    zerothMomentPhase=3.1415926535897931*pTrigonometricMoment[0].real-1.5707963267948966;
    pOutExponentialMoment[0]=np.exp(1.0j*zerothMomentPhase);
    pOutExponentialMoment[0]=0.079577471545947673*pOutExponentialMoment[0];
    pOutExponentialMoment[1]=6.2831853071795862j*pOutExponentialMoment[0]*pTrigonometricMoment[1];
    pOutExponentialMoment[2]=6.2831853071795862j*pOutExponentialMoment[0]*pTrigonometricMoment[2]+3.1415926535897931j*pOutExponentialMoment[1]*pTrigonometricMoment[1];
    pOutExponentialMoment[3]=6.2831853071795862j*pOutExponentialMoment[0]*pTrigonometricMoment[3]+4.1887902047863905j*pOutExponentialMoment[1]*pTrigonometricMoment[2]+2.0943951023931953j*pOutExponentialMoment[2]*pTrigonometricMoment[1];
    pOutExponentialMoment[0]=2.0*pOutExponentialMoment[0];

def trigonometricToExponentialMoments5(pOutExponentialMoment,pTrigonometricMoment):
    zerothMomentPhase=3.1415926535897931*pTrigonometricMoment[0].real-1.5707963267948966;
    pOutExponentialMoment[0]=np.exp(1.0j*zerothMomentPhase);
    pOutExponentialMoment[0]=0.079577471545947673*pOutExponentialMoment[0];
    pOutExponentialMoment[1]=6.2831853071795862j*pOutExponentialMoment[0]*pTrigonometricMoment[1];
    pOutExponentialMoment[2]=6.2831853071795862j*pOutExponentialMoment[0]*pTrigonometricMoment[2]+3.1415926535897931j*pOutExponentialMoment[1]*pTrigonometricMoment[1];
    pOutExponentialMoment[3]=6.2831853071795862j*pOutExponentialMoment[0]*pTrigonometricMoment[3]+4.1887902047863905j*pOutExponentialMoment[1]*pTrigonometricMoment[2]+2.0943951023931953j*pOutExponentialMoment[2]*pTrigonometricMoment[1];
    pOutExponentialMoment[4]=6.2831853071795862j*pOutExponentialMoment[0]*pTrigonometricMoment[4]+4.7123889803846897j*pOutExponentialMoment[1]*pTrigonometricMoment[3]+3.1415926535897931j*pOutExponentialMoment[2]*pTrigonometricMoment[2]+1.5707963267948966j*pOutExponentialMoment[3]*pTrigonometricMoment[1];
    pOutExponentialMoment[0]=2.0*pOutExponentialMoment[0];


def levinsonsAlgorithm2(pOutSolution,pFirstColumn):
    pOutSolution[0]=1.0/(pFirstColumn[0].real);
    dotProduct=pOutSolution[0].real*pFirstColumn[1];
    factor=1.0/(1.0-np.abs(dotProduct)**2);
    flippedSolution1=pOutSolution[0].real;
    pOutSolution[0]=factor*pOutSolution[0].real;
    pOutSolution[1]=factor*(-flippedSolution1.real*dotProduct);

def levinsonsAlgorithm3(pOutSolution,pFirstColumn):
    pOutSolution[0]=1.0/(pFirstColumn[0].real);
    dotProduct=pOutSolution[0].real*pFirstColumn[1];
    factor=1.0/(1.0-np.abs(dotProduct)**2);
    flippedSolution1=pOutSolution[0].real;
    pOutSolution[0]=factor*pOutSolution[0].real;
    pOutSolution[1]=factor*(-flippedSolution1.real*dotProduct);
    dotProduct=pOutSolution[0].real*pFirstColumn[2]+pOutSolution[1]*pFirstColumn[1];
    factor=1.0/(1.0-np.abs(dotProduct)**2);
    flippedSolution1=np.conj(pOutSolution[1]);
    flippedSolution2=pOutSolution[0].real;
    pOutSolution[0]=factor*pOutSolution[0].real;
    pOutSolution[1]=factor*(pOutSolution[1]-flippedSolution1*dotProduct);
    pOutSolution[2]=factor*(-flippedSolution2.real*dotProduct);

def levinsonsAlgorithm4(pOutSolution,pFirstColumn):
    pOutSolution[0]=1.0/(pFirstColumn[0].real);
    dotProduct=pOutSolution[0].real*pFirstColumn[1];
    factor=1.0/(1.0-np.abs(dotProduct)**2);
    flippedSolution1=pOutSolution[0].real;
    pOutSolution[0]=factor*pOutSolution[0].real;
    pOutSolution[1]=factor*(-flippedSolution1.real*dotProduct);
    dotProduct=pOutSolution[0].real*pFirstColumn[2]+pOutSolution[1]*pFirstColumn[1];
    factor=1.0/(1.0-np.abs(dotProduct)**2);
    flippedSolution1=np.conj(pOutSolution[1]);
    flippedSolution2=pOutSolution[0].real;
    pOutSolution[0]=factor*pOutSolution[0].real;
    pOutSolution[1]=factor*(pOutSolution[1]-flippedSolution1*dotProduct);
    pOutSolution[2]=factor*(-flippedSolution2.real*dotProduct);
    dotProduct=pOutSolution[0].real*pFirstColumn[3]+pOutSolution[1]*pFirstColumn[2]+pOutSolution[2]*pFirstColumn[1];
    factor=1.0/(1.0-np.abs(dotProduct)**2);
    flippedSolution1=np.conj(pOutSolution[2]);
    flippedSolution2=np.conj(pOutSolution[1]);
    flippedSolution3=pOutSolution[0].real;
    pOutSolution[0]=factor*pOutSolution[0].real;
    pOutSolution[1]=factor*(pOutSolution[1]-flippedSolution1*dotProduct);
    pOutSolution[2]=factor*(pOutSolution[2]-flippedSolution2*dotProduct);
    pOutSolution[3]=factor*(-flippedSolution3.real*dotProduct);

def levinsonsAlgorithm5(pOutSolution,pFirstColumn):
    pOutSolution[0]=1.0/(pFirstColumn[0].real);
    dotProduct=pOutSolution[0].real*pFirstColumn[1];
    factor=1.0/(1.0-np.abs(dotProduct)**2);
    flippedSolution1=pOutSolution[0].real;
    pOutSolution[0]=factor*pOutSolution[0].real;
    pOutSolution[1]=factor*(-flippedSolution1.real*dotProduct);
    dotProduct=pOutSolution[0].real*pFirstColumn[2]+pOutSolution[1]*pFirstColumn[1];
    factor=1.0/(1.0-np.abs(dotProduct)**2);
    flippedSolution1=np.conj(pOutSolution[1]);
    flippedSolution2=pOutSolution[0].real;
    pOutSolution[0]=factor*pOutSolution[0].real;
    pOutSolution[1]=factor*(pOutSolution[1]-flippedSolution1*dotProduct);
    pOutSolution[2]=factor*(-flippedSolution2.real*dotProduct);
    dotProduct=pOutSolution[0].real*pFirstColumn[3]+pOutSolution[1]*pFirstColumn[2]+pOutSolution[2]*pFirstColumn[1];
    factor=1.0/(1.0-np.abs(dotProduct)**2);
    flippedSolution1=np.conj(pOutSolution[2]);
    flippedSolution2=np.conj(pOutSolution[1]);
    flippedSolution3=pOutSolution[0].real;
    pOutSolution[0]=factor*pOutSolution[0].real;
    pOutSolution[1]=factor*(pOutSolution[1]-flippedSolution1*dotProduct);
    pOutSolution[2]=factor*(pOutSolution[2]-flippedSolution2*dotProduct);
    pOutSolution[3]=factor*(-flippedSolution3.real*dotProduct);
    dotProduct=pOutSolution[0].real*pFirstColumn[4]+pOutSolution[1]*pFirstColumn[3]+pOutSolution[2]*pFirstColumn[2]+pOutSolution[3]*pFirstColumn[1];
    factor=1.0/(1.0-np.abs(dotProduct)**2);
    flippedSolution1=np.conj(pOutSolution[3]);
    flippedSolution2=np.conj(pOutSolution[2]);
    flippedSolution3=np.conj(pOutSolution[1]);
    flippedSolution4=pOutSolution[0].real;
    pOutSolution[0]=factor*pOutSolution[0].real;
    pOutSolution[1]=factor*(pOutSolution[1]-flippedSolution1*dotProduct);
    pOutSolution[2]=factor*(pOutSolution[2]-flippedSolution2*dotProduct);
    pOutSolution[3]=factor*(pOutSolution[3]-flippedSolution3*dotProduct);
    pOutSolution[4]=factor*(-flippedSolution4.real*dotProduct);

def levinsonsAlgorithm6(pOutSolution,pFirstColumn):
    pOutSolution[0]=1.0/(pFirstColumn[0].real);
    dotProduct=pOutSolution[0].real*pFirstColumn[1];
    factor=1.0/(1.0-np.abs(dotProduct)**2);
    flippedSolution1=pOutSolution[0].real;
    pOutSolution[0]=factor*pOutSolution[0].real;
    pOutSolution[1]=factor*(-flippedSolution1.real*dotProduct);
    dotProduct=pOutSolution[0].real*pFirstColumn[2]+pOutSolution[1]*pFirstColumn[1];
    factor=1.0/(1.0-np.abs(dotProduct)**2);
    flippedSolution1=np.conj(pOutSolution[1]);
    flippedSolution2=pOutSolution[0].real;
    pOutSolution[0]=factor*pOutSolution[0].real;
    pOutSolution[1]=factor*(pOutSolution[1]-flippedSolution1*dotProduct);
    pOutSolution[2]=factor*(-flippedSolution2.real*dotProduct);
    dotProduct=pOutSolution[0].real*pFirstColumn[3]+pOutSolution[1]*pFirstColumn[2]+pOutSolution[2]*pFirstColumn[1];
    factor=1.0/(1.0-np.abs(dotProduct)**2);
    flippedSolution1=np.conj(pOutSolution[2]);
    flippedSolution2=np.conj(pOutSolution[1]);
    flippedSolution3=pOutSolution[0].real;
    pOutSolution[0]=factor*pOutSolution[0].real;
    pOutSolution[1]=factor*(pOutSolution[1]-flippedSolution1*dotProduct);
    pOutSolution[2]=factor*(pOutSolution[2]-flippedSolution2*dotProduct);
    pOutSolution[3]=factor*(-flippedSolution3.real*dotProduct);
    dotProduct=pOutSolution[0].real*pFirstColumn[4]+pOutSolution[1]*pFirstColumn[3]+pOutSolution[2]*pFirstColumn[2]+pOutSolution[3]*pFirstColumn[1];
    factor=1.0/(1.0-np.abs(dotProduct)**2);
    flippedSolution1=np.conj(pOutSolution[3]);
    flippedSolution2=np.conj(pOutSolution[2]);
    flippedSolution3=np.conj(pOutSolution[1]);
    flippedSolution4=pOutSolution[0].real;
    pOutSolution[0]=factor*pOutSolution[0].real;
    pOutSolution[1]=factor*(pOutSolution[1]-flippedSolution1*dotProduct);
    pOutSolution[2]=factor*(pOutSolution[2]-flippedSolution2*dotProduct);
    pOutSolution[3]=factor*(pOutSolution[3]-flippedSolution3*dotProduct);
    pOutSolution[4]=factor*(-flippedSolution4.real*dotProduct);
    dotProduct=pOutSolution[0].real*pFirstColumn[5]+pOutSolution[1]*pFirstColumn[4]+pOutSolution[2]*pFirstColumn[3]+pOutSolution[3]*pFirstColumn[2]+pOutSolution[4]*pFirstColumn[1];
    factor=1.0/(1.0-np.abs(dotProduct)**2);
    flippedSolution1=np.conj(pOutSolution[4]);
    flippedSolution2=np.conj(pOutSolution[3]);
    flippedSolution3=np.conj(pOutSolution[2]);
    flippedSolution4=np.conj(pOutSolution[1]);
    flippedSolution5=pOutSolution[0].real;
    pOutSolution[0]=factor*pOutSolution[0].real;
    pOutSolution[1]=factor*(pOutSolution[1]-flippedSolution1*dotProduct);
    pOutSolution[2]=factor*(pOutSolution[2]-flippedSolution2*dotProduct);
    pOutSolution[3]=factor*(pOutSolution[3]-flippedSolution3*dotProduct);
    pOutSolution[4]=factor*(pOutSolution[4]-flippedSolution4*dotProduct);
    pOutSolution[5]=factor*(-flippedSolution5.real*dotProduct);

def levinsonsAlgorithm7(pOutSolution,pFirstColumn):
    pOutSolution[0]=1.0/(pFirstColumn[0].real);
    dotProduct=pOutSolution[0].real*pFirstColumn[1];
    factor=1.0/(1.0-np.abs(dotProduct)**2);
    flippedSolution1=pOutSolution[0].real;
    pOutSolution[0]=factor*pOutSolution[0].real;
    pOutSolution[1]=factor*(-flippedSolution1.real*dotProduct);
    dotProduct=pOutSolution[0].real*pFirstColumn[2]+pOutSolution[1]*pFirstColumn[1];
    factor=1.0/(1.0-np.abs(dotProduct)**2);
    flippedSolution1=np.conj(pOutSolution[1]);
    flippedSolution2=pOutSolution[0].real;
    pOutSolution[0]=factor*pOutSolution[0].real;
    pOutSolution[1]=factor*(pOutSolution[1]-flippedSolution1*dotProduct);
    pOutSolution[2]=factor*(-flippedSolution2.real*dotProduct);
    dotProduct=pOutSolution[0].real*pFirstColumn[3]+pOutSolution[1]*pFirstColumn[2]+pOutSolution[2]*pFirstColumn[1];
    factor=1.0/(1.0-np.abs(dotProduct)**2);
    flippedSolution1=np.conj(pOutSolution[2]);
    flippedSolution2=np.conj(pOutSolution[1]);
    flippedSolution3=pOutSolution[0].real;
    pOutSolution[0]=factor*pOutSolution[0].real;
    pOutSolution[1]=factor*(pOutSolution[1]-flippedSolution1*dotProduct);
    pOutSolution[2]=factor*(pOutSolution[2]-flippedSolution2*dotProduct);
    pOutSolution[3]=factor*(-flippedSolution3.real*dotProduct);
    dotProduct=pOutSolution[0].real*pFirstColumn[4]+pOutSolution[1]*pFirstColumn[3]+pOutSolution[2]*pFirstColumn[2]+pOutSolution[3]*pFirstColumn[1];
    factor=1.0/(1.0-np.abs(dotProduct)**2);
    flippedSolution1=np.conj(pOutSolution[3]);
    flippedSolution2=np.conj(pOutSolution[2]);
    flippedSolution3=np.conj(pOutSolution[1]);
    flippedSolution4=pOutSolution[0].real;
    pOutSolution[0]=factor*pOutSolution[0].real;
    pOutSolution[1]=factor*(pOutSolution[1]-flippedSolution1*dotProduct);
    pOutSolution[2]=factor*(pOutSolution[2]-flippedSolution2*dotProduct);
    pOutSolution[3]=factor*(pOutSolution[3]-flippedSolution3*dotProduct);
    pOutSolution[4]=factor*(-flippedSolution4.real*dotProduct);
    dotProduct=pOutSolution[0].real*pFirstColumn[5]+pOutSolution[1]*pFirstColumn[4]+pOutSolution[2]*pFirstColumn[3]+pOutSolution[3]*pFirstColumn[2]+pOutSolution[4]*pFirstColumn[1];
    factor=1.0/(1.0-np.abs(dotProduct)**2);
    flippedSolution1=np.conj(pOutSolution[4]);
    flippedSolution2=np.conj(pOutSolution[3]);
    flippedSolution3=np.conj(pOutSolution[2]);
    flippedSolution4=np.conj(pOutSolution[1]);
    flippedSolution5=pOutSolution[0].real;
    pOutSolution[0]=factor*pOutSolution[0].real;
    pOutSolution[1]=factor*(pOutSolution[1]-flippedSolution1*dotProduct);
    pOutSolution[2]=factor*(pOutSolution[2]-flippedSolution2*dotProduct);
    pOutSolution[3]=factor*(pOutSolution[3]-flippedSolution3*dotProduct);
    pOutSolution[4]=factor*(pOutSolution[4]-flippedSolution4*dotProduct);
    pOutSolution[5]=factor*(-flippedSolution5.real*dotProduct);
    dotProduct=pOutSolution[0].real*pFirstColumn[6]+pOutSolution[1]*pFirstColumn[5]+pOutSolution[2]*pFirstColumn[4]+pOutSolution[3]*pFirstColumn[3]+pOutSolution[4]*pFirstColumn[2]+pOutSolution[5]*pFirstColumn[1];
    factor=1.0/(1.0-np.abs(dotProduct)**2);
    flippedSolution1=np.conj(pOutSolution[5]);
    flippedSolution2=np.conj(pOutSolution[4]);
    flippedSolution3=np.conj(pOutSolution[3]);
    flippedSolution4=np.conj(pOutSolution[2]);
    flippedSolution5=np.conj(pOutSolution[1]);
    flippedSolution6=pOutSolution[0].real;
    pOutSolution[0]=factor*pOutSolution[0].real;
    pOutSolution[1]=factor*(pOutSolution[1]-flippedSolution1*dotProduct);
    pOutSolution[2]=factor*(pOutSolution[2]-flippedSolution2*dotProduct);
    pOutSolution[3]=factor*(pOutSolution[3]-flippedSolution3*dotProduct);
    pOutSolution[4]=factor*(pOutSolution[4]-flippedSolution4*dotProduct);
    pOutSolution[5]=factor*(pOutSolution[5]-flippedSolution5*dotProduct);
    pOutSolution[6]=factor*(-flippedSolution6.real*dotProduct);

def levinsonsAlgorithm8(pOutSolution,pFirstColumn):
    pOutSolution[0]=1.0/(pFirstColumn[0].real);
    dotProduct=pOutSolution[0].real*pFirstColumn[1];
    factor=1.0/(1.0-np.abs(dotProduct)**2);
    flippedSolution1=pOutSolution[0].real;
    pOutSolution[0]=factor*pOutSolution[0].real;
    pOutSolution[1]=factor*(-flippedSolution1.real*dotProduct);
    dotProduct=pOutSolution[0].real*pFirstColumn[2]+pOutSolution[1]*pFirstColumn[1];
    factor=1.0/(1.0-np.abs(dotProduct)**2);
    flippedSolution1=np.conj(pOutSolution[1]);
    flippedSolution2=pOutSolution[0].real;
    pOutSolution[0]=factor*pOutSolution[0].real;
    pOutSolution[1]=factor*(pOutSolution[1]-flippedSolution1*dotProduct);
    pOutSolution[2]=factor*(-flippedSolution2.real*dotProduct);
    dotProduct=pOutSolution[0].real*pFirstColumn[3]+pOutSolution[1]*pFirstColumn[2]+pOutSolution[2]*pFirstColumn[1];
    factor=1.0/(1.0-np.abs(dotProduct)**2);
    flippedSolution1=np.conj(pOutSolution[2]);
    flippedSolution2=np.conj(pOutSolution[1]);
    flippedSolution3=pOutSolution[0].real;
    pOutSolution[0]=factor*pOutSolution[0].real;
    pOutSolution[1]=factor*(pOutSolution[1]-flippedSolution1*dotProduct);
    pOutSolution[2]=factor*(pOutSolution[2]-flippedSolution2*dotProduct);
    pOutSolution[3]=factor*(-flippedSolution3.real*dotProduct);
    dotProduct=pOutSolution[0].real*pFirstColumn[4]+pOutSolution[1]*pFirstColumn[3]+pOutSolution[2]*pFirstColumn[2]+pOutSolution[3]*pFirstColumn[1];
    factor=1.0/(1.0-np.abs(dotProduct)**2);
    flippedSolution1=np.conj(pOutSolution[3]);
    flippedSolution2=np.conj(pOutSolution[2]);
    flippedSolution3=np.conj(pOutSolution[1]);
    flippedSolution4=pOutSolution[0].real;
    pOutSolution[0]=factor*pOutSolution[0].real;
    pOutSolution[1]=factor*(pOutSolution[1]-flippedSolution1*dotProduct);
    pOutSolution[2]=factor*(pOutSolution[2]-flippedSolution2*dotProduct);
    pOutSolution[3]=factor*(pOutSolution[3]-flippedSolution3*dotProduct);
    pOutSolution[4]=factor*(-flippedSolution4.real*dotProduct);
    dotProduct=pOutSolution[0].real*pFirstColumn[5]+pOutSolution[1]*pFirstColumn[4]+pOutSolution[2]*pFirstColumn[3]+pOutSolution[3]*pFirstColumn[2]+pOutSolution[4]*pFirstColumn[1];
    factor=1.0/(1.0-np.abs(dotProduct)**2);
    flippedSolution1=np.conj(pOutSolution[4]);
    flippedSolution2=np.conj(pOutSolution[3]);
    flippedSolution3=np.conj(pOutSolution[2]);
    flippedSolution4=np.conj(pOutSolution[1]);
    flippedSolution5=pOutSolution[0].real;
    pOutSolution[0]=factor*pOutSolution[0].real;
    pOutSolution[1]=factor*(pOutSolution[1]-flippedSolution1*dotProduct);
    pOutSolution[2]=factor*(pOutSolution[2]-flippedSolution2*dotProduct);
    pOutSolution[3]=factor*(pOutSolution[3]-flippedSolution3*dotProduct);
    pOutSolution[4]=factor*(pOutSolution[4]-flippedSolution4*dotProduct);
    pOutSolution[5]=factor*(-flippedSolution5.real*dotProduct);
    dotProduct=pOutSolution[0].real*pFirstColumn[6]+pOutSolution[1]*pFirstColumn[5]+pOutSolution[2]*pFirstColumn[4]+pOutSolution[3]*pFirstColumn[3]+pOutSolution[4]*pFirstColumn[2]+pOutSolution[5]*pFirstColumn[1];
    factor=1.0/(1.0-np.abs(dotProduct)**2);
    flippedSolution1=np.conj(pOutSolution[5]);
    flippedSolution2=np.conj(pOutSolution[4]);
    flippedSolution3=np.conj(pOutSolution[3]);
    flippedSolution4=np.conj(pOutSolution[2]);
    flippedSolution5=np.conj(pOutSolution[1]);
    flippedSolution6=pOutSolution[0].real;
    pOutSolution[0]=factor*pOutSolution[0].real;
    pOutSolution[1]=factor*(pOutSolution[1]-flippedSolution1*dotProduct);
    pOutSolution[2]=factor*(pOutSolution[2]-flippedSolution2*dotProduct);
    pOutSolution[3]=factor*(pOutSolution[3]-flippedSolution3*dotProduct);
    pOutSolution[4]=factor*(pOutSolution[4]-flippedSolution4*dotProduct);
    pOutSolution[5]=factor*(pOutSolution[5]-flippedSolution5*dotProduct);
    pOutSolution[6]=factor*(-flippedSolution6.real*dotProduct);
    dotProduct=pOutSolution[0].real*pFirstColumn[7]+pOutSolution[1]*pFirstColumn[6]+pOutSolution[2]*pFirstColumn[5]+pOutSolution[3]*pFirstColumn[4]+pOutSolution[4]*pFirstColumn[3]+pOutSolution[5]*pFirstColumn[2]+pOutSolution[6]*pFirstColumn[1];
    factor=1.0/(1.0-np.abs(dotProduct)**2);
    flippedSolution1=np.conj(pOutSolution[6]);
    flippedSolution2=np.conj(pOutSolution[5]);
    flippedSolution3=np.conj(pOutSolution[4]);
    flippedSolution4=np.conj(pOutSolution[3]);
    flippedSolution5=np.conj(pOutSolution[2]);
    flippedSolution6=np.conj(pOutSolution[1]);
    flippedSolution7=pOutSolution[0].real;
    pOutSolution[0]=factor*pOutSolution[0].real;
    pOutSolution[1]=factor*(pOutSolution[1]-flippedSolution1*dotProduct);
    pOutSolution[2]=factor*(pOutSolution[2]-flippedSolution2*dotProduct);
    pOutSolution[3]=factor*(pOutSolution[3]-flippedSolution3*dotProduct);
    pOutSolution[4]=factor*(pOutSolution[4]-flippedSolution4*dotProduct);
    pOutSolution[5]=factor*(pOutSolution[5]-flippedSolution5*dotProduct);
    pOutSolution[6]=factor*(pOutSolution[6]-flippedSolution6*dotProduct);
    pOutSolution[7]=factor*(-flippedSolution7.real*dotProduct);

def levinsonsAlgorithm9(pOutSolution,pFirstColumn):
    pOutSolution[0]=1.0/(pFirstColumn[0].real);
    dotProduct=pOutSolution[0].real*pFirstColumn[1];
    factor=1.0/(1.0-np.abs(dotProduct)**2);
    flippedSolution1=pOutSolution[0].real;
    pOutSolution[0]=factor*pOutSolution[0].real;
    pOutSolution[1]=factor*(-flippedSolution1.real*dotProduct);
    dotProduct=pOutSolution[0].real*pFirstColumn[2]+pOutSolution[1]*pFirstColumn[1];
    factor=1.0/(1.0-np.abs(dotProduct)**2);
    flippedSolution1=np.conj(pOutSolution[1]);
    flippedSolution2=pOutSolution[0].real;
    pOutSolution[0]=factor*pOutSolution[0].real;
    pOutSolution[1]=factor*(pOutSolution[1]-flippedSolution1*dotProduct);
    pOutSolution[2]=factor*(-flippedSolution2.real*dotProduct);
    dotProduct=pOutSolution[0].real*pFirstColumn[3]+pOutSolution[1]*pFirstColumn[2]+pOutSolution[2]*pFirstColumn[1];
    factor=1.0/(1.0-np.abs(dotProduct)**2);
    flippedSolution1=np.conj(pOutSolution[2]);
    flippedSolution2=np.conj(pOutSolution[1]);
    flippedSolution3=pOutSolution[0].real;
    pOutSolution[0]=factor*pOutSolution[0].real;
    pOutSolution[1]=factor*(pOutSolution[1]-flippedSolution1*dotProduct);
    pOutSolution[2]=factor*(pOutSolution[2]-flippedSolution2*dotProduct);
    pOutSolution[3]=factor*(-flippedSolution3.real*dotProduct);
    dotProduct=pOutSolution[0].real*pFirstColumn[4]+pOutSolution[1]*pFirstColumn[3]+pOutSolution[2]*pFirstColumn[2]+pOutSolution[3]*pFirstColumn[1];
    factor=1.0/(1.0-np.abs(dotProduct)**2);
    flippedSolution1=np.conj(pOutSolution[3]);
    flippedSolution2=np.conj(pOutSolution[2]);
    flippedSolution3=np.conj(pOutSolution[1]);
    flippedSolution4=pOutSolution[0].real;
    pOutSolution[0]=factor*pOutSolution[0].real;
    pOutSolution[1]=factor*(pOutSolution[1]-flippedSolution1*dotProduct);
    pOutSolution[2]=factor*(pOutSolution[2]-flippedSolution2*dotProduct);
    pOutSolution[3]=factor*(pOutSolution[3]-flippedSolution3*dotProduct);
    pOutSolution[4]=factor*(-flippedSolution4.real*dotProduct);
    dotProduct=pOutSolution[0].real*pFirstColumn[5]+pOutSolution[1]*pFirstColumn[4]+pOutSolution[2]*pFirstColumn[3]+pOutSolution[3]*pFirstColumn[2]+pOutSolution[4]*pFirstColumn[1];
    factor=1.0/(1.0-np.abs(dotProduct)**2);
    flippedSolution1=np.conj(pOutSolution[4]);
    flippedSolution2=np.conj(pOutSolution[3]);
    flippedSolution3=np.conj(pOutSolution[2]);
    flippedSolution4=np.conj(pOutSolution[1]);
    flippedSolution5=pOutSolution[0].real;
    pOutSolution[0]=factor*pOutSolution[0].real;
    pOutSolution[1]=factor*(pOutSolution[1]-flippedSolution1*dotProduct);
    pOutSolution[2]=factor*(pOutSolution[2]-flippedSolution2*dotProduct);
    pOutSolution[3]=factor*(pOutSolution[3]-flippedSolution3*dotProduct);
    pOutSolution[4]=factor*(pOutSolution[4]-flippedSolution4*dotProduct);
    pOutSolution[5]=factor*(-flippedSolution5.real*dotProduct);
    dotProduct=pOutSolution[0].real*pFirstColumn[6]+pOutSolution[1]*pFirstColumn[5]+pOutSolution[2]*pFirstColumn[4]+pOutSolution[3]*pFirstColumn[3]+pOutSolution[4]*pFirstColumn[2]+pOutSolution[5]*pFirstColumn[1];
    factor=1.0/(1.0-np.abs(dotProduct)**2);
    flippedSolution1=np.conj(pOutSolution[5]);
    flippedSolution2=np.conj(pOutSolution[4]);
    flippedSolution3=np.conj(pOutSolution[3]);
    flippedSolution4=np.conj(pOutSolution[2]);
    flippedSolution5=np.conj(pOutSolution[1]);
    flippedSolution6=pOutSolution[0].real;
    pOutSolution[0]=factor*pOutSolution[0].real;
    pOutSolution[1]=factor*(pOutSolution[1]-flippedSolution1*dotProduct);
    pOutSolution[2]=factor*(pOutSolution[2]-flippedSolution2*dotProduct);
    pOutSolution[3]=factor*(pOutSolution[3]-flippedSolution3*dotProduct);
    pOutSolution[4]=factor*(pOutSolution[4]-flippedSolution4*dotProduct);
    pOutSolution[5]=factor*(pOutSolution[5]-flippedSolution5*dotProduct);
    pOutSolution[6]=factor*(-flippedSolution6.real*dotProduct);
    dotProduct=pOutSolution[0].real*pFirstColumn[7]+pOutSolution[1]*pFirstColumn[6]+pOutSolution[2]*pFirstColumn[5]+pOutSolution[3]*pFirstColumn[4]+pOutSolution[4]*pFirstColumn[3]+pOutSolution[5]*pFirstColumn[2]+pOutSolution[6]*pFirstColumn[1];
    factor=1.0/(1.0-np.abs(dotProduct)**2);
    flippedSolution1=np.conj(pOutSolution[6]);
    flippedSolution2=np.conj(pOutSolution[5]);
    flippedSolution3=np.conj(pOutSolution[4]);
    flippedSolution4=np.conj(pOutSolution[3]);
    flippedSolution5=np.conj(pOutSolution[2]);
    flippedSolution6=np.conj(pOutSolution[1]);
    flippedSolution7=pOutSolution[0].real;
    pOutSolution[0]=factor*pOutSolution[0].real;
    pOutSolution[1]=factor*(pOutSolution[1]-flippedSolution1*dotProduct);
    pOutSolution[2]=factor*(pOutSolution[2]-flippedSolution2*dotProduct);
    pOutSolution[3]=factor*(pOutSolution[3]-flippedSolution3*dotProduct);
    pOutSolution[4]=factor*(pOutSolution[4]-flippedSolution4*dotProduct);
    pOutSolution[5]=factor*(pOutSolution[5]-flippedSolution5*dotProduct);
    pOutSolution[6]=factor*(pOutSolution[6]-flippedSolution6*dotProduct);
    pOutSolution[7]=factor*(-flippedSolution7.real*dotProduct);
    dotProduct=pOutSolution[0].real*pFirstColumn[8]+pOutSolution[1]*pFirstColumn[7]+pOutSolution[2]*pFirstColumn[6]+pOutSolution[3]*pFirstColumn[5]+pOutSolution[4]*pFirstColumn[4]+pOutSolution[5]*pFirstColumn[3]+pOutSolution[6]*pFirstColumn[2]+pOutSolution[7]*pFirstColumn[1];
    factor=1.0/(1.0-np.abs(dotProduct)**2);
    flippedSolution1=np.conj(pOutSolution[7]);
    flippedSolution2=np.conj(pOutSolution[6]);
    flippedSolution3=np.conj(pOutSolution[5]);
    flippedSolution4=np.conj(pOutSolution[4]);
    flippedSolution5=np.conj(pOutSolution[3]);
    flippedSolution6=np.conj(pOutSolution[2]);
    flippedSolution7=np.conj(pOutSolution[1]);
    flippedSolution8=pOutSolution[0].real;
    pOutSolution[0]=factor*pOutSolution[0].real;
    pOutSolution[1]=factor*(pOutSolution[1]-flippedSolution1*dotProduct);
    pOutSolution[2]=factor*(pOutSolution[2]-flippedSolution2*dotProduct);
    pOutSolution[3]=factor*(pOutSolution[3]-flippedSolution3*dotProduct);
    pOutSolution[4]=factor*(pOutSolution[4]-flippedSolution4*dotProduct);
    pOutSolution[5]=factor*(pOutSolution[5]-flippedSolution5*dotProduct);
    pOutSolution[6]=factor*(pOutSolution[6]-flippedSolution6*dotProduct);
    pOutSolution[7]=factor*(pOutSolution[7]-flippedSolution7*dotProduct);
    pOutSolution[8]=factor*(-flippedSolution8.real*dotProduct);


def computeAutocorrelation2(pOutAutocorrelation,pSignal):
    pOutAutocorrelation[0]=pSignal[0]*np.conj(pSignal[0])+pSignal[1]*np.conj(pSignal[1]);
    pOutAutocorrelation[1]=pSignal[0]*np.conj(pSignal[1]);

def computeAutocorrelation3(pOutAutocorrelation,pSignal):
    pOutAutocorrelation[0]=pSignal[0]*np.conj(pSignal[0])+pSignal[1]*np.conj(pSignal[1])+pSignal[2]*np.conj(pSignal[2]);
    pOutAutocorrelation[1]=pSignal[0]*np.conj(pSignal[1])+pSignal[1]*np.conj(pSignal[2]);
    pOutAutocorrelation[2]=pSignal[0]*np.conj(pSignal[2]);

def computeAutocorrelation4(pOutAutocorrelation,pSignal):
    pOutAutocorrelation[0]=pSignal[0]*np.conj(pSignal[0])+pSignal[1]*np.conj(pSignal[1])+pSignal[2]*np.conj(pSignal[2])+pSignal[3]*np.conj(pSignal[3]);
    pOutAutocorrelation[1]=pSignal[0]*np.conj(pSignal[1])+pSignal[1]*np.conj(pSignal[2])+pSignal[2]*np.conj(pSignal[3]);
    pOutAutocorrelation[2]=pSignal[0]*np.conj(pSignal[2])+pSignal[1]*np.conj(pSignal[3]);
    pOutAutocorrelation[3]=pSignal[0]*np.conj(pSignal[3]);

def computeAutocorrelation5(pOutAutocorrelation,pSignal):
    pOutAutocorrelation[0]=pSignal[0]*np.conj(pSignal[0])+pSignal[1]*np.conj(pSignal[1])+pSignal[2]*np.conj(pSignal[2])+pSignal[3]*np.conj(pSignal[3])+pSignal[4]*np.conj(pSignal[4]);
    pOutAutocorrelation[1]=pSignal[0]*np.conj(pSignal[1])+pSignal[1]*np.conj(pSignal[2])+pSignal[2]*np.conj(pSignal[3])+pSignal[3]*np.conj(pSignal[4]);
    pOutAutocorrelation[2]=pSignal[0]*np.conj(pSignal[2])+pSignal[1]*np.conj(pSignal[3])+pSignal[2]*np.conj(pSignal[4]);
    pOutAutocorrelation[3]=pSignal[0]*np.conj(pSignal[3])+pSignal[1]*np.conj(pSignal[4]);
    pOutAutocorrelation[4]=pSignal[0]*np.conj(pSignal[4]);

def computeAutocorrelation6(pOutAutocorrelation,pSignal):
    pOutAutocorrelation[0]=pSignal[0]*np.conj(pSignal[0])+pSignal[1]*np.conj(pSignal[1])+pSignal[2]*np.conj(pSignal[2])+pSignal[3]*np.conj(pSignal[3])+pSignal[4]*np.conj(pSignal[4])+pSignal[5]*np.conj(pSignal[5]);
    pOutAutocorrelation[1]=pSignal[0]*np.conj(pSignal[1])+pSignal[1]*np.conj(pSignal[2])+pSignal[2]*np.conj(pSignal[3])+pSignal[3]*np.conj(pSignal[4])+pSignal[4]*np.conj(pSignal[5]);
    pOutAutocorrelation[2]=pSignal[0]*np.conj(pSignal[2])+pSignal[1]*np.conj(pSignal[3])+pSignal[2]*np.conj(pSignal[4])+pSignal[3]*np.conj(pSignal[5]);
    pOutAutocorrelation[3]=pSignal[0]*np.conj(pSignal[3])+pSignal[1]*np.conj(pSignal[4])+pSignal[2]*np.conj(pSignal[5]);
    pOutAutocorrelation[4]=pSignal[0]*np.conj(pSignal[4])+pSignal[1]*np.conj(pSignal[5]);
    pOutAutocorrelation[5]=pSignal[0]*np.conj(pSignal[5]);

def computeAutocorrelation7(pOutAutocorrelation,pSignal):
    pOutAutocorrelation[0]=pSignal[0]*np.conj(pSignal[0])+pSignal[1]*np.conj(pSignal[1])+pSignal[2]*np.conj(pSignal[2])+pSignal[3]*np.conj(pSignal[3])+pSignal[4]*np.conj(pSignal[4])+pSignal[5]*np.conj(pSignal[5])+pSignal[6]*np.conj(pSignal[6]);
    pOutAutocorrelation[1]=pSignal[0]*np.conj(pSignal[1])+pSignal[1]*np.conj(pSignal[2])+pSignal[2]*np.conj(pSignal[3])+pSignal[3]*np.conj(pSignal[4])+pSignal[4]*np.conj(pSignal[5])+pSignal[5]*np.conj(pSignal[6]);
    pOutAutocorrelation[2]=pSignal[0]*np.conj(pSignal[2])+pSignal[1]*np.conj(pSignal[3])+pSignal[2]*np.conj(pSignal[4])+pSignal[3]*np.conj(pSignal[5])+pSignal[4]*np.conj(pSignal[6]);
    pOutAutocorrelation[3]=pSignal[0]*np.conj(pSignal[3])+pSignal[1]*np.conj(pSignal[4])+pSignal[2]*np.conj(pSignal[5])+pSignal[3]*np.conj(pSignal[6]);
    pOutAutocorrelation[4]=pSignal[0]*np.conj(pSignal[4])+pSignal[1]*np.conj(pSignal[5])+pSignal[2]*np.conj(pSignal[6]);
    pOutAutocorrelation[5]=pSignal[0]*np.conj(pSignal[5])+pSignal[1]*np.conj(pSignal[6]);
    pOutAutocorrelation[6]=pSignal[0]*np.conj(pSignal[6]);

def computeAutocorrelation8(pOutAutocorrelation,pSignal):
    pOutAutocorrelation[0]=pSignal[0]*np.conj(pSignal[0])+pSignal[1]*np.conj(pSignal[1])+pSignal[2]*np.conj(pSignal[2])+pSignal[3]*np.conj(pSignal[3])+pSignal[4]*np.conj(pSignal[4])+pSignal[5]*np.conj(pSignal[5])+pSignal[6]*np.conj(pSignal[6])+pSignal[7]*np.conj(pSignal[7]);
    pOutAutocorrelation[1]=pSignal[0]*np.conj(pSignal[1])+pSignal[1]*np.conj(pSignal[2])+pSignal[2]*np.conj(pSignal[3])+pSignal[3]*np.conj(pSignal[4])+pSignal[4]*np.conj(pSignal[5])+pSignal[5]*np.conj(pSignal[6])+pSignal[6]*np.conj(pSignal[7]);
    pOutAutocorrelation[2]=pSignal[0]*np.conj(pSignal[2])+pSignal[1]*np.conj(pSignal[3])+pSignal[2]*np.conj(pSignal[4])+pSignal[3]*np.conj(pSignal[5])+pSignal[4]*np.conj(pSignal[6])+pSignal[5]*np.conj(pSignal[7]);
    pOutAutocorrelation[3]=pSignal[0]*np.conj(pSignal[3])+pSignal[1]*np.conj(pSignal[4])+pSignal[2]*np.conj(pSignal[5])+pSignal[3]*np.conj(pSignal[6])+pSignal[4]*np.conj(pSignal[7]);
    pOutAutocorrelation[4]=pSignal[0]*np.conj(pSignal[4])+pSignal[1]*np.conj(pSignal[5])+pSignal[2]*np.conj(pSignal[6])+pSignal[3]*np.conj(pSignal[7]);
    pOutAutocorrelation[5]=pSignal[0]*np.conj(pSignal[5])+pSignal[1]*np.conj(pSignal[6])+pSignal[2]*np.conj(pSignal[7]);
    pOutAutocorrelation[6]=pSignal[0]*np.conj(pSignal[6])+pSignal[1]*np.conj(pSignal[7]);
    pOutAutocorrelation[7]=pSignal[0]*np.conj(pSignal[7]);

def computeAutocorrelation9(pOutAutocorrelation,pSignal):
    pOutAutocorrelation[0]=pSignal[0]*np.conj(pSignal[0])+pSignal[1]*np.conj(pSignal[1])+pSignal[2]*np.conj(pSignal[2])+pSignal[3]*np.conj(pSignal[3])+pSignal[4]*np.conj(pSignal[4])+pSignal[5]*np.conj(pSignal[5])+pSignal[6]*np.conj(pSignal[6])+pSignal[7]*np.conj(pSignal[7])+pSignal[8]*np.conj(pSignal[8]);
    pOutAutocorrelation[1]=pSignal[0]*np.conj(pSignal[1])+pSignal[1]*np.conj(pSignal[2])+pSignal[2]*np.conj(pSignal[3])+pSignal[3]*np.conj(pSignal[4])+pSignal[4]*np.conj(pSignal[5])+pSignal[5]*np.conj(pSignal[6])+pSignal[6]*np.conj(pSignal[7])+pSignal[7]*np.conj(pSignal[8]);
    pOutAutocorrelation[2]=pSignal[0]*np.conj(pSignal[2])+pSignal[1]*np.conj(pSignal[3])+pSignal[2]*np.conj(pSignal[4])+pSignal[3]*np.conj(pSignal[5])+pSignal[4]*np.conj(pSignal[6])+pSignal[5]*np.conj(pSignal[7])+pSignal[6]*np.conj(pSignal[8]);
    pOutAutocorrelation[3]=pSignal[0]*np.conj(pSignal[3])+pSignal[1]*np.conj(pSignal[4])+pSignal[2]*np.conj(pSignal[5])+pSignal[3]*np.conj(pSignal[6])+pSignal[4]*np.conj(pSignal[7])+pSignal[5]*np.conj(pSignal[8]);
    pOutAutocorrelation[4]=pSignal[0]*np.conj(pSignal[4])+pSignal[1]*np.conj(pSignal[5])+pSignal[2]*np.conj(pSignal[6])+pSignal[3]*np.conj(pSignal[7])+pSignal[4]*np.conj(pSignal[8]);
    pOutAutocorrelation[5]=pSignal[0]*np.conj(pSignal[5])+pSignal[1]*np.conj(pSignal[6])+pSignal[2]*np.conj(pSignal[7])+pSignal[3]*np.conj(pSignal[8]);
    pOutAutocorrelation[6]=pSignal[0]*np.conj(pSignal[6])+pSignal[1]*np.conj(pSignal[7])+pSignal[2]*np.conj(pSignal[8]);
    pOutAutocorrelation[7]=pSignal[0]*np.conj(pSignal[7])+pSignal[1]*np.conj(pSignal[8]);
    pOutAutocorrelation[8]=pSignal[0]*np.conj(pSignal[8]);


def computeCorrelation2(pOutCorrelation,pLHS,pRHS):
    pOutCorrelation[0]=pLHS[0]*pRHS[0]+pLHS[1]*pRHS[1];
    pOutCorrelation[1]=pLHS[1]*pRHS[0];

def computeCorrelation3(pOutCorrelation,pLHS,pRHS):
    pOutCorrelation[0]=pLHS[0]*pRHS[0]+pLHS[1]*pRHS[1]+pLHS[2]*pRHS[2];
    pOutCorrelation[1]=pLHS[1]*pRHS[0]+pLHS[2]*pRHS[1];
    pOutCorrelation[2]=pLHS[2]*pRHS[0];

def computeCorrelation4(pOutCorrelation,pLHS,pRHS):
    pOutCorrelation[0]=pLHS[0]*pRHS[0]+pLHS[1]*pRHS[1]+pLHS[2]*pRHS[2]+pLHS[3]*pRHS[3];
    pOutCorrelation[1]=pLHS[1]*pRHS[0]+pLHS[2]*pRHS[1]+pLHS[3]*pRHS[2];
    pOutCorrelation[2]=pLHS[2]*pRHS[0]+pLHS[3]*pRHS[1];
    pOutCorrelation[3]=pLHS[3]*pRHS[0];

def computeCorrelation5(pOutCorrelation,pLHS,pRHS):
    pOutCorrelation[0]=pLHS[0]*pRHS[0]+pLHS[1]*pRHS[1]+pLHS[2]*pRHS[2]+pLHS[3]*pRHS[3]+pLHS[4]*pRHS[4];
    pOutCorrelation[1]=pLHS[1]*pRHS[0]+pLHS[2]*pRHS[1]+pLHS[3]*pRHS[2]+pLHS[4]*pRHS[3];
    pOutCorrelation[2]=pLHS[2]*pRHS[0]+pLHS[3]*pRHS[1]+pLHS[4]*pRHS[2];
    pOutCorrelation[3]=pLHS[3]*pRHS[0]+pLHS[4]*pRHS[1];
    pOutCorrelation[4]=pLHS[4]*pRHS[0];


def computeImaginaryCorrelation3(pOutCorrelation,pLHS,pRHS):
    pOutCorrelation[0]=pLHS[0].real*pRHS[0].imag+pLHS[0].imag*pRHS[0].real+pLHS[1].real*pRHS[1].imag+pLHS[1].imag*pRHS[1].real+pLHS[2].real*pRHS[2].imag+pLHS[2].imag*pRHS[2].real;
    pOutCorrelation[1]=pLHS[1].real*pRHS[0].imag+pLHS[1].imag*pRHS[0].real+pLHS[2].real*pRHS[1].imag+pLHS[2].imag*pRHS[1].real;
    pOutCorrelation[2]=pLHS[2].real*pRHS[0].imag+pLHS[2].imag*pRHS[0].real;

def computeImaginaryCorrelation4(pOutCorrelation,pLHS,pRHS):
    pOutCorrelation[0]=pLHS[0].real*pRHS[0].imag+pLHS[0].imag*pRHS[0].real+pLHS[1].real*pRHS[1].imag+pLHS[1].imag*pRHS[1].real+pLHS[2].real*pRHS[2].imag+pLHS[2].imag*pRHS[2].real+pLHS[3].real*pRHS[3].imag+pLHS[3].imag*pRHS[3].real;
    pOutCorrelation[1]=pLHS[1].real*pRHS[0].imag+pLHS[1].imag*pRHS[0].real+pLHS[2].real*pRHS[1].imag+pLHS[2].imag*pRHS[1].real+pLHS[3].real*pRHS[2].imag+pLHS[3].imag*pRHS[2].real;
    pOutCorrelation[2]=pLHS[2].real*pRHS[0].imag+pLHS[2].imag*pRHS[0].real+pLHS[3].real*pRHS[1].imag+pLHS[3].imag*pRHS[1].real;
    pOutCorrelation[3]=pLHS[3].real*pRHS[0].imag+pLHS[3].imag*pRHS[0].real;

def computeImaginaryCorrelation5(pOutCorrelation,pLHS,pRHS):
    pOutCorrelation[0]=pLHS[0].real*pRHS[0].imag+pLHS[0].imag*pRHS[0].real+pLHS[1].real*pRHS[1].imag+pLHS[1].imag*pRHS[1].real+pLHS[2].real*pRHS[2].imag+pLHS[2].imag*pRHS[2].real+pLHS[3].real*pRHS[3].imag+pLHS[3].imag*pRHS[3].real+pLHS[4].real*pRHS[4].imag+pLHS[4].imag*pRHS[4].real;
    pOutCorrelation[1]=pLHS[1].real*pRHS[0].imag+pLHS[1].imag*pRHS[0].real+pLHS[2].real*pRHS[1].imag+pLHS[2].imag*pRHS[1].real+pLHS[3].real*pRHS[2].imag+pLHS[3].imag*pRHS[2].real+pLHS[4].real*pRHS[3].imag+pLHS[4].imag*pRHS[3].real;
    pOutCorrelation[2]=pLHS[2].real*pRHS[0].imag+pLHS[2].imag*pRHS[0].real+pLHS[3].real*pRHS[1].imag+pLHS[3].imag*pRHS[1].real+pLHS[4].real*pRHS[2].imag+pLHS[4].imag*pRHS[2].real;
    pOutCorrelation[3]=pLHS[3].real*pRHS[0].imag+pLHS[3].imag*pRHS[0].real+pLHS[4].real*pRHS[1].imag+pLHS[4].imag*pRHS[1].real;
    pOutCorrelation[4]=pLHS[4].real*pRHS[0].imag+pLHS[4].imag*pRHS[0].real;

def computeImaginaryCorrelation6(pOutCorrelation,pLHS,pRHS):
    pOutCorrelation[0]=pLHS[0].real*pRHS[0].imag+pLHS[0].imag*pRHS[0].real+pLHS[1].real*pRHS[1].imag+pLHS[1].imag*pRHS[1].real+pLHS[2].real*pRHS[2].imag+pLHS[2].imag*pRHS[2].real+pLHS[3].real*pRHS[3].imag+pLHS[3].imag*pRHS[3].real+pLHS[4].real*pRHS[4].imag+pLHS[4].imag*pRHS[4].real+pLHS[5].real*pRHS[5].imag+pLHS[5].imag*pRHS[5].real;
    pOutCorrelation[1]=pLHS[1].real*pRHS[0].imag+pLHS[1].imag*pRHS[0].real+pLHS[2].real*pRHS[1].imag+pLHS[2].imag*pRHS[1].real+pLHS[3].real*pRHS[2].imag+pLHS[3].imag*pRHS[2].real+pLHS[4].real*pRHS[3].imag+pLHS[4].imag*pRHS[3].real+pLHS[5].real*pRHS[4].imag+pLHS[5].imag*pRHS[4].real;
    pOutCorrelation[2]=pLHS[2].real*pRHS[0].imag+pLHS[2].imag*pRHS[0].real+pLHS[3].real*pRHS[1].imag+pLHS[3].imag*pRHS[1].real+pLHS[4].real*pRHS[2].imag+pLHS[4].imag*pRHS[2].real+pLHS[5].real*pRHS[3].imag+pLHS[5].imag*pRHS[3].real;
    pOutCorrelation[3]=pLHS[3].real*pRHS[0].imag+pLHS[3].imag*pRHS[0].real+pLHS[4].real*pRHS[1].imag+pLHS[4].imag*pRHS[1].real+pLHS[5].real*pRHS[2].imag+pLHS[5].imag*pRHS[2].real;
    pOutCorrelation[4]=pLHS[4].real*pRHS[0].imag+pLHS[4].imag*pRHS[0].real+pLHS[5].real*pRHS[1].imag+pLHS[5].imag*pRHS[1].real;
    pOutCorrelation[5]=pLHS[5].real*pRHS[0].imag+pLHS[5].imag*pRHS[0].real;

def computeImaginaryCorrelation7(pOutCorrelation,pLHS,pRHS):
    pOutCorrelation[0]=pLHS[0].real*pRHS[0].imag+pLHS[0].imag*pRHS[0].real+pLHS[1].real*pRHS[1].imag+pLHS[1].imag*pRHS[1].real+pLHS[2].real*pRHS[2].imag+pLHS[2].imag*pRHS[2].real+pLHS[3].real*pRHS[3].imag+pLHS[3].imag*pRHS[3].real+pLHS[4].real*pRHS[4].imag+pLHS[4].imag*pRHS[4].real+pLHS[5].real*pRHS[5].imag+pLHS[5].imag*pRHS[5].real+pLHS[6].real*pRHS[6].imag+pLHS[6].imag*pRHS[6].real;
    pOutCorrelation[1]=pLHS[1].real*pRHS[0].imag+pLHS[1].imag*pRHS[0].real+pLHS[2].real*pRHS[1].imag+pLHS[2].imag*pRHS[1].real+pLHS[3].real*pRHS[2].imag+pLHS[3].imag*pRHS[2].real+pLHS[4].real*pRHS[3].imag+pLHS[4].imag*pRHS[3].real+pLHS[5].real*pRHS[4].imag+pLHS[5].imag*pRHS[4].real+pLHS[6].real*pRHS[5].imag+pLHS[6].imag*pRHS[5].real;
    pOutCorrelation[2]=pLHS[2].real*pRHS[0].imag+pLHS[2].imag*pRHS[0].real+pLHS[3].real*pRHS[1].imag+pLHS[3].imag*pRHS[1].real+pLHS[4].real*pRHS[2].imag+pLHS[4].imag*pRHS[2].real+pLHS[5].real*pRHS[3].imag+pLHS[5].imag*pRHS[3].real+pLHS[6].real*pRHS[4].imag+pLHS[6].imag*pRHS[4].real;
    pOutCorrelation[3]=pLHS[3].real*pRHS[0].imag+pLHS[3].imag*pRHS[0].real+pLHS[4].real*pRHS[1].imag+pLHS[4].imag*pRHS[1].real+pLHS[5].real*pRHS[2].imag+pLHS[5].imag*pRHS[2].real+pLHS[6].real*pRHS[3].imag+pLHS[6].imag*pRHS[3].real;
    pOutCorrelation[4]=pLHS[4].real*pRHS[0].imag+pLHS[4].imag*pRHS[0].real+pLHS[5].real*pRHS[1].imag+pLHS[5].imag*pRHS[1].real+pLHS[6].real*pRHS[2].imag+pLHS[6].imag*pRHS[2].real;
    pOutCorrelation[5]=pLHS[5].real*pRHS[0].imag+pLHS[5].imag*pRHS[0].real+pLHS[6].real*pRHS[1].imag+pLHS[6].imag*pRHS[1].real;
    pOutCorrelation[6]=pLHS[6].real*pRHS[0].imag+pLHS[6].imag*pRHS[0].real;

def computeImaginaryCorrelation8(pOutCorrelation,pLHS,pRHS):
    pOutCorrelation[0]=pLHS[0].real*pRHS[0].imag+pLHS[0].imag*pRHS[0].real+pLHS[1].real*pRHS[1].imag+pLHS[1].imag*pRHS[1].real+pLHS[2].real*pRHS[2].imag+pLHS[2].imag*pRHS[2].real+pLHS[3].real*pRHS[3].imag+pLHS[3].imag*pRHS[3].real+pLHS[4].real*pRHS[4].imag+pLHS[4].imag*pRHS[4].real+pLHS[5].real*pRHS[5].imag+pLHS[5].imag*pRHS[5].real+pLHS[6].real*pRHS[6].imag+pLHS[6].imag*pRHS[6].real+pLHS[7].real*pRHS[7].imag+pLHS[7].imag*pRHS[7].real;
    pOutCorrelation[1]=pLHS[1].real*pRHS[0].imag+pLHS[1].imag*pRHS[0].real+pLHS[2].real*pRHS[1].imag+pLHS[2].imag*pRHS[1].real+pLHS[3].real*pRHS[2].imag+pLHS[3].imag*pRHS[2].real+pLHS[4].real*pRHS[3].imag+pLHS[4].imag*pRHS[3].real+pLHS[5].real*pRHS[4].imag+pLHS[5].imag*pRHS[4].real+pLHS[6].real*pRHS[5].imag+pLHS[6].imag*pRHS[5].real+pLHS[7].real*pRHS[6].imag+pLHS[7].imag*pRHS[6].real;
    pOutCorrelation[2]=pLHS[2].real*pRHS[0].imag+pLHS[2].imag*pRHS[0].real+pLHS[3].real*pRHS[1].imag+pLHS[3].imag*pRHS[1].real+pLHS[4].real*pRHS[2].imag+pLHS[4].imag*pRHS[2].real+pLHS[5].real*pRHS[3].imag+pLHS[5].imag*pRHS[3].real+pLHS[6].real*pRHS[4].imag+pLHS[6].imag*pRHS[4].real+pLHS[7].real*pRHS[5].imag+pLHS[7].imag*pRHS[5].real;
    pOutCorrelation[3]=pLHS[3].real*pRHS[0].imag+pLHS[3].imag*pRHS[0].real+pLHS[4].real*pRHS[1].imag+pLHS[4].imag*pRHS[1].real+pLHS[5].real*pRHS[2].imag+pLHS[5].imag*pRHS[2].real+pLHS[6].real*pRHS[3].imag+pLHS[6].imag*pRHS[3].real+pLHS[7].real*pRHS[4].imag+pLHS[7].imag*pRHS[4].real;
    pOutCorrelation[4]=pLHS[4].real*pRHS[0].imag+pLHS[4].imag*pRHS[0].real+pLHS[5].real*pRHS[1].imag+pLHS[5].imag*pRHS[1].real+pLHS[6].real*pRHS[2].imag+pLHS[6].imag*pRHS[2].real+pLHS[7].real*pRHS[3].imag+pLHS[7].imag*pRHS[3].real;
    pOutCorrelation[5]=pLHS[5].real*pRHS[0].imag+pLHS[5].imag*pRHS[0].real+pLHS[6].real*pRHS[1].imag+pLHS[6].imag*pRHS[1].real+pLHS[7].real*pRHS[2].imag+pLHS[7].imag*pRHS[2].real;
    pOutCorrelation[6]=pLHS[6].real*pRHS[0].imag+pLHS[6].imag*pRHS[0].real+pLHS[7].real*pRHS[1].imag+pLHS[7].imag*pRHS[1].real;
    pOutCorrelation[7]=pLHS[7].real*pRHS[0].imag+pLHS[7].imag*pRHS[0].real;

def computeImaginaryCorrelation9(pOutCorrelation,pLHS,pRHS):
    pOutCorrelation[0]=pLHS[0].real*pRHS[0].imag+pLHS[0].imag*pRHS[0].real+pLHS[1].real*pRHS[1].imag+pLHS[1].imag*pRHS[1].real+pLHS[2].real*pRHS[2].imag+pLHS[2].imag*pRHS[2].real+pLHS[3].real*pRHS[3].imag+pLHS[3].imag*pRHS[3].real+pLHS[4].real*pRHS[4].imag+pLHS[4].imag*pRHS[4].real+pLHS[5].real*pRHS[5].imag+pLHS[5].imag*pRHS[5].real+pLHS[6].real*pRHS[6].imag+pLHS[6].imag*pRHS[6].real+pLHS[7].real*pRHS[7].imag+pLHS[7].imag*pRHS[7].real+pLHS[8].real*pRHS[8].imag+pLHS[8].imag*pRHS[8].real;
    pOutCorrelation[1]=pLHS[1].real*pRHS[0].imag+pLHS[1].imag*pRHS[0].real+pLHS[2].real*pRHS[1].imag+pLHS[2].imag*pRHS[1].real+pLHS[3].real*pRHS[2].imag+pLHS[3].imag*pRHS[2].real+pLHS[4].real*pRHS[3].imag+pLHS[4].imag*pRHS[3].real+pLHS[5].real*pRHS[4].imag+pLHS[5].imag*pRHS[4].real+pLHS[6].real*pRHS[5].imag+pLHS[6].imag*pRHS[5].real+pLHS[7].real*pRHS[6].imag+pLHS[7].imag*pRHS[6].real+pLHS[8].real*pRHS[7].imag+pLHS[8].imag*pRHS[7].real;
    pOutCorrelation[2]=pLHS[2].real*pRHS[0].imag+pLHS[2].imag*pRHS[0].real+pLHS[3].real*pRHS[1].imag+pLHS[3].imag*pRHS[1].real+pLHS[4].real*pRHS[2].imag+pLHS[4].imag*pRHS[2].real+pLHS[5].real*pRHS[3].imag+pLHS[5].imag*pRHS[3].real+pLHS[6].real*pRHS[4].imag+pLHS[6].imag*pRHS[4].real+pLHS[7].real*pRHS[5].imag+pLHS[7].imag*pRHS[5].real+pLHS[8].real*pRHS[6].imag+pLHS[8].imag*pRHS[6].real;
    pOutCorrelation[3]=pLHS[3].real*pRHS[0].imag+pLHS[3].imag*pRHS[0].real+pLHS[4].real*pRHS[1].imag+pLHS[4].imag*pRHS[1].real+pLHS[5].real*pRHS[2].imag+pLHS[5].imag*pRHS[2].real+pLHS[6].real*pRHS[3].imag+pLHS[6].imag*pRHS[3].real+pLHS[7].real*pRHS[4].imag+pLHS[7].imag*pRHS[4].real+pLHS[8].real*pRHS[5].imag+pLHS[8].imag*pRHS[5].real;
    pOutCorrelation[4]=pLHS[4].real*pRHS[0].imag+pLHS[4].imag*pRHS[0].real+pLHS[5].real*pRHS[1].imag+pLHS[5].imag*pRHS[1].real+pLHS[6].real*pRHS[2].imag+pLHS[6].imag*pRHS[2].real+pLHS[7].real*pRHS[3].imag+pLHS[7].imag*pRHS[3].real+pLHS[8].real*pRHS[4].imag+pLHS[8].imag*pRHS[4].real;
    pOutCorrelation[5]=pLHS[5].real*pRHS[0].imag+pLHS[5].imag*pRHS[0].real+pLHS[6].real*pRHS[1].imag+pLHS[6].imag*pRHS[1].real+pLHS[7].real*pRHS[2].imag+pLHS[7].imag*pRHS[2].real+pLHS[8].real*pRHS[3].imag+pLHS[8].imag*pRHS[3].real;
    pOutCorrelation[6]=pLHS[6].real*pRHS[0].imag+pLHS[6].imag*pRHS[0].real+pLHS[7].real*pRHS[1].imag+pLHS[7].imag*pRHS[1].real+pLHS[8].real*pRHS[2].imag+pLHS[8].imag*pRHS[2].real;
    pOutCorrelation[7]=pLHS[7].real*pRHS[0].imag+pLHS[7].imag*pRHS[0].real+pLHS[8].real*pRHS[1].imag+pLHS[8].imag*pRHS[1].real;
    pOutCorrelation[8]=pLHS[8].real*pRHS[0].imag+pLHS[8].imag*pRHS[0].real;


def evaluateFastHerglotzTransform2(circlePoint,pExponentialMoment,pEvaluationPolynomial):
    conjCirclePoint=np.conj(circlePoint);
    polynomial1=pEvaluationPolynomial[0].real;
    polynomial0=pEvaluationPolynomial[1]+polynomial1*conjCirclePoint;
    dotProduct=polynomial1*pExponentialMoment[1];
    return pExponentialMoment[0]+2.0*(dotProduct)/(polynomial0);

def evaluateFastHerglotzTransform3(circlePoint,pExponentialMoment,pEvaluationPolynomial):
    conjCirclePoint=np.conj(circlePoint);
    polynomial2=pEvaluationPolynomial[0].real;
    polynomial1=pEvaluationPolynomial[1]+polynomial2*conjCirclePoint;
    polynomial0=pEvaluationPolynomial[2]+conjCirclePoint*polynomial1;
    dotProduct=polynomial1*pExponentialMoment[1]+polynomial2*pExponentialMoment[2];
    return pExponentialMoment[0]+2.0*(dotProduct)/(polynomial0);

def evaluateFastHerglotzTransform4(circlePoint,pExponentialMoment,pEvaluationPolynomial):
    conjCirclePoint=np.conj(circlePoint);
    polynomial3=pEvaluationPolynomial[0].real;
    polynomial2=pEvaluationPolynomial[1]+polynomial3*conjCirclePoint;
    polynomial1=pEvaluationPolynomial[2]+conjCirclePoint*polynomial2;
    polynomial0=pEvaluationPolynomial[3]+conjCirclePoint*polynomial1;
    dotProduct=polynomial1*pExponentialMoment[1]+polynomial2*pExponentialMoment[2]+polynomial3*pExponentialMoment[3];
    return pExponentialMoment[0]+2.0*(dotProduct)/(polynomial0);

def evaluateFastHerglotzTransform5(circlePoint,pExponentialMoment,pEvaluationPolynomial):
    conjCirclePoint=np.conj(circlePoint);
    polynomial4=pEvaluationPolynomial[0].real;
    polynomial3=pEvaluationPolynomial[1]+polynomial4*conjCirclePoint;
    polynomial2=pEvaluationPolynomial[2]+conjCirclePoint*polynomial3;
    polynomial1=pEvaluationPolynomial[3]+conjCirclePoint*polynomial2;
    polynomial0=pEvaluationPolynomial[4]+conjCirclePoint*polynomial1;
    dotProduct=polynomial1*pExponentialMoment[1]+polynomial2*pExponentialMoment[2]+polynomial3*pExponentialMoment[3]+polynomial4*pExponentialMoment[4];
    return pExponentialMoment[0]+2.0*(dotProduct)/(polynomial0);

def evaluateFastHerglotzTransform6(circlePoint,pExponentialMoment,pEvaluationPolynomial):
    conjCirclePoint=np.conj(circlePoint);
    polynomial5=pEvaluationPolynomial[0].real;
    polynomial4=pEvaluationPolynomial[1]+polynomial5*conjCirclePoint;
    polynomial3=pEvaluationPolynomial[2]+conjCirclePoint*polynomial4;
    polynomial2=pEvaluationPolynomial[3]+conjCirclePoint*polynomial3;
    polynomial1=pEvaluationPolynomial[4]+conjCirclePoint*polynomial2;
    polynomial0=pEvaluationPolynomial[5]+conjCirclePoint*polynomial1;
    dotProduct=polynomial1*pExponentialMoment[1]+polynomial2*pExponentialMoment[2]+polynomial3*pExponentialMoment[3]+polynomial4*pExponentialMoment[4]+polynomial5*pExponentialMoment[5];
    return pExponentialMoment[0]+2.0*(dotProduct)/(polynomial0);

def evaluateFastHerglotzTransform7(circlePoint,pExponentialMoment,pEvaluationPolynomial):
    conjCirclePoint=np.conj(circlePoint);
    polynomial6=pEvaluationPolynomial[0].real;
    polynomial5=pEvaluationPolynomial[1]+polynomial6*conjCirclePoint;
    polynomial4=pEvaluationPolynomial[2]+conjCirclePoint*polynomial5;
    polynomial3=pEvaluationPolynomial[3]+conjCirclePoint*polynomial4;
    polynomial2=pEvaluationPolynomial[4]+conjCirclePoint*polynomial3;
    polynomial1=pEvaluationPolynomial[5]+conjCirclePoint*polynomial2;
    polynomial0=pEvaluationPolynomial[6]+conjCirclePoint*polynomial1;
    dotProduct=polynomial1*pExponentialMoment[1]+polynomial2*pExponentialMoment[2]+polynomial3*pExponentialMoment[3]+polynomial4*pExponentialMoment[4]+polynomial5*pExponentialMoment[5]+polynomial6*pExponentialMoment[6];
    return pExponentialMoment[0]+2.0*(dotProduct)/(polynomial0);

def evaluateFastHerglotzTransform8(circlePoint,pExponentialMoment,pEvaluationPolynomial):
    conjCirclePoint=np.conj(circlePoint);
    polynomial7=pEvaluationPolynomial[0].real;
    polynomial6=pEvaluationPolynomial[1]+polynomial7*conjCirclePoint;
    polynomial5=pEvaluationPolynomial[2]+conjCirclePoint*polynomial6;
    polynomial4=pEvaluationPolynomial[3]+conjCirclePoint*polynomial5;
    polynomial3=pEvaluationPolynomial[4]+conjCirclePoint*polynomial4;
    polynomial2=pEvaluationPolynomial[5]+conjCirclePoint*polynomial3;
    polynomial1=pEvaluationPolynomial[6]+conjCirclePoint*polynomial2;
    polynomial0=pEvaluationPolynomial[7]+conjCirclePoint*polynomial1;
    dotProduct=polynomial1*pExponentialMoment[1]+polynomial2*pExponentialMoment[2]+polynomial3*pExponentialMoment[3]+polynomial4*pExponentialMoment[4]+polynomial5*pExponentialMoment[5]+polynomial6*pExponentialMoment[6]+polynomial7*pExponentialMoment[7];
    return pExponentialMoment[0]+2.0*(dotProduct)/(polynomial0);

def evaluateFastHerglotzTransform9(circlePoint,pExponentialMoment,pEvaluationPolynomial):
    conjCirclePoint=np.conj(circlePoint);
    polynomial8=pEvaluationPolynomial[0].real;
    polynomial7=pEvaluationPolynomial[1]+polynomial8*conjCirclePoint;
    polynomial6=pEvaluationPolynomial[2]+conjCirclePoint*polynomial7;
    polynomial5=pEvaluationPolynomial[3]+conjCirclePoint*polynomial6;
    polynomial4=pEvaluationPolynomial[4]+conjCirclePoint*polynomial5;
    polynomial3=pEvaluationPolynomial[5]+conjCirclePoint*polynomial4;
    polynomial2=pEvaluationPolynomial[6]+conjCirclePoint*polynomial3;
    polynomial1=pEvaluationPolynomial[7]+conjCirclePoint*polynomial2;
    polynomial0=pEvaluationPolynomial[8]+conjCirclePoint*polynomial1;
    dotProduct=polynomial1*pExponentialMoment[1]+polynomial2*pExponentialMoment[2]+polynomial3*pExponentialMoment[3]+polynomial4*pExponentialMoment[4]+polynomial5*pExponentialMoment[5]+polynomial6*pExponentialMoment[6]+polynomial7*pExponentialMoment[7]+polynomial8*pExponentialMoment[8];
    return pExponentialMoment[0]+2.0*(dotProduct)/(polynomial0);


def evaluateFourierSeries2(circlePoint,pFourierCoefficient):
    # Minimize sequential dependencies by computing powers of circlePoint
    # by multiplying previous powers by powers of two
    circlePointPower1=circlePoint;
    result=pFourierCoefficient[1].real*circlePointPower1.real-pFourierCoefficient[1].imag*circlePointPower1.imag;
    return 2.0*result+pFourierCoefficient[0].real;

def evaluateFourierSeries3(circlePoint,pFourierCoefficient):
    # Minimize sequential dependencies by computing powers of circlePoint
    # by multiplying previous powers by powers of two
    circlePointPower1=circlePoint;
    circlePointPower2=circlePointPower1*circlePointPower1;
    result=pFourierCoefficient[1].real*circlePointPower1.real-pFourierCoefficient[1].imag*circlePointPower1.imag+pFourierCoefficient[2].real*circlePointPower2.real-pFourierCoefficient[2].imag*circlePointPower2.imag;
    return 2.0*result+pFourierCoefficient[0].real;

def evaluateFourierSeries4(circlePoint,pFourierCoefficient):
    # Minimize sequential dependencies by computing powers of circlePoint
    # by multiplying previous powers by powers of two
    circlePointPower1=circlePoint;
    circlePointPower2=circlePointPower1*circlePointPower1;
    circlePointPower3=circlePointPower1*circlePointPower2;
    result=pFourierCoefficient[1].real*circlePointPower1.real-pFourierCoefficient[1].imag*circlePointPower1.imag+pFourierCoefficient[2].real*circlePointPower2.real-pFourierCoefficient[2].imag*circlePointPower2.imag+pFourierCoefficient[3].real*circlePointPower3.real-pFourierCoefficient[3].imag*circlePointPower3.imag;
    return 2.0*result+pFourierCoefficient[0].real;

def evaluateFourierSeries5(circlePoint,pFourierCoefficient):
    # Minimize sequential dependencies by computing powers of circlePoint
    # by multiplying previous powers by powers of two
    circlePointPower1=circlePoint;
    circlePointPower2=circlePointPower1*circlePointPower1;
    circlePointPower3=circlePointPower1*circlePointPower2;
    circlePointPower4=circlePointPower2*circlePointPower2;
    result=pFourierCoefficient[1].real*circlePointPower1.real-pFourierCoefficient[1].imag*circlePointPower1.imag+pFourierCoefficient[2].real*circlePointPower2.real-pFourierCoefficient[2].imag*circlePointPower2.imag+pFourierCoefficient[3].real*circlePointPower3.real-pFourierCoefficient[3].imag*circlePointPower3.imag+pFourierCoefficient[4].real*circlePointPower4.real-pFourierCoefficient[4].imag*circlePointPower4.imag;
    return 2.0*result+pFourierCoefficient[0].real;


def evaluateFourierSeriesReal3(circlePoint,pFourierCoefficient):
    # Minimize sequential dependencies by computing powers of circlePoint
    # by multiplying previous powers by powers of two
    circlePointPower1=circlePoint;
    circlePointPower2=circlePointPower1*circlePointPower1;
    result=pFourierCoefficient[1]*circlePointPower1.real+pFourierCoefficient[2]*circlePointPower2.real;
    return 2.0*result+pFourierCoefficient[0];

def evaluateFourierSeriesReal4(circlePoint,pFourierCoefficient):
    # Minimize sequential dependencies by computing powers of circlePoint
    # by multiplying previous powers by powers of two
    circlePointPower1=circlePoint;
    circlePointPower2=circlePointPower1*circlePointPower1;
    circlePointPower3=circlePointPower1*circlePointPower2;
    result=pFourierCoefficient[1]*circlePointPower1.real+pFourierCoefficient[2]*circlePointPower2.real+pFourierCoefficient[3]*circlePointPower3.real;
    return 2.0*result+pFourierCoefficient[0];

def evaluateFourierSeriesReal5(circlePoint,pFourierCoefficient):
    # Minimize sequential dependencies by computing powers of circlePoint
    # by multiplying previous powers by powers of two
    circlePointPower1=circlePoint;
    circlePointPower2=circlePointPower1*circlePointPower1;
    circlePointPower3=circlePointPower1*circlePointPower2;
    circlePointPower4=circlePointPower2*circlePointPower2;
    result=pFourierCoefficient[1]*circlePointPower1.real+pFourierCoefficient[2]*circlePointPower2.real+pFourierCoefficient[3]*circlePointPower3.real+pFourierCoefficient[4]*circlePointPower4.real;
    return 2.0*result+pFourierCoefficient[0];

def evaluateFourierSeriesReal6(circlePoint,pFourierCoefficient):
    # Minimize sequential dependencies by computing powers of circlePoint
    # by multiplying previous powers by powers of two
    circlePointPower1=circlePoint;
    circlePointPower2=circlePointPower1*circlePointPower1;
    circlePointPower3=circlePointPower1*circlePointPower2;
    circlePointPower4=circlePointPower2*circlePointPower2;
    circlePointPower5=circlePointPower1*circlePointPower4;
    result=pFourierCoefficient[1]*circlePointPower1.real+pFourierCoefficient[2]*circlePointPower2.real+pFourierCoefficient[3]*circlePointPower3.real+pFourierCoefficient[4]*circlePointPower4.real+pFourierCoefficient[5]*circlePointPower5.real;
    return 2.0*result+pFourierCoefficient[0];

def evaluateFourierSeriesReal7(circlePoint,pFourierCoefficient):
    # Minimize sequential dependencies by computing powers of circlePoint
    # by multiplying previous powers by powers of two
    circlePointPower1=circlePoint;
    circlePointPower2=circlePointPower1*circlePointPower1;
    circlePointPower3=circlePointPower1*circlePointPower2;
    circlePointPower4=circlePointPower2*circlePointPower2;
    circlePointPower5=circlePointPower1*circlePointPower4;
    circlePointPower6=circlePointPower2*circlePointPower4;
    result=pFourierCoefficient[1]*circlePointPower1.real+pFourierCoefficient[2]*circlePointPower2.real+pFourierCoefficient[3]*circlePointPower3.real+pFourierCoefficient[4]*circlePointPower4.real+pFourierCoefficient[5]*circlePointPower5.real+pFourierCoefficient[6]*circlePointPower6.real;
    return 2.0*result+pFourierCoefficient[0];

def evaluateFourierSeriesReal8(circlePoint,pFourierCoefficient):
    # Minimize sequential dependencies by computing powers of circlePoint
    # by multiplying previous powers by powers of two
    circlePointPower1=circlePoint;
    circlePointPower2=circlePointPower1*circlePointPower1;
    circlePointPower3=circlePointPower1*circlePointPower2;
    circlePointPower4=circlePointPower2*circlePointPower2;
    circlePointPower5=circlePointPower1*circlePointPower4;
    circlePointPower6=circlePointPower2*circlePointPower4;
    circlePointPower7=circlePointPower3*circlePointPower4;
    result=pFourierCoefficient[1]*circlePointPower1.real+pFourierCoefficient[2]*circlePointPower2.real+pFourierCoefficient[3]*circlePointPower3.real+pFourierCoefficient[4]*circlePointPower4.real+pFourierCoefficient[5]*circlePointPower5.real+pFourierCoefficient[6]*circlePointPower6.real+pFourierCoefficient[7]*circlePointPower7.real;
    return 2.0*result+pFourierCoefficient[0];

def evaluateFourierSeriesReal9(circlePoint,pFourierCoefficient):
    # Minimize sequential dependencies by computing powers of circlePoint
    # by multiplying previous powers by powers of two
    circlePointPower1=circlePoint;
    circlePointPower2=circlePointPower1*circlePointPower1;
    circlePointPower3=circlePointPower1*circlePointPower2;
    circlePointPower4=circlePointPower2*circlePointPower2;
    circlePointPower5=circlePointPower1*circlePointPower4;
    circlePointPower6=circlePointPower2*circlePointPower4;
    circlePointPower7=circlePointPower3*circlePointPower4;
    circlePointPower8=circlePointPower4*circlePointPower4;
    result=pFourierCoefficient[1]*circlePointPower1.real+pFourierCoefficient[2]*circlePointPower2.real+pFourierCoefficient[3]*circlePointPower3.real+pFourierCoefficient[4]*circlePointPower4.real+pFourierCoefficient[5]*circlePointPower5.real+pFourierCoefficient[6]*circlePointPower6.real+pFourierCoefficient[7]*circlePointPower7.real+pFourierCoefficient[8]*circlePointPower8.real;
    return 2.0*result+pFourierCoefficient[0];


def prepareReflectanceSpectrum2(pOutExponentialMoment,pOutEvaluationPolynomial,pTrigonometricMoment):
    trigonometricToExponentialMoments2(pOutExponentialMoment,pTrigonometricMoment);
    levinsonsAlgorithm2(pOutEvaluationPolynomial,pOutExponentialMoment);
    pOutEvaluationPolynomial[0]=6.2831853071795862*pOutEvaluationPolynomial[0];
    pOutEvaluationPolynomial[1]=6.2831853071795862*pOutEvaluationPolynomial[1];

def prepareReflectanceSpectrum3(pOutExponentialMoment,pOutEvaluationPolynomial,pTrigonometricMoment):
    trigonometricToExponentialMoments3(pOutExponentialMoment,pTrigonometricMoment);
    levinsonsAlgorithm3(pOutEvaluationPolynomial,pOutExponentialMoment);
    pOutEvaluationPolynomial[0]=6.2831853071795862*pOutEvaluationPolynomial[0];
    pOutEvaluationPolynomial[1]=6.2831853071795862*pOutEvaluationPolynomial[1];
    pOutEvaluationPolynomial[2]=6.2831853071795862*pOutEvaluationPolynomial[2];

def prepareReflectanceSpectrum4(pOutExponentialMoment,pOutEvaluationPolynomial,pTrigonometricMoment):
    trigonometricToExponentialMoments4(pOutExponentialMoment,pTrigonometricMoment);
    levinsonsAlgorithm4(pOutEvaluationPolynomial,pOutExponentialMoment);
    pOutEvaluationPolynomial[0]=6.2831853071795862*pOutEvaluationPolynomial[0];
    pOutEvaluationPolynomial[1]=6.2831853071795862*pOutEvaluationPolynomial[1];
    pOutEvaluationPolynomial[2]=6.2831853071795862*pOutEvaluationPolynomial[2];
    pOutEvaluationPolynomial[3]=6.2831853071795862*pOutEvaluationPolynomial[3];

def prepareReflectanceSpectrum5(pOutExponentialMoment,pOutEvaluationPolynomial,pTrigonometricMoment):
    trigonometricToExponentialMoments5(pOutExponentialMoment,pTrigonometricMoment);
    levinsonsAlgorithm5(pOutEvaluationPolynomial,pOutExponentialMoment);
    pOutEvaluationPolynomial[0]=6.2831853071795862*pOutEvaluationPolynomial[0];
    pOutEvaluationPolynomial[1]=6.2831853071795862*pOutEvaluationPolynomial[1];
    pOutEvaluationPolynomial[2]=6.2831853071795862*pOutEvaluationPolynomial[2];
    pOutEvaluationPolynomial[3]=6.2831853071795862*pOutEvaluationPolynomial[3];
    pOutEvaluationPolynomial[4]=6.2831853071795862*pOutEvaluationPolynomial[4];

def prepareReflectanceSpectrumReal3(pOutExponentialMoment,pOutEvaluationPolynomial,pTrigonometricMoment):
    trigonometricToExponentialMomentsReal3(pOutExponentialMoment,pTrigonometricMoment);
    levinsonsAlgorithm3(pOutEvaluationPolynomial,pOutExponentialMoment);
    pOutEvaluationPolynomial[0]=6.2831853071795862*pOutEvaluationPolynomial[0];
    pOutEvaluationPolynomial[1]=6.2831853071795862*pOutEvaluationPolynomial[1];
    pOutEvaluationPolynomial[2]=6.2831853071795862*pOutEvaluationPolynomial[2];

def prepareReflectanceSpectrumReal4(pOutExponentialMoment,pOutEvaluationPolynomial,pTrigonometricMoment):
    trigonometricToExponentialMomentsReal4(pOutExponentialMoment,pTrigonometricMoment);
    levinsonsAlgorithm4(pOutEvaluationPolynomial,pOutExponentialMoment);
    pOutEvaluationPolynomial[0]=6.2831853071795862*pOutEvaluationPolynomial[0];
    pOutEvaluationPolynomial[1]=6.2831853071795862*pOutEvaluationPolynomial[1];
    pOutEvaluationPolynomial[2]=6.2831853071795862*pOutEvaluationPolynomial[2];
    pOutEvaluationPolynomial[3]=6.2831853071795862*pOutEvaluationPolynomial[3];

def prepareReflectanceSpectrumReal5(pOutExponentialMoment,pOutEvaluationPolynomial,pTrigonometricMoment):
    trigonometricToExponentialMomentsReal5(pOutExponentialMoment,pTrigonometricMoment);
    levinsonsAlgorithm5(pOutEvaluationPolynomial,pOutExponentialMoment);
    pOutEvaluationPolynomial[0]=6.2831853071795862*pOutEvaluationPolynomial[0];
    pOutEvaluationPolynomial[1]=6.2831853071795862*pOutEvaluationPolynomial[1];
    pOutEvaluationPolynomial[2]=6.2831853071795862*pOutEvaluationPolynomial[2];
    pOutEvaluationPolynomial[3]=6.2831853071795862*pOutEvaluationPolynomial[3];
    pOutEvaluationPolynomial[4]=6.2831853071795862*pOutEvaluationPolynomial[4];

def prepareReflectanceSpectrumReal6(pOutExponentialMoment,pOutEvaluationPolynomial,pTrigonometricMoment):
    trigonometricToExponentialMomentsReal6(pOutExponentialMoment,pTrigonometricMoment);
    levinsonsAlgorithm6(pOutEvaluationPolynomial,pOutExponentialMoment);
    pOutEvaluationPolynomial[0]=6.2831853071795862*pOutEvaluationPolynomial[0];
    pOutEvaluationPolynomial[1]=6.2831853071795862*pOutEvaluationPolynomial[1];
    pOutEvaluationPolynomial[2]=6.2831853071795862*pOutEvaluationPolynomial[2];
    pOutEvaluationPolynomial[3]=6.2831853071795862*pOutEvaluationPolynomial[3];
    pOutEvaluationPolynomial[4]=6.2831853071795862*pOutEvaluationPolynomial[4];
    pOutEvaluationPolynomial[5]=6.2831853071795862*pOutEvaluationPolynomial[5];

def prepareReflectanceSpectrumReal7(pOutExponentialMoment,pOutEvaluationPolynomial,pTrigonometricMoment):
    trigonometricToExponentialMomentsReal7(pOutExponentialMoment,pTrigonometricMoment);
    levinsonsAlgorithm7(pOutEvaluationPolynomial,pOutExponentialMoment);
    pOutEvaluationPolynomial[0]=6.2831853071795862*pOutEvaluationPolynomial[0];
    pOutEvaluationPolynomial[1]=6.2831853071795862*pOutEvaluationPolynomial[1];
    pOutEvaluationPolynomial[2]=6.2831853071795862*pOutEvaluationPolynomial[2];
    pOutEvaluationPolynomial[3]=6.2831853071795862*pOutEvaluationPolynomial[3];
    pOutEvaluationPolynomial[4]=6.2831853071795862*pOutEvaluationPolynomial[4];
    pOutEvaluationPolynomial[5]=6.2831853071795862*pOutEvaluationPolynomial[5];
    pOutEvaluationPolynomial[6]=6.2831853071795862*pOutEvaluationPolynomial[6];

def prepareReflectanceSpectrumReal8(pOutExponentialMoment,pOutEvaluationPolynomial,pTrigonometricMoment):
    trigonometricToExponentialMomentsReal8(pOutExponentialMoment,pTrigonometricMoment);
    levinsonsAlgorithm8(pOutEvaluationPolynomial,pOutExponentialMoment);
    pOutEvaluationPolynomial[0]=6.2831853071795862*pOutEvaluationPolynomial[0];
    pOutEvaluationPolynomial[1]=6.2831853071795862*pOutEvaluationPolynomial[1];
    pOutEvaluationPolynomial[2]=6.2831853071795862*pOutEvaluationPolynomial[2];
    pOutEvaluationPolynomial[3]=6.2831853071795862*pOutEvaluationPolynomial[3];
    pOutEvaluationPolynomial[4]=6.2831853071795862*pOutEvaluationPolynomial[4];
    pOutEvaluationPolynomial[5]=6.2831853071795862*pOutEvaluationPolynomial[5];
    pOutEvaluationPolynomial[6]=6.2831853071795862*pOutEvaluationPolynomial[6];
    pOutEvaluationPolynomial[7]=6.2831853071795862*pOutEvaluationPolynomial[7];

def prepareReflectanceSpectrumReal9(pOutExponentialMoment,pOutEvaluationPolynomial,pTrigonometricMoment):
    trigonometricToExponentialMomentsReal9(pOutExponentialMoment,pTrigonometricMoment);
    levinsonsAlgorithm9(pOutEvaluationPolynomial,pOutExponentialMoment);
    pOutEvaluationPolynomial[0]=6.2831853071795862*pOutEvaluationPolynomial[0];
    pOutEvaluationPolynomial[1]=6.2831853071795862*pOutEvaluationPolynomial[1];
    pOutEvaluationPolynomial[2]=6.2831853071795862*pOutEvaluationPolynomial[2];
    pOutEvaluationPolynomial[3]=6.2831853071795862*pOutEvaluationPolynomial[3];
    pOutEvaluationPolynomial[4]=6.2831853071795862*pOutEvaluationPolynomial[4];
    pOutEvaluationPolynomial[5]=6.2831853071795862*pOutEvaluationPolynomial[5];
    pOutEvaluationPolynomial[6]=6.2831853071795862*pOutEvaluationPolynomial[6];
    pOutEvaluationPolynomial[7]=6.2831853071795862*pOutEvaluationPolynomial[7];
    pOutEvaluationPolynomial[8]=6.2831853071795862*pOutEvaluationPolynomial[8];


def evaluateReflectanceSpectrum2(phase,pExponentialMoment,pEvaluationPolynomial):
    circlePoint=np.exp(1.0j*phase);
    herglotzTransform=evaluateFastHerglotzTransform2(circlePoint,pExponentialMoment,pEvaluationPolynomial);
    return atan2(herglotzTransform.imag,herglotzTransform.real)*0.318309886f+0.5f;

def evaluateReflectanceSpectrum3(phase,pExponentialMoment,pEvaluationPolynomial):
    circlePoint=np.exp(1.0j*phase);
    herglotzTransform=evaluateFastHerglotzTransform3(circlePoint,pExponentialMoment,pEvaluationPolynomial);
    return atan2(herglotzTransform.imag,herglotzTransform.real)*0.318309886f+0.5f;

def evaluateReflectanceSpectrum4(phase,pExponentialMoment,pEvaluationPolynomial):
    circlePoint=np.exp(1.0j*phase);
    herglotzTransform=evaluateFastHerglotzTransform4(circlePoint,pExponentialMoment,pEvaluationPolynomial);
    return atan2(herglotzTransform.imag,herglotzTransform.real)*0.318309886f+0.5f;

def evaluateReflectanceSpectrum5(phase,pExponentialMoment,pEvaluationPolynomial):
    circlePoint=np.exp(1.0j*phase);
    herglotzTransform=evaluateFastHerglotzTransform5(circlePoint,pExponentialMoment,pEvaluationPolynomial);
    return atan2(herglotzTransform.imag,herglotzTransform.real)*0.318309886f+0.5f;

def evaluateReflectanceSpectrum6(phase,pExponentialMoment,pEvaluationPolynomial):
    circlePoint=np.exp(1.0j*phase);
    herglotzTransform=evaluateFastHerglotzTransform6(circlePoint,pExponentialMoment,pEvaluationPolynomial);
    return atan2(herglotzTransform.imag,herglotzTransform.real)*0.318309886f+0.5f;

def evaluateReflectanceSpectrum7(phase,pExponentialMoment,pEvaluationPolynomial):
    circlePoint=np.exp(1.0j*phase);
    herglotzTransform=evaluateFastHerglotzTransform7(circlePoint,pExponentialMoment,pEvaluationPolynomial);
    return atan2(herglotzTransform.imag,herglotzTransform.real)*0.318309886f+0.5f;

def evaluateReflectanceSpectrum8(phase,pExponentialMoment,pEvaluationPolynomial):
    circlePoint=np.exp(1.0j*phase);
    herglotzTransform=evaluateFastHerglotzTransform8(circlePoint,pExponentialMoment,pEvaluationPolynomial);
    return atan2(herglotzTransform.imag,herglotzTransform.real)*0.318309886f+0.5f;

def evaluateReflectanceSpectrum9(phase,pExponentialMoment,pEvaluationPolynomial):
    circlePoint=np.exp(1.0j*phase);
    herglotzTransform=evaluateFastHerglotzTransform9(circlePoint,pExponentialMoment,pEvaluationPolynomial);
    return atan2(herglotzTransform.imag,herglotzTransform.real)*0.318309886f+0.5f;


def prepareReflectanceSpectrumLagrange2(pOutLagrangeMultiplier,pTrigonometricMoment):
     pExponentialMoment[2];
    trigonometricToExponentialMoments2(pExponentialMoment,pTrigonometricMoment);
     pEvaluationPolynomial[2];
    levinsonsAlgorithm2(pEvaluationPolynomial,pExponentialMoment);
    pEvaluationPolynomial[0]=6.2831853071795862*pEvaluationPolynomial[0];
    pEvaluationPolynomial[1]=6.2831853071795862*pEvaluationPolynomial[1];
     pAutocorrelation[2];
    computeAutocorrelation2(pAutocorrelation,pEvaluationPolynomial);
    pExponentialMoment[0]=0.5*pExponentialMoment[0];
    computeCorrelation2(pOutLagrangeMultiplier,pAutocorrelation,pExponentialMoment);
    normalizationFactor=1.0/(3.1415926535897931*pEvaluationPolynomial[0].real);
    pOutLagrangeMultiplier[0]=normalizationFactor*(-1.0j*pOutLagrangeMultiplier[0]);
    pOutLagrangeMultiplier[1]=normalizationFactor*(-1.0j*pOutLagrangeMultiplier[1]);
    pOutLagrangeMultiplier[0]=pOutLagrangeMultiplier[0].real;

def prepareReflectanceSpectrumLagrange3(pOutLagrangeMultiplier,pTrigonometricMoment):
     pExponentialMoment[3];
    trigonometricToExponentialMoments3(pExponentialMoment,pTrigonometricMoment);
     pEvaluationPolynomial[3];
    levinsonsAlgorithm3(pEvaluationPolynomial,pExponentialMoment);
    pEvaluationPolynomial[0]=6.2831853071795862*pEvaluationPolynomial[0];
    pEvaluationPolynomial[1]=6.2831853071795862*pEvaluationPolynomial[1];
    pEvaluationPolynomial[2]=6.2831853071795862*pEvaluationPolynomial[2];
     pAutocorrelation[3];
    computeAutocorrelation3(pAutocorrelation,pEvaluationPolynomial);
    pExponentialMoment[0]=0.5*pExponentialMoment[0];
    computeCorrelation3(pOutLagrangeMultiplier,pAutocorrelation,pExponentialMoment);
    normalizationFactor=1.0/(3.1415926535897931*pEvaluationPolynomial[0].real);
    pOutLagrangeMultiplier[0]=normalizationFactor*(-1.0j*pOutLagrangeMultiplier[0]);
    pOutLagrangeMultiplier[1]=normalizationFactor*(-1.0j*pOutLagrangeMultiplier[1]);
    pOutLagrangeMultiplier[2]=normalizationFactor*(-1.0j*pOutLagrangeMultiplier[2]);
    pOutLagrangeMultiplier[0]=pOutLagrangeMultiplier[0].real;

def prepareReflectanceSpectrumLagrange4(pOutLagrangeMultiplier,pTrigonometricMoment):
     pExponentialMoment[4];
    trigonometricToExponentialMoments4(pExponentialMoment,pTrigonometricMoment);
     pEvaluationPolynomial[4];
    levinsonsAlgorithm4(pEvaluationPolynomial,pExponentialMoment);
    pEvaluationPolynomial[0]=6.2831853071795862*pEvaluationPolynomial[0];
    pEvaluationPolynomial[1]=6.2831853071795862*pEvaluationPolynomial[1];
    pEvaluationPolynomial[2]=6.2831853071795862*pEvaluationPolynomial[2];
    pEvaluationPolynomial[3]=6.2831853071795862*pEvaluationPolynomial[3];
     pAutocorrelation[4];
    computeAutocorrelation4(pAutocorrelation,pEvaluationPolynomial);
    pExponentialMoment[0]=0.5*pExponentialMoment[0];
    computeCorrelation4(pOutLagrangeMultiplier,pAutocorrelation,pExponentialMoment);
    normalizationFactor=1.0/(3.1415926535897931*pEvaluationPolynomial[0].real);
    pOutLagrangeMultiplier[0]=normalizationFactor*(-1.0j*pOutLagrangeMultiplier[0]);
    pOutLagrangeMultiplier[1]=normalizationFactor*(-1.0j*pOutLagrangeMultiplier[1]);
    pOutLagrangeMultiplier[2]=normalizationFactor*(-1.0j*pOutLagrangeMultiplier[2]);
    pOutLagrangeMultiplier[3]=normalizationFactor*(-1.0j*pOutLagrangeMultiplier[3]);
    pOutLagrangeMultiplier[0]=pOutLagrangeMultiplier[0].real;

def prepareReflectanceSpectrumLagrange5(pOutLagrangeMultiplier,pTrigonometricMoment):
     pExponentialMoment[5];
    trigonometricToExponentialMoments5(pExponentialMoment,pTrigonometricMoment);
     pEvaluationPolynomial[5];
    levinsonsAlgorithm5(pEvaluationPolynomial,pExponentialMoment);
    pEvaluationPolynomial[0]=6.2831853071795862*pEvaluationPolynomial[0];
    pEvaluationPolynomial[1]=6.2831853071795862*pEvaluationPolynomial[1];
    pEvaluationPolynomial[2]=6.2831853071795862*pEvaluationPolynomial[2];
    pEvaluationPolynomial[3]=6.2831853071795862*pEvaluationPolynomial[3];
    pEvaluationPolynomial[4]=6.2831853071795862*pEvaluationPolynomial[4];
     pAutocorrelation[5];
    computeAutocorrelation5(pAutocorrelation,pEvaluationPolynomial);
    pExponentialMoment[0]=0.5*pExponentialMoment[0];
    computeCorrelation5(pOutLagrangeMultiplier,pAutocorrelation,pExponentialMoment);
    normalizationFactor=1.0/(3.1415926535897931*pEvaluationPolynomial[0].real);
    pOutLagrangeMultiplier[0]=normalizationFactor*(-1.0j*pOutLagrangeMultiplier[0]);
    pOutLagrangeMultiplier[1]=normalizationFactor*(-1.0j*pOutLagrangeMultiplier[1]);
    pOutLagrangeMultiplier[2]=normalizationFactor*(-1.0j*pOutLagrangeMultiplier[2]);
    pOutLagrangeMultiplier[3]=normalizationFactor*(-1.0j*pOutLagrangeMultiplier[3]);
    pOutLagrangeMultiplier[4]=normalizationFactor*(-1.0j*pOutLagrangeMultiplier[4]);
    pOutLagrangeMultiplier[0]=pOutLagrangeMultiplier[0].real;

def prepareReflectanceSpectrumLagrangeReal3(pOutLagrangeMultiplier,pTrigonometricMoment):
     pExponentialMoment[3];
    trigonometricToExponentialMomentsReal3(pExponentialMoment,pTrigonometricMoment);
     pEvaluationPolynomial[3];
    levinsonsAlgorithm3(pEvaluationPolynomial,pExponentialMoment);
    pEvaluationPolynomial[0]=6.2831853071795862*pEvaluationPolynomial[0];
    pEvaluationPolynomial[1]=6.2831853071795862*pEvaluationPolynomial[1];
    pEvaluationPolynomial[2]=6.2831853071795862*pEvaluationPolynomial[2];
     pAutocorrelation[3];
    computeAutocorrelation3(pAutocorrelation,pEvaluationPolynomial);
    pExponentialMoment[0]=0.5*pExponentialMoment[0];
    computeImaginaryCorrelation3(pOutLagrangeMultiplier,pAutocorrelation,pExponentialMoment);
    normalizationFactor=1.0/(3.1415926535897931*pEvaluationPolynomial[0].real);
    pOutLagrangeMultiplier[0]=normalizationFactor*pOutLagrangeMultiplier[0];
    pOutLagrangeMultiplier[1]=normalizationFactor*pOutLagrangeMultiplier[1];
    pOutLagrangeMultiplier[2]=normalizationFactor*pOutLagrangeMultiplier[2];

def prepareReflectanceSpectrumLagrangeReal4(pOutLagrangeMultiplier,pTrigonometricMoment):
     pExponentialMoment[4];
    trigonometricToExponentialMomentsReal4(pExponentialMoment,pTrigonometricMoment);
     pEvaluationPolynomial[4];
    levinsonsAlgorithm4(pEvaluationPolynomial,pExponentialMoment);
    pEvaluationPolynomial[0]=6.2831853071795862*pEvaluationPolynomial[0];
    pEvaluationPolynomial[1]=6.2831853071795862*pEvaluationPolynomial[1];
    pEvaluationPolynomial[2]=6.2831853071795862*pEvaluationPolynomial[2];
    pEvaluationPolynomial[3]=6.2831853071795862*pEvaluationPolynomial[3];
     pAutocorrelation[4];
    computeAutocorrelation4(pAutocorrelation,pEvaluationPolynomial);
    pExponentialMoment[0]=0.5*pExponentialMoment[0];
    computeImaginaryCorrelation4(pOutLagrangeMultiplier,pAutocorrelation,pExponentialMoment);
    normalizationFactor=1.0/(3.1415926535897931*pEvaluationPolynomial[0].real);
    pOutLagrangeMultiplier[0]=normalizationFactor*pOutLagrangeMultiplier[0];
    pOutLagrangeMultiplier[1]=normalizationFactor*pOutLagrangeMultiplier[1];
    pOutLagrangeMultiplier[2]=normalizationFactor*pOutLagrangeMultiplier[2];
    pOutLagrangeMultiplier[3]=normalizationFactor*pOutLagrangeMultiplier[3];

def prepareReflectanceSpectrumLagrangeReal5(pOutLagrangeMultiplier,pTrigonometricMoment):
     pExponentialMoment[5];
    trigonometricToExponentialMomentsReal5(pExponentialMoment,pTrigonometricMoment);
     pEvaluationPolynomial[5];
    levinsonsAlgorithm5(pEvaluationPolynomial,pExponentialMoment);
    pEvaluationPolynomial[0]=6.2831853071795862*pEvaluationPolynomial[0];
    pEvaluationPolynomial[1]=6.2831853071795862*pEvaluationPolynomial[1];
    pEvaluationPolynomial[2]=6.2831853071795862*pEvaluationPolynomial[2];
    pEvaluationPolynomial[3]=6.2831853071795862*pEvaluationPolynomial[3];
    pEvaluationPolynomial[4]=6.2831853071795862*pEvaluationPolynomial[4];
     pAutocorrelation[5];
    computeAutocorrelation5(pAutocorrelation,pEvaluationPolynomial);
    pExponentialMoment[0]=0.5*pExponentialMoment[0];
    computeImaginaryCorrelation5(pOutLagrangeMultiplier,pAutocorrelation,pExponentialMoment);
    normalizationFactor=1.0/(3.1415926535897931*pEvaluationPolynomial[0].real);
    pOutLagrangeMultiplier[0]=normalizationFactor*pOutLagrangeMultiplier[0];
    pOutLagrangeMultiplier[1]=normalizationFactor*pOutLagrangeMultiplier[1];
    pOutLagrangeMultiplier[2]=normalizationFactor*pOutLagrangeMultiplier[2];
    pOutLagrangeMultiplier[3]=normalizationFactor*pOutLagrangeMultiplier[3];
    pOutLagrangeMultiplier[4]=normalizationFactor*pOutLagrangeMultiplier[4];

def prepareReflectanceSpectrumLagrangeReal6(pOutLagrangeMultiplier,pTrigonometricMoment):
     pExponentialMoment[6];
    trigonometricToExponentialMomentsReal6(pExponentialMoment,pTrigonometricMoment);
     pEvaluationPolynomial[6];
    levinsonsAlgorithm6(pEvaluationPolynomial,pExponentialMoment);
    pEvaluationPolynomial[0]=6.2831853071795862*pEvaluationPolynomial[0];
    pEvaluationPolynomial[1]=6.2831853071795862*pEvaluationPolynomial[1];
    pEvaluationPolynomial[2]=6.2831853071795862*pEvaluationPolynomial[2];
    pEvaluationPolynomial[3]=6.2831853071795862*pEvaluationPolynomial[3];
    pEvaluationPolynomial[4]=6.2831853071795862*pEvaluationPolynomial[4];
    pEvaluationPolynomial[5]=6.2831853071795862*pEvaluationPolynomial[5];
     pAutocorrelation[6];
    computeAutocorrelation6(pAutocorrelation,pEvaluationPolynomial);
    pExponentialMoment[0]=0.5*pExponentialMoment[0];
    computeImaginaryCorrelation6(pOutLagrangeMultiplier,pAutocorrelation,pExponentialMoment);
    normalizationFactor=1.0/(3.1415926535897931*pEvaluationPolynomial[0].real);
    pOutLagrangeMultiplier[0]=normalizationFactor*pOutLagrangeMultiplier[0];
    pOutLagrangeMultiplier[1]=normalizationFactor*pOutLagrangeMultiplier[1];
    pOutLagrangeMultiplier[2]=normalizationFactor*pOutLagrangeMultiplier[2];
    pOutLagrangeMultiplier[3]=normalizationFactor*pOutLagrangeMultiplier[3];
    pOutLagrangeMultiplier[4]=normalizationFactor*pOutLagrangeMultiplier[4];
    pOutLagrangeMultiplier[5]=normalizationFactor*pOutLagrangeMultiplier[5];

def prepareReflectanceSpectrumLagrangeReal7(pOutLagrangeMultiplier,pTrigonometricMoment):
     pExponentialMoment[7];
    trigonometricToExponentialMomentsReal7(pExponentialMoment,pTrigonometricMoment);
     pEvaluationPolynomial[7];
    levinsonsAlgorithm7(pEvaluationPolynomial,pExponentialMoment);
    pEvaluationPolynomial[0]=6.2831853071795862*pEvaluationPolynomial[0];
    pEvaluationPolynomial[1]=6.2831853071795862*pEvaluationPolynomial[1];
    pEvaluationPolynomial[2]=6.2831853071795862*pEvaluationPolynomial[2];
    pEvaluationPolynomial[3]=6.2831853071795862*pEvaluationPolynomial[3];
    pEvaluationPolynomial[4]=6.2831853071795862*pEvaluationPolynomial[4];
    pEvaluationPolynomial[5]=6.2831853071795862*pEvaluationPolynomial[5];
    pEvaluationPolynomial[6]=6.2831853071795862*pEvaluationPolynomial[6];
     pAutocorrelation[7];
    computeAutocorrelation7(pAutocorrelation,pEvaluationPolynomial);
    pExponentialMoment[0]=0.5*pExponentialMoment[0];
    computeImaginaryCorrelation7(pOutLagrangeMultiplier,pAutocorrelation,pExponentialMoment);
    normalizationFactor=1.0/(3.1415926535897931*pEvaluationPolynomial[0].real);
    pOutLagrangeMultiplier[0]=normalizationFactor*pOutLagrangeMultiplier[0];
    pOutLagrangeMultiplier[1]=normalizationFactor*pOutLagrangeMultiplier[1];
    pOutLagrangeMultiplier[2]=normalizationFactor*pOutLagrangeMultiplier[2];
    pOutLagrangeMultiplier[3]=normalizationFactor*pOutLagrangeMultiplier[3];
    pOutLagrangeMultiplier[4]=normalizationFactor*pOutLagrangeMultiplier[4];
    pOutLagrangeMultiplier[5]=normalizationFactor*pOutLagrangeMultiplier[5];
    pOutLagrangeMultiplier[6]=normalizationFactor*pOutLagrangeMultiplier[6];

def prepareReflectanceSpectrumLagrangeReal8(pOutLagrangeMultiplier,pTrigonometricMoment):
     pExponentialMoment[8];
    trigonometricToExponentialMomentsReal8(pExponentialMoment,pTrigonometricMoment);
     pEvaluationPolynomial[8];
    levinsonsAlgorithm8(pEvaluationPolynomial,pExponentialMoment);
    pEvaluationPolynomial[0]=6.2831853071795862*pEvaluationPolynomial[0];
    pEvaluationPolynomial[1]=6.2831853071795862*pEvaluationPolynomial[1];
    pEvaluationPolynomial[2]=6.2831853071795862*pEvaluationPolynomial[2];
    pEvaluationPolynomial[3]=6.2831853071795862*pEvaluationPolynomial[3];
    pEvaluationPolynomial[4]=6.2831853071795862*pEvaluationPolynomial[4];
    pEvaluationPolynomial[5]=6.2831853071795862*pEvaluationPolynomial[5];
    pEvaluationPolynomial[6]=6.2831853071795862*pEvaluationPolynomial[6];
    pEvaluationPolynomial[7]=6.2831853071795862*pEvaluationPolynomial[7];
     pAutocorrelation[8];
    computeAutocorrelation8(pAutocorrelation,pEvaluationPolynomial);
    pExponentialMoment[0]=0.5*pExponentialMoment[0];
    computeImaginaryCorrelation8(pOutLagrangeMultiplier,pAutocorrelation,pExponentialMoment);
    normalizationFactor=1.0/(3.1415926535897931*pEvaluationPolynomial[0].real);
    pOutLagrangeMultiplier[0]=normalizationFactor*pOutLagrangeMultiplier[0];
    pOutLagrangeMultiplier[1]=normalizationFactor*pOutLagrangeMultiplier[1];
    pOutLagrangeMultiplier[2]=normalizationFactor*pOutLagrangeMultiplier[2];
    pOutLagrangeMultiplier[3]=normalizationFactor*pOutLagrangeMultiplier[3];
    pOutLagrangeMultiplier[4]=normalizationFactor*pOutLagrangeMultiplier[4];
    pOutLagrangeMultiplier[5]=normalizationFactor*pOutLagrangeMultiplier[5];
    pOutLagrangeMultiplier[6]=normalizationFactor*pOutLagrangeMultiplier[6];
    pOutLagrangeMultiplier[7]=normalizationFactor*pOutLagrangeMultiplier[7];

def prepareReflectanceSpectrumLagrangeReal9(pOutLagrangeMultiplier,pTrigonometricMoment):
     pExponentialMoment[9];
    trigonometricToExponentialMomentsReal9(pExponentialMoment,pTrigonometricMoment);
     pEvaluationPolynomial[9];
    levinsonsAlgorithm9(pEvaluationPolynomial,pExponentialMoment);
    pEvaluationPolynomial[0]=6.2831853071795862*pEvaluationPolynomial[0];
    pEvaluationPolynomial[1]=6.2831853071795862*pEvaluationPolynomial[1];
    pEvaluationPolynomial[2]=6.2831853071795862*pEvaluationPolynomial[2];
    pEvaluationPolynomial[3]=6.2831853071795862*pEvaluationPolynomial[3];
    pEvaluationPolynomial[4]=6.2831853071795862*pEvaluationPolynomial[4];
    pEvaluationPolynomial[5]=6.2831853071795862*pEvaluationPolynomial[5];
    pEvaluationPolynomial[6]=6.2831853071795862*pEvaluationPolynomial[6];
    pEvaluationPolynomial[7]=6.2831853071795862*pEvaluationPolynomial[7];
    pEvaluationPolynomial[8]=6.2831853071795862*pEvaluationPolynomial[8];
     pAutocorrelation[9];
    computeAutocorrelation9(pAutocorrelation,pEvaluationPolynomial);
    pExponentialMoment[0]=0.5*pExponentialMoment[0];
    computeImaginaryCorrelation9(pOutLagrangeMultiplier,pAutocorrelation,pExponentialMoment);
    normalizationFactor=1.0/(3.1415926535897931*pEvaluationPolynomial[0].real);
    pOutLagrangeMultiplier[0]=normalizationFactor*pOutLagrangeMultiplier[0];
    pOutLagrangeMultiplier[1]=normalizationFactor*pOutLagrangeMultiplier[1];
    pOutLagrangeMultiplier[2]=normalizationFactor*pOutLagrangeMultiplier[2];
    pOutLagrangeMultiplier[3]=normalizationFactor*pOutLagrangeMultiplier[3];
    pOutLagrangeMultiplier[4]=normalizationFactor*pOutLagrangeMultiplier[4];
    pOutLagrangeMultiplier[5]=normalizationFactor*pOutLagrangeMultiplier[5];
    pOutLagrangeMultiplier[6]=normalizationFactor*pOutLagrangeMultiplier[6];
    pOutLagrangeMultiplier[7]=normalizationFactor*pOutLagrangeMultiplier[7];
    pOutLagrangeMultiplier[8]=normalizationFactor*pOutLagrangeMultiplier[8];


def evaluateReflectanceSpectrumLagrange2(phase,pLagrangeMultiplier):
    conjCirclePoint=np.exp(1.0j*-phase);
    lagrangeSeries=evaluateFourierSeries2(conjCirclePoint,pLagrangeMultiplier);
    return atan(lagrangeSeries)*0.318309886f+0.5f;

def evaluateReflectanceSpectrumLagrange3(phase,pLagrangeMultiplier):
    conjCirclePoint=np.exp(1.0j*-phase);
    lagrangeSeries=evaluateFourierSeries3(conjCirclePoint,pLagrangeMultiplier);
    return atan(lagrangeSeries)*0.318309886f+0.5f;

def evaluateReflectanceSpectrumLagrange4(phase,pLagrangeMultiplier):
    conjCirclePoint=np.exp(1.0j*-phase);
    lagrangeSeries=evaluateFourierSeries4(conjCirclePoint,pLagrangeMultiplier);
    return atan(lagrangeSeries)*0.318309886f+0.5f;

def evaluateReflectanceSpectrumLagrange5(phase,pLagrangeMultiplier):
    conjCirclePoint=np.exp(1.0j*-phase);
    lagrangeSeries=evaluateFourierSeries5(conjCirclePoint,pLagrangeMultiplier);
    return atan(lagrangeSeries)*0.318309886f+0.5f;

def evaluateReflectanceSpectrumLagrangeReal3(phase,pLagrangeMultiplier):
    conjCirclePoint=np.exp(1.0j*-phase);
    lagrangeSeries=evaluateFourierSeriesReal3(conjCirclePoint,pLagrangeMultiplier);
    return atan(lagrangeSeries)*0.318309886f+0.5f;

def evaluateReflectanceSpectrumLagrangeReal4(phase,pLagrangeMultiplier):
    conjCirclePoint=np.exp(1.0j*-phase);
    lagrangeSeries=evaluateFourierSeriesReal4(conjCirclePoint,pLagrangeMultiplier);
    return atan(lagrangeSeries)*0.318309886f+0.5f;

def evaluateReflectanceSpectrumLagrangeReal5(phase,pLagrangeMultiplier):
    conjCirclePoint=np.exp(1.0j*-phase);
    lagrangeSeries=evaluateFourierSeriesReal5(conjCirclePoint,pLagrangeMultiplier);
    return atan(lagrangeSeries)*0.318309886f+0.5f;

def evaluateReflectanceSpectrumLagrangeReal6(phase,pLagrangeMultiplier):
    conjCirclePoint=np.exp(1.0j*-phase);
    lagrangeSeries=evaluateFourierSeriesReal6(conjCirclePoint,pLagrangeMultiplier);
    return atan(lagrangeSeries)*0.318309886f+0.5f;

def evaluateReflectanceSpectrumLagrangeReal7(phase,pLagrangeMultiplier):
    conjCirclePoint=np.exp(1.0j*-phase);
    lagrangeSeries=evaluateFourierSeriesReal7(conjCirclePoint,pLagrangeMultiplier);
    return atan(lagrangeSeries)*0.318309886f+0.5f;

def evaluateReflectanceSpectrumLagrangeReal8(phase,pLagrangeMultiplier):
    conjCirclePoint=np.exp(1.0j*-phase);
    lagrangeSeries=evaluateFourierSeriesReal8(conjCirclePoint,pLagrangeMultiplier);
    return atan(lagrangeSeries)*0.318309886f+0.5f;

def evaluateReflectanceSpectrumLagrangeReal9(phase,pLagrangeMultiplier):
    conjCirclePoint=np.exp(1.0j*-phase);
    lagrangeSeries=evaluateFourierSeriesReal9(conjCirclePoint,pLagrangeMultiplier);
    return atan(lagrangeSeries)*0.318309886f+0.5f;


