// 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.


#pragma once
#include <math.h>
#include "complex_algebra.h"


void trigonometricToExponentialMomentsReal3(float_complex pOutExponentialMoment[3],const float pTrigonometricMoment[3]){
	float zerothMomentPhase=3.14159265f*pTrigonometricMoment[0]-1.57079633f;
	pOutExponentialMoment[0]=(float_complex){cosf(zerothMomentPhase),sinf(zerothMomentPhase)};
	pOutExponentialMoment[0]=multiply_mixed(0.0795774715f,pOutExponentialMoment[0]);
	pOutExponentialMoment[1]=multiply_mixed(pTrigonometricMoment[1],multiply((float_complex){0.0f,6.28318531f},pOutExponentialMoment[0]));
	pOutExponentialMoment[2]=add(multiply_mixed(pTrigonometricMoment[2],multiply((float_complex){0.0f,6.28318531f},pOutExponentialMoment[0])),multiply_mixed(pTrigonometricMoment[1],multiply((float_complex){0.0f,3.14159265f},pOutExponentialMoment[1])));
	pOutExponentialMoment[0]=multiply_mixed(2.0f,pOutExponentialMoment[0]);
}

void trigonometricToExponentialMomentsReal4(float_complex pOutExponentialMoment[4],const float pTrigonometricMoment[4]){
	float zerothMomentPhase=3.14159265f*pTrigonometricMoment[0]-1.57079633f;
	pOutExponentialMoment[0]=(float_complex){cosf(zerothMomentPhase),sinf(zerothMomentPhase)};
	pOutExponentialMoment[0]=multiply_mixed(0.0795774715f,pOutExponentialMoment[0]);
	pOutExponentialMoment[1]=multiply_mixed(pTrigonometricMoment[1],multiply((float_complex){0.0f,6.28318531f},pOutExponentialMoment[0]));
	pOutExponentialMoment[2]=add(multiply_mixed(pTrigonometricMoment[2],multiply((float_complex){0.0f,6.28318531f},pOutExponentialMoment[0])),multiply_mixed(pTrigonometricMoment[1],multiply((float_complex){0.0f,3.14159265f},pOutExponentialMoment[1])));
	pOutExponentialMoment[3]=add(add(multiply_mixed(pTrigonometricMoment[3],multiply((float_complex){0.0f,6.28318531f},pOutExponentialMoment[0])),multiply_mixed(pTrigonometricMoment[2],multiply((float_complex){0.0f,4.1887902f},pOutExponentialMoment[1]))),multiply_mixed(pTrigonometricMoment[1],multiply((float_complex){0.0f,2.0943951f},pOutExponentialMoment[2])));
	pOutExponentialMoment[0]=multiply_mixed(2.0f,pOutExponentialMoment[0]);
}

void trigonometricToExponentialMomentsReal5(float_complex pOutExponentialMoment[5],const float pTrigonometricMoment[5]){
	float zerothMomentPhase=3.14159265f*pTrigonometricMoment[0]-1.57079633f;
	pOutExponentialMoment[0]=(float_complex){cosf(zerothMomentPhase),sinf(zerothMomentPhase)};
	pOutExponentialMoment[0]=multiply_mixed(0.0795774715f,pOutExponentialMoment[0]);
	pOutExponentialMoment[1]=multiply_mixed(pTrigonometricMoment[1],multiply((float_complex){0.0f,6.28318531f},pOutExponentialMoment[0]));
	pOutExponentialMoment[2]=add(multiply_mixed(pTrigonometricMoment[2],multiply((float_complex){0.0f,6.28318531f},pOutExponentialMoment[0])),multiply_mixed(pTrigonometricMoment[1],multiply((float_complex){0.0f,3.14159265f},pOutExponentialMoment[1])));
	pOutExponentialMoment[3]=add(add(multiply_mixed(pTrigonometricMoment[3],multiply((float_complex){0.0f,6.28318531f},pOutExponentialMoment[0])),multiply_mixed(pTrigonometricMoment[2],multiply((float_complex){0.0f,4.1887902f},pOutExponentialMoment[1]))),multiply_mixed(pTrigonometricMoment[1],multiply((float_complex){0.0f,2.0943951f},pOutExponentialMoment[2])));
	pOutExponentialMoment[4]=add(add(add(multiply_mixed(pTrigonometricMoment[4],multiply((float_complex){0.0f,6.28318531f},pOutExponentialMoment[0])),multiply_mixed(pTrigonometricMoment[3],multiply((float_complex){0.0f,4.71238898f},pOutExponentialMoment[1]))),multiply_mixed(pTrigonometricMoment[2],multiply((float_complex){0.0f,3.14159265f},pOutExponentialMoment[2]))),multiply_mixed(pTrigonometricMoment[1],multiply((float_complex){0.0f,1.57079633f},pOutExponentialMoment[3])));
	pOutExponentialMoment[0]=multiply_mixed(2.0f,pOutExponentialMoment[0]);
}

void trigonometricToExponentialMomentsReal6(float_complex pOutExponentialMoment[6],const float pTrigonometricMoment[6]){
	float zerothMomentPhase=3.14159265f*pTrigonometricMoment[0]-1.57079633f;
	pOutExponentialMoment[0]=(float_complex){cosf(zerothMomentPhase),sinf(zerothMomentPhase)};
	pOutExponentialMoment[0]=multiply_mixed(0.0795774715f,pOutExponentialMoment[0]);
	pOutExponentialMoment[1]=multiply_mixed(pTrigonometricMoment[1],multiply((float_complex){0.0f,6.28318531f},pOutExponentialMoment[0]));
	pOutExponentialMoment[2]=add(multiply_mixed(pTrigonometricMoment[2],multiply((float_complex){0.0f,6.28318531f},pOutExponentialMoment[0])),multiply_mixed(pTrigonometricMoment[1],multiply((float_complex){0.0f,3.14159265f},pOutExponentialMoment[1])));
	pOutExponentialMoment[3]=add(add(multiply_mixed(pTrigonometricMoment[3],multiply((float_complex){0.0f,6.28318531f},pOutExponentialMoment[0])),multiply_mixed(pTrigonometricMoment[2],multiply((float_complex){0.0f,4.1887902f},pOutExponentialMoment[1]))),multiply_mixed(pTrigonometricMoment[1],multiply((float_complex){0.0f,2.0943951f},pOutExponentialMoment[2])));
	pOutExponentialMoment[4]=add(add(add(multiply_mixed(pTrigonometricMoment[4],multiply((float_complex){0.0f,6.28318531f},pOutExponentialMoment[0])),multiply_mixed(pTrigonometricMoment[3],multiply((float_complex){0.0f,4.71238898f},pOutExponentialMoment[1]))),multiply_mixed(pTrigonometricMoment[2],multiply((float_complex){0.0f,3.14159265f},pOutExponentialMoment[2]))),multiply_mixed(pTrigonometricMoment[1],multiply((float_complex){0.0f,1.57079633f},pOutExponentialMoment[3])));
	pOutExponentialMoment[5]=add(add(add(add(multiply_mixed(pTrigonometricMoment[5],multiply((float_complex){0.0f,6.28318531f},pOutExponentialMoment[0])),multiply_mixed(pTrigonometricMoment[4],multiply((float_complex){0.0f,5.02654825f},pOutExponentialMoment[1]))),multiply_mixed(pTrigonometricMoment[3],multiply((float_complex){0.0f,3.76991118f},pOutExponentialMoment[2]))),multiply_mixed(pTrigonometricMoment[2],multiply((float_complex){0.0f,2.51327412f},pOutExponentialMoment[3]))),multiply_mixed(pTrigonometricMoment[1],multiply((float_complex){0.0f,1.25663706f},pOutExponentialMoment[4])));
	pOutExponentialMoment[0]=multiply_mixed(2.0f,pOutExponentialMoment[0]);
}

void trigonometricToExponentialMomentsReal7(float_complex pOutExponentialMoment[7],const float pTrigonometricMoment[7]){
	float zerothMomentPhase=3.14159265f*pTrigonometricMoment[0]-1.57079633f;
	pOutExponentialMoment[0]=(float_complex){cosf(zerothMomentPhase),sinf(zerothMomentPhase)};
	pOutExponentialMoment[0]=multiply_mixed(0.0795774715f,pOutExponentialMoment[0]);
	pOutExponentialMoment[1]=multiply_mixed(pTrigonometricMoment[1],multiply((float_complex){0.0f,6.28318531f},pOutExponentialMoment[0]));
	pOutExponentialMoment[2]=add(multiply_mixed(pTrigonometricMoment[2],multiply((float_complex){0.0f,6.28318531f},pOutExponentialMoment[0])),multiply_mixed(pTrigonometricMoment[1],multiply((float_complex){0.0f,3.14159265f},pOutExponentialMoment[1])));
	pOutExponentialMoment[3]=add(add(multiply_mixed(pTrigonometricMoment[3],multiply((float_complex){0.0f,6.28318531f},pOutExponentialMoment[0])),multiply_mixed(pTrigonometricMoment[2],multiply((float_complex){0.0f,4.1887902f},pOutExponentialMoment[1]))),multiply_mixed(pTrigonometricMoment[1],multiply((float_complex){0.0f,2.0943951f},pOutExponentialMoment[2])));
	pOutExponentialMoment[4]=add(add(add(multiply_mixed(pTrigonometricMoment[4],multiply((float_complex){0.0f,6.28318531f},pOutExponentialMoment[0])),multiply_mixed(pTrigonometricMoment[3],multiply((float_complex){0.0f,4.71238898f},pOutExponentialMoment[1]))),multiply_mixed(pTrigonometricMoment[2],multiply((float_complex){0.0f,3.14159265f},pOutExponentialMoment[2]))),multiply_mixed(pTrigonometricMoment[1],multiply((float_complex){0.0f,1.57079633f},pOutExponentialMoment[3])));
	pOutExponentialMoment[5]=add(add(add(add(multiply_mixed(pTrigonometricMoment[5],multiply((float_complex){0.0f,6.28318531f},pOutExponentialMoment[0])),multiply_mixed(pTrigonometricMoment[4],multiply((float_complex){0.0f,5.02654825f},pOutExponentialMoment[1]))),multiply_mixed(pTrigonometricMoment[3],multiply((float_complex){0.0f,3.76991118f},pOutExponentialMoment[2]))),multiply_mixed(pTrigonometricMoment[2],multiply((float_complex){0.0f,2.51327412f},pOutExponentialMoment[3]))),multiply_mixed(pTrigonometricMoment[1],multiply((float_complex){0.0f,1.25663706f},pOutExponentialMoment[4])));
	pOutExponentialMoment[6]=add(add(add(add(add(multiply_mixed(pTrigonometricMoment[6],multiply((float_complex){0.0f,6.28318531f},pOutExponentialMoment[0])),multiply_mixed(pTrigonometricMoment[5],multiply((float_complex){0.0f,5.23598776f},pOutExponentialMoment[1]))),multiply_mixed(pTrigonometricMoment[4],multiply((float_complex){0.0f,4.1887902f},pOutExponentialMoment[2]))),multiply_mixed(pTrigonometricMoment[3],multiply((float_complex){0.0f,3.14159265f},pOutExponentialMoment[3]))),multiply_mixed(pTrigonometricMoment[2],multiply((float_complex){0.0f,2.0943951f},pOutExponentialMoment[4]))),multiply_mixed(pTrigonometricMoment[1],multiply((float_complex){0.0f,1.04719755f},pOutExponentialMoment[5])));
	pOutExponentialMoment[0]=multiply_mixed(2.0f,pOutExponentialMoment[0]);
}

void trigonometricToExponentialMomentsReal8(float_complex pOutExponentialMoment[8],const float pTrigonometricMoment[8]){
	float zerothMomentPhase=3.14159265f*pTrigonometricMoment[0]-1.57079633f;
	pOutExponentialMoment[0]=(float_complex){cosf(zerothMomentPhase),sinf(zerothMomentPhase)};
	pOutExponentialMoment[0]=multiply_mixed(0.0795774715f,pOutExponentialMoment[0]);
	pOutExponentialMoment[1]=multiply_mixed(pTrigonometricMoment[1],multiply((float_complex){0.0f,6.28318531f},pOutExponentialMoment[0]));
	pOutExponentialMoment[2]=add(multiply_mixed(pTrigonometricMoment[2],multiply((float_complex){0.0f,6.28318531f},pOutExponentialMoment[0])),multiply_mixed(pTrigonometricMoment[1],multiply((float_complex){0.0f,3.14159265f},pOutExponentialMoment[1])));
	pOutExponentialMoment[3]=add(add(multiply_mixed(pTrigonometricMoment[3],multiply((float_complex){0.0f,6.28318531f},pOutExponentialMoment[0])),multiply_mixed(pTrigonometricMoment[2],multiply((float_complex){0.0f,4.1887902f},pOutExponentialMoment[1]))),multiply_mixed(pTrigonometricMoment[1],multiply((float_complex){0.0f,2.0943951f},pOutExponentialMoment[2])));
	pOutExponentialMoment[4]=add(add(add(multiply_mixed(pTrigonometricMoment[4],multiply((float_complex){0.0f,6.28318531f},pOutExponentialMoment[0])),multiply_mixed(pTrigonometricMoment[3],multiply((float_complex){0.0f,4.71238898f},pOutExponentialMoment[1]))),multiply_mixed(pTrigonometricMoment[2],multiply((float_complex){0.0f,3.14159265f},pOutExponentialMoment[2]))),multiply_mixed(pTrigonometricMoment[1],multiply((float_complex){0.0f,1.57079633f},pOutExponentialMoment[3])));
	pOutExponentialMoment[5]=add(add(add(add(multiply_mixed(pTrigonometricMoment[5],multiply((float_complex){0.0f,6.28318531f},pOutExponentialMoment[0])),multiply_mixed(pTrigonometricMoment[4],multiply((float_complex){0.0f,5.02654825f},pOutExponentialMoment[1]))),multiply_mixed(pTrigonometricMoment[3],multiply((float_complex){0.0f,3.76991118f},pOutExponentialMoment[2]))),multiply_mixed(pTrigonometricMoment[2],multiply((float_complex){0.0f,2.51327412f},pOutExponentialMoment[3]))),multiply_mixed(pTrigonometricMoment[1],multiply((float_complex){0.0f,1.25663706f},pOutExponentialMoment[4])));
	pOutExponentialMoment[6]=add(add(add(add(add(multiply_mixed(pTrigonometricMoment[6],multiply((float_complex){0.0f,6.28318531f},pOutExponentialMoment[0])),multiply_mixed(pTrigonometricMoment[5],multiply((float_complex){0.0f,5.23598776f},pOutExponentialMoment[1]))),multiply_mixed(pTrigonometricMoment[4],multiply((float_complex){0.0f,4.1887902f},pOutExponentialMoment[2]))),multiply_mixed(pTrigonometricMoment[3],multiply((float_complex){0.0f,3.14159265f},pOutExponentialMoment[3]))),multiply_mixed(pTrigonometricMoment[2],multiply((float_complex){0.0f,2.0943951f},pOutExponentialMoment[4]))),multiply_mixed(pTrigonometricMoment[1],multiply((float_complex){0.0f,1.04719755f},pOutExponentialMoment[5])));
	pOutExponentialMoment[7]=add(add(add(add(add(add(multiply_mixed(pTrigonometricMoment[7],multiply((float_complex){0.0f,6.28318531f},pOutExponentialMoment[0])),multiply_mixed(pTrigonometricMoment[6],multiply((float_complex){0.0f,5.38558741f},pOutExponentialMoment[1]))),multiply_mixed(pTrigonometricMoment[5],multiply((float_complex){0.0f,4.48798951f},pOutExponentialMoment[2]))),multiply_mixed(pTrigonometricMoment[4],multiply((float_complex){0.0f,3.5903916f},pOutExponentialMoment[3]))),multiply_mixed(pTrigonometricMoment[3],multiply((float_complex){0.0f,2.6927937f},pOutExponentialMoment[4]))),multiply_mixed(pTrigonometricMoment[2],multiply((float_complex){0.0f,1.7951958f},pOutExponentialMoment[5]))),multiply_mixed(pTrigonometricMoment[1],multiply((float_complex){0.0f,0.897597901f},pOutExponentialMoment[6])));
	pOutExponentialMoment[0]=multiply_mixed(2.0f,pOutExponentialMoment[0]);
}

void trigonometricToExponentialMomentsReal9(float_complex pOutExponentialMoment[9],const float pTrigonometricMoment[9]){
	float zerothMomentPhase=3.14159265f*pTrigonometricMoment[0]-1.57079633f;
	pOutExponentialMoment[0]=(float_complex){cosf(zerothMomentPhase),sinf(zerothMomentPhase)};
	pOutExponentialMoment[0]=multiply_mixed(0.0795774715f,pOutExponentialMoment[0]);
	pOutExponentialMoment[1]=multiply_mixed(pTrigonometricMoment[1],multiply((float_complex){0.0f,6.28318531f},pOutExponentialMoment[0]));
	pOutExponentialMoment[2]=add(multiply_mixed(pTrigonometricMoment[2],multiply((float_complex){0.0f,6.28318531f},pOutExponentialMoment[0])),multiply_mixed(pTrigonometricMoment[1],multiply((float_complex){0.0f,3.14159265f},pOutExponentialMoment[1])));
	pOutExponentialMoment[3]=add(add(multiply_mixed(pTrigonometricMoment[3],multiply((float_complex){0.0f,6.28318531f},pOutExponentialMoment[0])),multiply_mixed(pTrigonometricMoment[2],multiply((float_complex){0.0f,4.1887902f},pOutExponentialMoment[1]))),multiply_mixed(pTrigonometricMoment[1],multiply((float_complex){0.0f,2.0943951f},pOutExponentialMoment[2])));
	pOutExponentialMoment[4]=add(add(add(multiply_mixed(pTrigonometricMoment[4],multiply((float_complex){0.0f,6.28318531f},pOutExponentialMoment[0])),multiply_mixed(pTrigonometricMoment[3],multiply((float_complex){0.0f,4.71238898f},pOutExponentialMoment[1]))),multiply_mixed(pTrigonometricMoment[2],multiply((float_complex){0.0f,3.14159265f},pOutExponentialMoment[2]))),multiply_mixed(pTrigonometricMoment[1],multiply((float_complex){0.0f,1.57079633f},pOutExponentialMoment[3])));
	pOutExponentialMoment[5]=add(add(add(add(multiply_mixed(pTrigonometricMoment[5],multiply((float_complex){0.0f,6.28318531f},pOutExponentialMoment[0])),multiply_mixed(pTrigonometricMoment[4],multiply((float_complex){0.0f,5.02654825f},pOutExponentialMoment[1]))),multiply_mixed(pTrigonometricMoment[3],multiply((float_complex){0.0f,3.76991118f},pOutExponentialMoment[2]))),multiply_mixed(pTrigonometricMoment[2],multiply((float_complex){0.0f,2.51327412f},pOutExponentialMoment[3]))),multiply_mixed(pTrigonometricMoment[1],multiply((float_complex){0.0f,1.25663706f},pOutExponentialMoment[4])));
	pOutExponentialMoment[6]=add(add(add(add(add(multiply_mixed(pTrigonometricMoment[6],multiply((float_complex){0.0f,6.28318531f},pOutExponentialMoment[0])),multiply_mixed(pTrigonometricMoment[5],multiply((float_complex){0.0f,5.23598776f},pOutExponentialMoment[1]))),multiply_mixed(pTrigonometricMoment[4],multiply((float_complex){0.0f,4.1887902f},pOutExponentialMoment[2]))),multiply_mixed(pTrigonometricMoment[3],multiply((float_complex){0.0f,3.14159265f},pOutExponentialMoment[3]))),multiply_mixed(pTrigonometricMoment[2],multiply((float_complex){0.0f,2.0943951f},pOutExponentialMoment[4]))),multiply_mixed(pTrigonometricMoment[1],multiply((float_complex){0.0f,1.04719755f},pOutExponentialMoment[5])));
	pOutExponentialMoment[7]=add(add(add(add(add(add(multiply_mixed(pTrigonometricMoment[7],multiply((float_complex){0.0f,6.28318531f},pOutExponentialMoment[0])),multiply_mixed(pTrigonometricMoment[6],multiply((float_complex){0.0f,5.38558741f},pOutExponentialMoment[1]))),multiply_mixed(pTrigonometricMoment[5],multiply((float_complex){0.0f,4.48798951f},pOutExponentialMoment[2]))),multiply_mixed(pTrigonometricMoment[4],multiply((float_complex){0.0f,3.5903916f},pOutExponentialMoment[3]))),multiply_mixed(pTrigonometricMoment[3],multiply((float_complex){0.0f,2.6927937f},pOutExponentialMoment[4]))),multiply_mixed(pTrigonometricMoment[2],multiply((float_complex){0.0f,1.7951958f},pOutExponentialMoment[5]))),multiply_mixed(pTrigonometricMoment[1],multiply((float_complex){0.0f,0.897597901f},pOutExponentialMoment[6])));
	pOutExponentialMoment[8]=add(add(add(add(add(add(add(multiply_mixed(pTrigonometricMoment[8],multiply((float_complex){0.0f,6.28318531f},pOutExponentialMoment[0])),multiply_mixed(pTrigonometricMoment[7],multiply((float_complex){0.0f,5.49778714f},pOutExponentialMoment[1]))),multiply_mixed(pTrigonometricMoment[6],multiply((float_complex){0.0f,4.71238898f},pOutExponentialMoment[2]))),multiply_mixed(pTrigonometricMoment[5],multiply((float_complex){0.0f,3.92699082f},pOutExponentialMoment[3]))),multiply_mixed(pTrigonometricMoment[4],multiply((float_complex){0.0f,3.14159265f},pOutExponentialMoment[4]))),multiply_mixed(pTrigonometricMoment[3],multiply((float_complex){0.0f,2.35619449f},pOutExponentialMoment[5]))),multiply_mixed(pTrigonometricMoment[2],multiply((float_complex){0.0f,1.57079633f},pOutExponentialMoment[6]))),multiply_mixed(pTrigonometricMoment[1],multiply((float_complex){0.0f,0.785398163f},pOutExponentialMoment[7])));
	pOutExponentialMoment[0]=multiply_mixed(2.0f,pOutExponentialMoment[0]);
}

void trigonometricToExponentialMoments2(float_complex pOutExponentialMoment[2],const float_complex pTrigonometricMoment[2]){
	float zerothMomentPhase=3.14159265f*pTrigonometricMoment[0].x-1.57079633f;
	pOutExponentialMoment[0]=(float_complex){cosf(zerothMomentPhase),sinf(zerothMomentPhase)};
	pOutExponentialMoment[0]=multiply_mixed(0.0795774715f,pOutExponentialMoment[0]);
	pOutExponentialMoment[1]=multiply(multiply((float_complex){0.0f,6.28318531f},pOutExponentialMoment[0]),pTrigonometricMoment[1]);
	pOutExponentialMoment[0]=multiply_mixed(2.0f,pOutExponentialMoment[0]);
}

void trigonometricToExponentialMoments3(float_complex pOutExponentialMoment[3],const float_complex pTrigonometricMoment[3]){
	float zerothMomentPhase=3.14159265f*pTrigonometricMoment[0].x-1.57079633f;
	pOutExponentialMoment[0]=(float_complex){cosf(zerothMomentPhase),sinf(zerothMomentPhase)};
	pOutExponentialMoment[0]=multiply_mixed(0.0795774715f,pOutExponentialMoment[0]);
	pOutExponentialMoment[1]=multiply(multiply((float_complex){0.0f,6.28318531f},pOutExponentialMoment[0]),pTrigonometricMoment[1]);
	pOutExponentialMoment[2]=add(multiply(multiply((float_complex){0.0f,6.28318531f},pOutExponentialMoment[0]),pTrigonometricMoment[2]),multiply(multiply((float_complex){0.0f,3.14159265f},pOutExponentialMoment[1]),pTrigonometricMoment[1]));
	pOutExponentialMoment[0]=multiply_mixed(2.0f,pOutExponentialMoment[0]);
}

void trigonometricToExponentialMoments4(float_complex pOutExponentialMoment[4],const float_complex pTrigonometricMoment[4]){
	float zerothMomentPhase=3.14159265f*pTrigonometricMoment[0].x-1.57079633f;
	pOutExponentialMoment[0]=(float_complex){cosf(zerothMomentPhase),sinf(zerothMomentPhase)};
	pOutExponentialMoment[0]=multiply_mixed(0.0795774715f,pOutExponentialMoment[0]);
	pOutExponentialMoment[1]=multiply(multiply((float_complex){0.0f,6.28318531f},pOutExponentialMoment[0]),pTrigonometricMoment[1]);
	pOutExponentialMoment[2]=add(multiply(multiply((float_complex){0.0f,6.28318531f},pOutExponentialMoment[0]),pTrigonometricMoment[2]),multiply(multiply((float_complex){0.0f,3.14159265f},pOutExponentialMoment[1]),pTrigonometricMoment[1]));
	pOutExponentialMoment[3]=add(add(multiply(multiply((float_complex){0.0f,6.28318531f},pOutExponentialMoment[0]),pTrigonometricMoment[3]),multiply(multiply((float_complex){0.0f,4.1887902f},pOutExponentialMoment[1]),pTrigonometricMoment[2])),multiply(multiply((float_complex){0.0f,2.0943951f},pOutExponentialMoment[2]),pTrigonometricMoment[1]));
	pOutExponentialMoment[0]=multiply_mixed(2.0f,pOutExponentialMoment[0]);
}

void trigonometricToExponentialMoments5(float_complex pOutExponentialMoment[5],const float_complex pTrigonometricMoment[5]){
	float zerothMomentPhase=3.14159265f*pTrigonometricMoment[0].x-1.57079633f;
	pOutExponentialMoment[0]=(float_complex){cosf(zerothMomentPhase),sinf(zerothMomentPhase)};
	pOutExponentialMoment[0]=multiply_mixed(0.0795774715f,pOutExponentialMoment[0]);
	pOutExponentialMoment[1]=multiply(multiply((float_complex){0.0f,6.28318531f},pOutExponentialMoment[0]),pTrigonometricMoment[1]);
	pOutExponentialMoment[2]=add(multiply(multiply((float_complex){0.0f,6.28318531f},pOutExponentialMoment[0]),pTrigonometricMoment[2]),multiply(multiply((float_complex){0.0f,3.14159265f},pOutExponentialMoment[1]),pTrigonometricMoment[1]));
	pOutExponentialMoment[3]=add(add(multiply(multiply((float_complex){0.0f,6.28318531f},pOutExponentialMoment[0]),pTrigonometricMoment[3]),multiply(multiply((float_complex){0.0f,4.1887902f},pOutExponentialMoment[1]),pTrigonometricMoment[2])),multiply(multiply((float_complex){0.0f,2.0943951f},pOutExponentialMoment[2]),pTrigonometricMoment[1]));
	pOutExponentialMoment[4]=add(add(add(multiply(multiply((float_complex){0.0f,6.28318531f},pOutExponentialMoment[0]),pTrigonometricMoment[4]),multiply(multiply((float_complex){0.0f,4.71238898f},pOutExponentialMoment[1]),pTrigonometricMoment[3])),multiply(multiply((float_complex){0.0f,3.14159265f},pOutExponentialMoment[2]),pTrigonometricMoment[2])),multiply(multiply((float_complex){0.0f,1.57079633f},pOutExponentialMoment[3]),pTrigonometricMoment[1]));
	pOutExponentialMoment[0]=multiply_mixed(2.0f,pOutExponentialMoment[0]);
}


void levinsonsAlgorithm2(float_complex pOutSolution[2],const float_complex pFirstColumn[2]){
	pOutSolution[0]=(float_complex){1.0f/(pFirstColumn[0].x),0.0f};
	float_complex dotProduct;
	float_complex flippedSolution1;
	float factor;
	dotProduct=multiply_mixed(pOutSolution[0].x,pFirstColumn[1]);
	factor=1.0f/(1.0f-absSqr(dotProduct));
	flippedSolution1=(float_complex){pOutSolution[0].x,0.0f};
	pOutSolution[0]=(float_complex){factor*pOutSolution[0].x,0.0f};
	pOutSolution[1]=multiply_mixed(factor,(negate(multiply_mixed(flippedSolution1.x,dotProduct))));
}

void levinsonsAlgorithm3(float_complex pOutSolution[3],const float_complex pFirstColumn[3]){
	pOutSolution[0]=(float_complex){1.0f/(pFirstColumn[0].x),0.0f};
	float_complex dotProduct;
	float_complex flippedSolution1;
	float_complex flippedSolution2;
	float factor;
	dotProduct=multiply_mixed(pOutSolution[0].x,pFirstColumn[1]);
	factor=1.0f/(1.0f-absSqr(dotProduct));
	flippedSolution1=(float_complex){pOutSolution[0].x,0.0f};
	pOutSolution[0]=(float_complex){factor*pOutSolution[0].x,0.0f};
	pOutSolution[1]=multiply_mixed(factor,(negate(multiply_mixed(flippedSolution1.x,dotProduct))));
	dotProduct=add(multiply_mixed(pOutSolution[0].x,pFirstColumn[2]),multiply(pOutSolution[1],pFirstColumn[1]));
	factor=1.0f/(1.0f-absSqr(dotProduct));
	flippedSolution1=conjugate(pOutSolution[1]);
	flippedSolution2=(float_complex){pOutSolution[0].x,0.0f};
	pOutSolution[0]=(float_complex){factor*pOutSolution[0].x,0.0f};
	pOutSolution[1]=multiply_mixed(factor,(subtract(pOutSolution[1],multiply(flippedSolution1,dotProduct))));
	pOutSolution[2]=multiply_mixed(factor,(negate(multiply_mixed(flippedSolution2.x,dotProduct))));
}

void levinsonsAlgorithm4(float_complex pOutSolution[4],const float_complex pFirstColumn[4]){
	pOutSolution[0]=(float_complex){1.0f/(pFirstColumn[0].x),0.0f};
	float_complex dotProduct;
	float_complex flippedSolution1;
	float_complex flippedSolution2;
	float_complex flippedSolution3;
	float factor;
	dotProduct=multiply_mixed(pOutSolution[0].x,pFirstColumn[1]);
	factor=1.0f/(1.0f-absSqr(dotProduct));
	flippedSolution1=(float_complex){pOutSolution[0].x,0.0f};
	pOutSolution[0]=(float_complex){factor*pOutSolution[0].x,0.0f};
	pOutSolution[1]=multiply_mixed(factor,(negate(multiply_mixed(flippedSolution1.x,dotProduct))));
	dotProduct=add(multiply_mixed(pOutSolution[0].x,pFirstColumn[2]),multiply(pOutSolution[1],pFirstColumn[1]));
	factor=1.0f/(1.0f-absSqr(dotProduct));
	flippedSolution1=conjugate(pOutSolution[1]);
	flippedSolution2=(float_complex){pOutSolution[0].x,0.0f};
	pOutSolution[0]=(float_complex){factor*pOutSolution[0].x,0.0f};
	pOutSolution[1]=multiply_mixed(factor,(subtract(pOutSolution[1],multiply(flippedSolution1,dotProduct))));
	pOutSolution[2]=multiply_mixed(factor,(negate(multiply_mixed(flippedSolution2.x,dotProduct))));
	dotProduct=add(add(multiply_mixed(pOutSolution[0].x,pFirstColumn[3]),multiply(pOutSolution[1],pFirstColumn[2])),multiply(pOutSolution[2],pFirstColumn[1]));
	factor=1.0f/(1.0f-absSqr(dotProduct));
	flippedSolution1=conjugate(pOutSolution[2]);
	flippedSolution2=conjugate(pOutSolution[1]);
	flippedSolution3=(float_complex){pOutSolution[0].x,0.0f};
	pOutSolution[0]=(float_complex){factor*pOutSolution[0].x,0.0f};
	pOutSolution[1]=multiply_mixed(factor,(subtract(pOutSolution[1],multiply(flippedSolution1,dotProduct))));
	pOutSolution[2]=multiply_mixed(factor,(subtract(pOutSolution[2],multiply(flippedSolution2,dotProduct))));
	pOutSolution[3]=multiply_mixed(factor,(negate(multiply_mixed(flippedSolution3.x,dotProduct))));
}

void levinsonsAlgorithm5(float_complex pOutSolution[5],const float_complex pFirstColumn[5]){
	pOutSolution[0]=(float_complex){1.0f/(pFirstColumn[0].x),0.0f};
	float_complex dotProduct;
	float_complex flippedSolution1;
	float_complex flippedSolution2;
	float_complex flippedSolution3;
	float_complex flippedSolution4;
	float factor;
	dotProduct=multiply_mixed(pOutSolution[0].x,pFirstColumn[1]);
	factor=1.0f/(1.0f-absSqr(dotProduct));
	flippedSolution1=(float_complex){pOutSolution[0].x,0.0f};
	pOutSolution[0]=(float_complex){factor*pOutSolution[0].x,0.0f};
	pOutSolution[1]=multiply_mixed(factor,(negate(multiply_mixed(flippedSolution1.x,dotProduct))));
	dotProduct=add(multiply_mixed(pOutSolution[0].x,pFirstColumn[2]),multiply(pOutSolution[1],pFirstColumn[1]));
	factor=1.0f/(1.0f-absSqr(dotProduct));
	flippedSolution1=conjugate(pOutSolution[1]);
	flippedSolution2=(float_complex){pOutSolution[0].x,0.0f};
	pOutSolution[0]=(float_complex){factor*pOutSolution[0].x,0.0f};
	pOutSolution[1]=multiply_mixed(factor,(subtract(pOutSolution[1],multiply(flippedSolution1,dotProduct))));
	pOutSolution[2]=multiply_mixed(factor,(negate(multiply_mixed(flippedSolution2.x,dotProduct))));
	dotProduct=add(add(multiply_mixed(pOutSolution[0].x,pFirstColumn[3]),multiply(pOutSolution[1],pFirstColumn[2])),multiply(pOutSolution[2],pFirstColumn[1]));
	factor=1.0f/(1.0f-absSqr(dotProduct));
	flippedSolution1=conjugate(pOutSolution[2]);
	flippedSolution2=conjugate(pOutSolution[1]);
	flippedSolution3=(float_complex){pOutSolution[0].x,0.0f};
	pOutSolution[0]=(float_complex){factor*pOutSolution[0].x,0.0f};
	pOutSolution[1]=multiply_mixed(factor,(subtract(pOutSolution[1],multiply(flippedSolution1,dotProduct))));
	pOutSolution[2]=multiply_mixed(factor,(subtract(pOutSolution[2],multiply(flippedSolution2,dotProduct))));
	pOutSolution[3]=multiply_mixed(factor,(negate(multiply_mixed(flippedSolution3.x,dotProduct))));
	dotProduct=add(add(add(multiply_mixed(pOutSolution[0].x,pFirstColumn[4]),multiply(pOutSolution[1],pFirstColumn[3])),multiply(pOutSolution[2],pFirstColumn[2])),multiply(pOutSolution[3],pFirstColumn[1]));
	factor=1.0f/(1.0f-absSqr(dotProduct));
	flippedSolution1=conjugate(pOutSolution[3]);
	flippedSolution2=conjugate(pOutSolution[2]);
	flippedSolution3=conjugate(pOutSolution[1]);
	flippedSolution4=(float_complex){pOutSolution[0].x,0.0f};
	pOutSolution[0]=(float_complex){factor*pOutSolution[0].x,0.0f};
	pOutSolution[1]=multiply_mixed(factor,(subtract(pOutSolution[1],multiply(flippedSolution1,dotProduct))));
	pOutSolution[2]=multiply_mixed(factor,(subtract(pOutSolution[2],multiply(flippedSolution2,dotProduct))));
	pOutSolution[3]=multiply_mixed(factor,(subtract(pOutSolution[3],multiply(flippedSolution3,dotProduct))));
	pOutSolution[4]=multiply_mixed(factor,(negate(multiply_mixed(flippedSolution4.x,dotProduct))));
}

void levinsonsAlgorithm6(float_complex pOutSolution[6],const float_complex pFirstColumn[6]){
	pOutSolution[0]=(float_complex){1.0f/(pFirstColumn[0].x),0.0f};
	float_complex dotProduct;
	float_complex flippedSolution1;
	float_complex flippedSolution2;
	float_complex flippedSolution3;
	float_complex flippedSolution4;
	float_complex flippedSolution5;
	float factor;
	dotProduct=multiply_mixed(pOutSolution[0].x,pFirstColumn[1]);
	factor=1.0f/(1.0f-absSqr(dotProduct));
	flippedSolution1=(float_complex){pOutSolution[0].x,0.0f};
	pOutSolution[0]=(float_complex){factor*pOutSolution[0].x,0.0f};
	pOutSolution[1]=multiply_mixed(factor,(negate(multiply_mixed(flippedSolution1.x,dotProduct))));
	dotProduct=add(multiply_mixed(pOutSolution[0].x,pFirstColumn[2]),multiply(pOutSolution[1],pFirstColumn[1]));
	factor=1.0f/(1.0f-absSqr(dotProduct));
	flippedSolution1=conjugate(pOutSolution[1]);
	flippedSolution2=(float_complex){pOutSolution[0].x,0.0f};
	pOutSolution[0]=(float_complex){factor*pOutSolution[0].x,0.0f};
	pOutSolution[1]=multiply_mixed(factor,(subtract(pOutSolution[1],multiply(flippedSolution1,dotProduct))));
	pOutSolution[2]=multiply_mixed(factor,(negate(multiply_mixed(flippedSolution2.x,dotProduct))));
	dotProduct=add(add(multiply_mixed(pOutSolution[0].x,pFirstColumn[3]),multiply(pOutSolution[1],pFirstColumn[2])),multiply(pOutSolution[2],pFirstColumn[1]));
	factor=1.0f/(1.0f-absSqr(dotProduct));
	flippedSolution1=conjugate(pOutSolution[2]);
	flippedSolution2=conjugate(pOutSolution[1]);
	flippedSolution3=(float_complex){pOutSolution[0].x,0.0f};
	pOutSolution[0]=(float_complex){factor*pOutSolution[0].x,0.0f};
	pOutSolution[1]=multiply_mixed(factor,(subtract(pOutSolution[1],multiply(flippedSolution1,dotProduct))));
	pOutSolution[2]=multiply_mixed(factor,(subtract(pOutSolution[2],multiply(flippedSolution2,dotProduct))));
	pOutSolution[3]=multiply_mixed(factor,(negate(multiply_mixed(flippedSolution3.x,dotProduct))));
	dotProduct=add(add(add(multiply_mixed(pOutSolution[0].x,pFirstColumn[4]),multiply(pOutSolution[1],pFirstColumn[3])),multiply(pOutSolution[2],pFirstColumn[2])),multiply(pOutSolution[3],pFirstColumn[1]));
	factor=1.0f/(1.0f-absSqr(dotProduct));
	flippedSolution1=conjugate(pOutSolution[3]);
	flippedSolution2=conjugate(pOutSolution[2]);
	flippedSolution3=conjugate(pOutSolution[1]);
	flippedSolution4=(float_complex){pOutSolution[0].x,0.0f};
	pOutSolution[0]=(float_complex){factor*pOutSolution[0].x,0.0f};
	pOutSolution[1]=multiply_mixed(factor,(subtract(pOutSolution[1],multiply(flippedSolution1,dotProduct))));
	pOutSolution[2]=multiply_mixed(factor,(subtract(pOutSolution[2],multiply(flippedSolution2,dotProduct))));
	pOutSolution[3]=multiply_mixed(factor,(subtract(pOutSolution[3],multiply(flippedSolution3,dotProduct))));
	pOutSolution[4]=multiply_mixed(factor,(negate(multiply_mixed(flippedSolution4.x,dotProduct))));
	dotProduct=add(add(add(add(multiply_mixed(pOutSolution[0].x,pFirstColumn[5]),multiply(pOutSolution[1],pFirstColumn[4])),multiply(pOutSolution[2],pFirstColumn[3])),multiply(pOutSolution[3],pFirstColumn[2])),multiply(pOutSolution[4],pFirstColumn[1]));
	factor=1.0f/(1.0f-absSqr(dotProduct));
	flippedSolution1=conjugate(pOutSolution[4]);
	flippedSolution2=conjugate(pOutSolution[3]);
	flippedSolution3=conjugate(pOutSolution[2]);
	flippedSolution4=conjugate(pOutSolution[1]);
	flippedSolution5=(float_complex){pOutSolution[0].x,0.0f};
	pOutSolution[0]=(float_complex){factor*pOutSolution[0].x,0.0f};
	pOutSolution[1]=multiply_mixed(factor,(subtract(pOutSolution[1],multiply(flippedSolution1,dotProduct))));
	pOutSolution[2]=multiply_mixed(factor,(subtract(pOutSolution[2],multiply(flippedSolution2,dotProduct))));
	pOutSolution[3]=multiply_mixed(factor,(subtract(pOutSolution[3],multiply(flippedSolution3,dotProduct))));
	pOutSolution[4]=multiply_mixed(factor,(subtract(pOutSolution[4],multiply(flippedSolution4,dotProduct))));
	pOutSolution[5]=multiply_mixed(factor,(negate(multiply_mixed(flippedSolution5.x,dotProduct))));
}

void levinsonsAlgorithm7(float_complex pOutSolution[7],const float_complex pFirstColumn[7]){
	pOutSolution[0]=(float_complex){1.0f/(pFirstColumn[0].x),0.0f};
	float_complex dotProduct;
	float_complex flippedSolution1;
	float_complex flippedSolution2;
	float_complex flippedSolution3;
	float_complex flippedSolution4;
	float_complex flippedSolution5;
	float_complex flippedSolution6;
	float factor;
	dotProduct=multiply_mixed(pOutSolution[0].x,pFirstColumn[1]);
	factor=1.0f/(1.0f-absSqr(dotProduct));
	flippedSolution1=(float_complex){pOutSolution[0].x,0.0f};
	pOutSolution[0]=(float_complex){factor*pOutSolution[0].x,0.0f};
	pOutSolution[1]=multiply_mixed(factor,(negate(multiply_mixed(flippedSolution1.x,dotProduct))));
	dotProduct=add(multiply_mixed(pOutSolution[0].x,pFirstColumn[2]),multiply(pOutSolution[1],pFirstColumn[1]));
	factor=1.0f/(1.0f-absSqr(dotProduct));
	flippedSolution1=conjugate(pOutSolution[1]);
	flippedSolution2=(float_complex){pOutSolution[0].x,0.0f};
	pOutSolution[0]=(float_complex){factor*pOutSolution[0].x,0.0f};
	pOutSolution[1]=multiply_mixed(factor,(subtract(pOutSolution[1],multiply(flippedSolution1,dotProduct))));
	pOutSolution[2]=multiply_mixed(factor,(negate(multiply_mixed(flippedSolution2.x,dotProduct))));
	dotProduct=add(add(multiply_mixed(pOutSolution[0].x,pFirstColumn[3]),multiply(pOutSolution[1],pFirstColumn[2])),multiply(pOutSolution[2],pFirstColumn[1]));
	factor=1.0f/(1.0f-absSqr(dotProduct));
	flippedSolution1=conjugate(pOutSolution[2]);
	flippedSolution2=conjugate(pOutSolution[1]);
	flippedSolution3=(float_complex){pOutSolution[0].x,0.0f};
	pOutSolution[0]=(float_complex){factor*pOutSolution[0].x,0.0f};
	pOutSolution[1]=multiply_mixed(factor,(subtract(pOutSolution[1],multiply(flippedSolution1,dotProduct))));
	pOutSolution[2]=multiply_mixed(factor,(subtract(pOutSolution[2],multiply(flippedSolution2,dotProduct))));
	pOutSolution[3]=multiply_mixed(factor,(negate(multiply_mixed(flippedSolution3.x,dotProduct))));
	dotProduct=add(add(add(multiply_mixed(pOutSolution[0].x,pFirstColumn[4]),multiply(pOutSolution[1],pFirstColumn[3])),multiply(pOutSolution[2],pFirstColumn[2])),multiply(pOutSolution[3],pFirstColumn[1]));
	factor=1.0f/(1.0f-absSqr(dotProduct));
	flippedSolution1=conjugate(pOutSolution[3]);
	flippedSolution2=conjugate(pOutSolution[2]);
	flippedSolution3=conjugate(pOutSolution[1]);
	flippedSolution4=(float_complex){pOutSolution[0].x,0.0f};
	pOutSolution[0]=(float_complex){factor*pOutSolution[0].x,0.0f};
	pOutSolution[1]=multiply_mixed(factor,(subtract(pOutSolution[1],multiply(flippedSolution1,dotProduct))));
	pOutSolution[2]=multiply_mixed(factor,(subtract(pOutSolution[2],multiply(flippedSolution2,dotProduct))));
	pOutSolution[3]=multiply_mixed(factor,(subtract(pOutSolution[3],multiply(flippedSolution3,dotProduct))));
	pOutSolution[4]=multiply_mixed(factor,(negate(multiply_mixed(flippedSolution4.x,dotProduct))));
	dotProduct=add(add(add(add(multiply_mixed(pOutSolution[0].x,pFirstColumn[5]),multiply(pOutSolution[1],pFirstColumn[4])),multiply(pOutSolution[2],pFirstColumn[3])),multiply(pOutSolution[3],pFirstColumn[2])),multiply(pOutSolution[4],pFirstColumn[1]));
	factor=1.0f/(1.0f-absSqr(dotProduct));
	flippedSolution1=conjugate(pOutSolution[4]);
	flippedSolution2=conjugate(pOutSolution[3]);
	flippedSolution3=conjugate(pOutSolution[2]);
	flippedSolution4=conjugate(pOutSolution[1]);
	flippedSolution5=(float_complex){pOutSolution[0].x,0.0f};
	pOutSolution[0]=(float_complex){factor*pOutSolution[0].x,0.0f};
	pOutSolution[1]=multiply_mixed(factor,(subtract(pOutSolution[1],multiply(flippedSolution1,dotProduct))));
	pOutSolution[2]=multiply_mixed(factor,(subtract(pOutSolution[2],multiply(flippedSolution2,dotProduct))));
	pOutSolution[3]=multiply_mixed(factor,(subtract(pOutSolution[3],multiply(flippedSolution3,dotProduct))));
	pOutSolution[4]=multiply_mixed(factor,(subtract(pOutSolution[4],multiply(flippedSolution4,dotProduct))));
	pOutSolution[5]=multiply_mixed(factor,(negate(multiply_mixed(flippedSolution5.x,dotProduct))));
	dotProduct=add(add(add(add(add(multiply_mixed(pOutSolution[0].x,pFirstColumn[6]),multiply(pOutSolution[1],pFirstColumn[5])),multiply(pOutSolution[2],pFirstColumn[4])),multiply(pOutSolution[3],pFirstColumn[3])),multiply(pOutSolution[4],pFirstColumn[2])),multiply(pOutSolution[5],pFirstColumn[1]));
	factor=1.0f/(1.0f-absSqr(dotProduct));
	flippedSolution1=conjugate(pOutSolution[5]);
	flippedSolution2=conjugate(pOutSolution[4]);
	flippedSolution3=conjugate(pOutSolution[3]);
	flippedSolution4=conjugate(pOutSolution[2]);
	flippedSolution5=conjugate(pOutSolution[1]);
	flippedSolution6=(float_complex){pOutSolution[0].x,0.0f};
	pOutSolution[0]=(float_complex){factor*pOutSolution[0].x,0.0f};
	pOutSolution[1]=multiply_mixed(factor,(subtract(pOutSolution[1],multiply(flippedSolution1,dotProduct))));
	pOutSolution[2]=multiply_mixed(factor,(subtract(pOutSolution[2],multiply(flippedSolution2,dotProduct))));
	pOutSolution[3]=multiply_mixed(factor,(subtract(pOutSolution[3],multiply(flippedSolution3,dotProduct))));
	pOutSolution[4]=multiply_mixed(factor,(subtract(pOutSolution[4],multiply(flippedSolution4,dotProduct))));
	pOutSolution[5]=multiply_mixed(factor,(subtract(pOutSolution[5],multiply(flippedSolution5,dotProduct))));
	pOutSolution[6]=multiply_mixed(factor,(negate(multiply_mixed(flippedSolution6.x,dotProduct))));
}

void levinsonsAlgorithm8(float_complex pOutSolution[8],const float_complex pFirstColumn[8]){
	pOutSolution[0]=(float_complex){1.0f/(pFirstColumn[0].x),0.0f};
	float_complex dotProduct;
	float_complex flippedSolution1;
	float_complex flippedSolution2;
	float_complex flippedSolution3;
	float_complex flippedSolution4;
	float_complex flippedSolution5;
	float_complex flippedSolution6;
	float_complex flippedSolution7;
	float factor;
	dotProduct=multiply_mixed(pOutSolution[0].x,pFirstColumn[1]);
	factor=1.0f/(1.0f-absSqr(dotProduct));
	flippedSolution1=(float_complex){pOutSolution[0].x,0.0f};
	pOutSolution[0]=(float_complex){factor*pOutSolution[0].x,0.0f};
	pOutSolution[1]=multiply_mixed(factor,(negate(multiply_mixed(flippedSolution1.x,dotProduct))));
	dotProduct=add(multiply_mixed(pOutSolution[0].x,pFirstColumn[2]),multiply(pOutSolution[1],pFirstColumn[1]));
	factor=1.0f/(1.0f-absSqr(dotProduct));
	flippedSolution1=conjugate(pOutSolution[1]);
	flippedSolution2=(float_complex){pOutSolution[0].x,0.0f};
	pOutSolution[0]=(float_complex){factor*pOutSolution[0].x,0.0f};
	pOutSolution[1]=multiply_mixed(factor,(subtract(pOutSolution[1],multiply(flippedSolution1,dotProduct))));
	pOutSolution[2]=multiply_mixed(factor,(negate(multiply_mixed(flippedSolution2.x,dotProduct))));
	dotProduct=add(add(multiply_mixed(pOutSolution[0].x,pFirstColumn[3]),multiply(pOutSolution[1],pFirstColumn[2])),multiply(pOutSolution[2],pFirstColumn[1]));
	factor=1.0f/(1.0f-absSqr(dotProduct));
	flippedSolution1=conjugate(pOutSolution[2]);
	flippedSolution2=conjugate(pOutSolution[1]);
	flippedSolution3=(float_complex){pOutSolution[0].x,0.0f};
	pOutSolution[0]=(float_complex){factor*pOutSolution[0].x,0.0f};
	pOutSolution[1]=multiply_mixed(factor,(subtract(pOutSolution[1],multiply(flippedSolution1,dotProduct))));
	pOutSolution[2]=multiply_mixed(factor,(subtract(pOutSolution[2],multiply(flippedSolution2,dotProduct))));
	pOutSolution[3]=multiply_mixed(factor,(negate(multiply_mixed(flippedSolution3.x,dotProduct))));
	dotProduct=add(add(add(multiply_mixed(pOutSolution[0].x,pFirstColumn[4]),multiply(pOutSolution[1],pFirstColumn[3])),multiply(pOutSolution[2],pFirstColumn[2])),multiply(pOutSolution[3],pFirstColumn[1]));
	factor=1.0f/(1.0f-absSqr(dotProduct));
	flippedSolution1=conjugate(pOutSolution[3]);
	flippedSolution2=conjugate(pOutSolution[2]);
	flippedSolution3=conjugate(pOutSolution[1]);
	flippedSolution4=(float_complex){pOutSolution[0].x,0.0f};
	pOutSolution[0]=(float_complex){factor*pOutSolution[0].x,0.0f};
	pOutSolution[1]=multiply_mixed(factor,(subtract(pOutSolution[1],multiply(flippedSolution1,dotProduct))));
	pOutSolution[2]=multiply_mixed(factor,(subtract(pOutSolution[2],multiply(flippedSolution2,dotProduct))));
	pOutSolution[3]=multiply_mixed(factor,(subtract(pOutSolution[3],multiply(flippedSolution3,dotProduct))));
	pOutSolution[4]=multiply_mixed(factor,(negate(multiply_mixed(flippedSolution4.x,dotProduct))));
	dotProduct=add(add(add(add(multiply_mixed(pOutSolution[0].x,pFirstColumn[5]),multiply(pOutSolution[1],pFirstColumn[4])),multiply(pOutSolution[2],pFirstColumn[3])),multiply(pOutSolution[3],pFirstColumn[2])),multiply(pOutSolution[4],pFirstColumn[1]));
	factor=1.0f/(1.0f-absSqr(dotProduct));
	flippedSolution1=conjugate(pOutSolution[4]);
	flippedSolution2=conjugate(pOutSolution[3]);
	flippedSolution3=conjugate(pOutSolution[2]);
	flippedSolution4=conjugate(pOutSolution[1]);
	flippedSolution5=(float_complex){pOutSolution[0].x,0.0f};
	pOutSolution[0]=(float_complex){factor*pOutSolution[0].x,0.0f};
	pOutSolution[1]=multiply_mixed(factor,(subtract(pOutSolution[1],multiply(flippedSolution1,dotProduct))));
	pOutSolution[2]=multiply_mixed(factor,(subtract(pOutSolution[2],multiply(flippedSolution2,dotProduct))));
	pOutSolution[3]=multiply_mixed(factor,(subtract(pOutSolution[3],multiply(flippedSolution3,dotProduct))));
	pOutSolution[4]=multiply_mixed(factor,(subtract(pOutSolution[4],multiply(flippedSolution4,dotProduct))));
	pOutSolution[5]=multiply_mixed(factor,(negate(multiply_mixed(flippedSolution5.x,dotProduct))));
	dotProduct=add(add(add(add(add(multiply_mixed(pOutSolution[0].x,pFirstColumn[6]),multiply(pOutSolution[1],pFirstColumn[5])),multiply(pOutSolution[2],pFirstColumn[4])),multiply(pOutSolution[3],pFirstColumn[3])),multiply(pOutSolution[4],pFirstColumn[2])),multiply(pOutSolution[5],pFirstColumn[1]));
	factor=1.0f/(1.0f-absSqr(dotProduct));
	flippedSolution1=conjugate(pOutSolution[5]);
	flippedSolution2=conjugate(pOutSolution[4]);
	flippedSolution3=conjugate(pOutSolution[3]);
	flippedSolution4=conjugate(pOutSolution[2]);
	flippedSolution5=conjugate(pOutSolution[1]);
	flippedSolution6=(float_complex){pOutSolution[0].x,0.0f};
	pOutSolution[0]=(float_complex){factor*pOutSolution[0].x,0.0f};
	pOutSolution[1]=multiply_mixed(factor,(subtract(pOutSolution[1],multiply(flippedSolution1,dotProduct))));
	pOutSolution[2]=multiply_mixed(factor,(subtract(pOutSolution[2],multiply(flippedSolution2,dotProduct))));
	pOutSolution[3]=multiply_mixed(factor,(subtract(pOutSolution[3],multiply(flippedSolution3,dotProduct))));
	pOutSolution[4]=multiply_mixed(factor,(subtract(pOutSolution[4],multiply(flippedSolution4,dotProduct))));
	pOutSolution[5]=multiply_mixed(factor,(subtract(pOutSolution[5],multiply(flippedSolution5,dotProduct))));
	pOutSolution[6]=multiply_mixed(factor,(negate(multiply_mixed(flippedSolution6.x,dotProduct))));
	dotProduct=add(add(add(add(add(add(multiply_mixed(pOutSolution[0].x,pFirstColumn[7]),multiply(pOutSolution[1],pFirstColumn[6])),multiply(pOutSolution[2],pFirstColumn[5])),multiply(pOutSolution[3],pFirstColumn[4])),multiply(pOutSolution[4],pFirstColumn[3])),multiply(pOutSolution[5],pFirstColumn[2])),multiply(pOutSolution[6],pFirstColumn[1]));
	factor=1.0f/(1.0f-absSqr(dotProduct));
	flippedSolution1=conjugate(pOutSolution[6]);
	flippedSolution2=conjugate(pOutSolution[5]);
	flippedSolution3=conjugate(pOutSolution[4]);
	flippedSolution4=conjugate(pOutSolution[3]);
	flippedSolution5=conjugate(pOutSolution[2]);
	flippedSolution6=conjugate(pOutSolution[1]);
	flippedSolution7=(float_complex){pOutSolution[0].x,0.0f};
	pOutSolution[0]=(float_complex){factor*pOutSolution[0].x,0.0f};
	pOutSolution[1]=multiply_mixed(factor,(subtract(pOutSolution[1],multiply(flippedSolution1,dotProduct))));
	pOutSolution[2]=multiply_mixed(factor,(subtract(pOutSolution[2],multiply(flippedSolution2,dotProduct))));
	pOutSolution[3]=multiply_mixed(factor,(subtract(pOutSolution[3],multiply(flippedSolution3,dotProduct))));
	pOutSolution[4]=multiply_mixed(factor,(subtract(pOutSolution[4],multiply(flippedSolution4,dotProduct))));
	pOutSolution[5]=multiply_mixed(factor,(subtract(pOutSolution[5],multiply(flippedSolution5,dotProduct))));
	pOutSolution[6]=multiply_mixed(factor,(subtract(pOutSolution[6],multiply(flippedSolution6,dotProduct))));
	pOutSolution[7]=multiply_mixed(factor,(negate(multiply_mixed(flippedSolution7.x,dotProduct))));
}

void levinsonsAlgorithm9(float_complex pOutSolution[9],const float_complex pFirstColumn[9]){
	pOutSolution[0]=(float_complex){1.0f/(pFirstColumn[0].x),0.0f};
	float_complex dotProduct;
	float_complex flippedSolution1;
	float_complex flippedSolution2;
	float_complex flippedSolution3;
	float_complex flippedSolution4;
	float_complex flippedSolution5;
	float_complex flippedSolution6;
	float_complex flippedSolution7;
	float_complex flippedSolution8;
	float factor;
	dotProduct=multiply_mixed(pOutSolution[0].x,pFirstColumn[1]);
	factor=1.0f/(1.0f-absSqr(dotProduct));
	flippedSolution1=(float_complex){pOutSolution[0].x,0.0f};
	pOutSolution[0]=(float_complex){factor*pOutSolution[0].x,0.0f};
	pOutSolution[1]=multiply_mixed(factor,(negate(multiply_mixed(flippedSolution1.x,dotProduct))));
	dotProduct=add(multiply_mixed(pOutSolution[0].x,pFirstColumn[2]),multiply(pOutSolution[1],pFirstColumn[1]));
	factor=1.0f/(1.0f-absSqr(dotProduct));
	flippedSolution1=conjugate(pOutSolution[1]);
	flippedSolution2=(float_complex){pOutSolution[0].x,0.0f};
	pOutSolution[0]=(float_complex){factor*pOutSolution[0].x,0.0f};
	pOutSolution[1]=multiply_mixed(factor,(subtract(pOutSolution[1],multiply(flippedSolution1,dotProduct))));
	pOutSolution[2]=multiply_mixed(factor,(negate(multiply_mixed(flippedSolution2.x,dotProduct))));
	dotProduct=add(add(multiply_mixed(pOutSolution[0].x,pFirstColumn[3]),multiply(pOutSolution[1],pFirstColumn[2])),multiply(pOutSolution[2],pFirstColumn[1]));
	factor=1.0f/(1.0f-absSqr(dotProduct));
	flippedSolution1=conjugate(pOutSolution[2]);
	flippedSolution2=conjugate(pOutSolution[1]);
	flippedSolution3=(float_complex){pOutSolution[0].x,0.0f};
	pOutSolution[0]=(float_complex){factor*pOutSolution[0].x,0.0f};
	pOutSolution[1]=multiply_mixed(factor,(subtract(pOutSolution[1],multiply(flippedSolution1,dotProduct))));
	pOutSolution[2]=multiply_mixed(factor,(subtract(pOutSolution[2],multiply(flippedSolution2,dotProduct))));
	pOutSolution[3]=multiply_mixed(factor,(negate(multiply_mixed(flippedSolution3.x,dotProduct))));
	dotProduct=add(add(add(multiply_mixed(pOutSolution[0].x,pFirstColumn[4]),multiply(pOutSolution[1],pFirstColumn[3])),multiply(pOutSolution[2],pFirstColumn[2])),multiply(pOutSolution[3],pFirstColumn[1]));
	factor=1.0f/(1.0f-absSqr(dotProduct));
	flippedSolution1=conjugate(pOutSolution[3]);
	flippedSolution2=conjugate(pOutSolution[2]);
	flippedSolution3=conjugate(pOutSolution[1]);
	flippedSolution4=(float_complex){pOutSolution[0].x,0.0f};
	pOutSolution[0]=(float_complex){factor*pOutSolution[0].x,0.0f};
	pOutSolution[1]=multiply_mixed(factor,(subtract(pOutSolution[1],multiply(flippedSolution1,dotProduct))));
	pOutSolution[2]=multiply_mixed(factor,(subtract(pOutSolution[2],multiply(flippedSolution2,dotProduct))));
	pOutSolution[3]=multiply_mixed(factor,(subtract(pOutSolution[3],multiply(flippedSolution3,dotProduct))));
	pOutSolution[4]=multiply_mixed(factor,(negate(multiply_mixed(flippedSolution4.x,dotProduct))));
	dotProduct=add(add(add(add(multiply_mixed(pOutSolution[0].x,pFirstColumn[5]),multiply(pOutSolution[1],pFirstColumn[4])),multiply(pOutSolution[2],pFirstColumn[3])),multiply(pOutSolution[3],pFirstColumn[2])),multiply(pOutSolution[4],pFirstColumn[1]));
	factor=1.0f/(1.0f-absSqr(dotProduct));
	flippedSolution1=conjugate(pOutSolution[4]);
	flippedSolution2=conjugate(pOutSolution[3]);
	flippedSolution3=conjugate(pOutSolution[2]);
	flippedSolution4=conjugate(pOutSolution[1]);
	flippedSolution5=(float_complex){pOutSolution[0].x,0.0f};
	pOutSolution[0]=(float_complex){factor*pOutSolution[0].x,0.0f};
	pOutSolution[1]=multiply_mixed(factor,(subtract(pOutSolution[1],multiply(flippedSolution1,dotProduct))));
	pOutSolution[2]=multiply_mixed(factor,(subtract(pOutSolution[2],multiply(flippedSolution2,dotProduct))));
	pOutSolution[3]=multiply_mixed(factor,(subtract(pOutSolution[3],multiply(flippedSolution3,dotProduct))));
	pOutSolution[4]=multiply_mixed(factor,(subtract(pOutSolution[4],multiply(flippedSolution4,dotProduct))));
	pOutSolution[5]=multiply_mixed(factor,(negate(multiply_mixed(flippedSolution5.x,dotProduct))));
	dotProduct=add(add(add(add(add(multiply_mixed(pOutSolution[0].x,pFirstColumn[6]),multiply(pOutSolution[1],pFirstColumn[5])),multiply(pOutSolution[2],pFirstColumn[4])),multiply(pOutSolution[3],pFirstColumn[3])),multiply(pOutSolution[4],pFirstColumn[2])),multiply(pOutSolution[5],pFirstColumn[1]));
	factor=1.0f/(1.0f-absSqr(dotProduct));
	flippedSolution1=conjugate(pOutSolution[5]);
	flippedSolution2=conjugate(pOutSolution[4]);
	flippedSolution3=conjugate(pOutSolution[3]);
	flippedSolution4=conjugate(pOutSolution[2]);
	flippedSolution5=conjugate(pOutSolution[1]);
	flippedSolution6=(float_complex){pOutSolution[0].x,0.0f};
	pOutSolution[0]=(float_complex){factor*pOutSolution[0].x,0.0f};
	pOutSolution[1]=multiply_mixed(factor,(subtract(pOutSolution[1],multiply(flippedSolution1,dotProduct))));
	pOutSolution[2]=multiply_mixed(factor,(subtract(pOutSolution[2],multiply(flippedSolution2,dotProduct))));
	pOutSolution[3]=multiply_mixed(factor,(subtract(pOutSolution[3],multiply(flippedSolution3,dotProduct))));
	pOutSolution[4]=multiply_mixed(factor,(subtract(pOutSolution[4],multiply(flippedSolution4,dotProduct))));
	pOutSolution[5]=multiply_mixed(factor,(subtract(pOutSolution[5],multiply(flippedSolution5,dotProduct))));
	pOutSolution[6]=multiply_mixed(factor,(negate(multiply_mixed(flippedSolution6.x,dotProduct))));
	dotProduct=add(add(add(add(add(add(multiply_mixed(pOutSolution[0].x,pFirstColumn[7]),multiply(pOutSolution[1],pFirstColumn[6])),multiply(pOutSolution[2],pFirstColumn[5])),multiply(pOutSolution[3],pFirstColumn[4])),multiply(pOutSolution[4],pFirstColumn[3])),multiply(pOutSolution[5],pFirstColumn[2])),multiply(pOutSolution[6],pFirstColumn[1]));
	factor=1.0f/(1.0f-absSqr(dotProduct));
	flippedSolution1=conjugate(pOutSolution[6]);
	flippedSolution2=conjugate(pOutSolution[5]);
	flippedSolution3=conjugate(pOutSolution[4]);
	flippedSolution4=conjugate(pOutSolution[3]);
	flippedSolution5=conjugate(pOutSolution[2]);
	flippedSolution6=conjugate(pOutSolution[1]);
	flippedSolution7=(float_complex){pOutSolution[0].x,0.0f};
	pOutSolution[0]=(float_complex){factor*pOutSolution[0].x,0.0f};
	pOutSolution[1]=multiply_mixed(factor,(subtract(pOutSolution[1],multiply(flippedSolution1,dotProduct))));
	pOutSolution[2]=multiply_mixed(factor,(subtract(pOutSolution[2],multiply(flippedSolution2,dotProduct))));
	pOutSolution[3]=multiply_mixed(factor,(subtract(pOutSolution[3],multiply(flippedSolution3,dotProduct))));
	pOutSolution[4]=multiply_mixed(factor,(subtract(pOutSolution[4],multiply(flippedSolution4,dotProduct))));
	pOutSolution[5]=multiply_mixed(factor,(subtract(pOutSolution[5],multiply(flippedSolution5,dotProduct))));
	pOutSolution[6]=multiply_mixed(factor,(subtract(pOutSolution[6],multiply(flippedSolution6,dotProduct))));
	pOutSolution[7]=multiply_mixed(factor,(negate(multiply_mixed(flippedSolution7.x,dotProduct))));
	dotProduct=add(add(add(add(add(add(add(multiply_mixed(pOutSolution[0].x,pFirstColumn[8]),multiply(pOutSolution[1],pFirstColumn[7])),multiply(pOutSolution[2],pFirstColumn[6])),multiply(pOutSolution[3],pFirstColumn[5])),multiply(pOutSolution[4],pFirstColumn[4])),multiply(pOutSolution[5],pFirstColumn[3])),multiply(pOutSolution[6],pFirstColumn[2])),multiply(pOutSolution[7],pFirstColumn[1]));
	factor=1.0f/(1.0f-absSqr(dotProduct));
	flippedSolution1=conjugate(pOutSolution[7]);
	flippedSolution2=conjugate(pOutSolution[6]);
	flippedSolution3=conjugate(pOutSolution[5]);
	flippedSolution4=conjugate(pOutSolution[4]);
	flippedSolution5=conjugate(pOutSolution[3]);
	flippedSolution6=conjugate(pOutSolution[2]);
	flippedSolution7=conjugate(pOutSolution[1]);
	flippedSolution8=(float_complex){pOutSolution[0].x,0.0f};
	pOutSolution[0]=(float_complex){factor*pOutSolution[0].x,0.0f};
	pOutSolution[1]=multiply_mixed(factor,(subtract(pOutSolution[1],multiply(flippedSolution1,dotProduct))));
	pOutSolution[2]=multiply_mixed(factor,(subtract(pOutSolution[2],multiply(flippedSolution2,dotProduct))));
	pOutSolution[3]=multiply_mixed(factor,(subtract(pOutSolution[3],multiply(flippedSolution3,dotProduct))));
	pOutSolution[4]=multiply_mixed(factor,(subtract(pOutSolution[4],multiply(flippedSolution4,dotProduct))));
	pOutSolution[5]=multiply_mixed(factor,(subtract(pOutSolution[5],multiply(flippedSolution5,dotProduct))));
	pOutSolution[6]=multiply_mixed(factor,(subtract(pOutSolution[6],multiply(flippedSolution6,dotProduct))));
	pOutSolution[7]=multiply_mixed(factor,(subtract(pOutSolution[7],multiply(flippedSolution7,dotProduct))));
	pOutSolution[8]=multiply_mixed(factor,(negate(multiply_mixed(flippedSolution8.x,dotProduct))));
}


void computeAutocorrelation2(float_complex pOutAutocorrelation[2],const float_complex pSignal[2]){
	pOutAutocorrelation[0]=add(multiply(pSignal[0],conjugate(pSignal[0])),multiply(pSignal[1],conjugate(pSignal[1])));
	pOutAutocorrelation[1]=multiply(pSignal[0],conjugate(pSignal[1]));
}

void computeAutocorrelation3(float_complex pOutAutocorrelation[3],const float_complex pSignal[3]){
	pOutAutocorrelation[0]=add(add(multiply(pSignal[0],conjugate(pSignal[0])),multiply(pSignal[1],conjugate(pSignal[1]))),multiply(pSignal[2],conjugate(pSignal[2])));
	pOutAutocorrelation[1]=add(multiply(pSignal[0],conjugate(pSignal[1])),multiply(pSignal[1],conjugate(pSignal[2])));
	pOutAutocorrelation[2]=multiply(pSignal[0],conjugate(pSignal[2]));
}

void computeAutocorrelation4(float_complex pOutAutocorrelation[4],const float_complex pSignal[4]){
	pOutAutocorrelation[0]=add(add(add(multiply(pSignal[0],conjugate(pSignal[0])),multiply(pSignal[1],conjugate(pSignal[1]))),multiply(pSignal[2],conjugate(pSignal[2]))),multiply(pSignal[3],conjugate(pSignal[3])));
	pOutAutocorrelation[1]=add(add(multiply(pSignal[0],conjugate(pSignal[1])),multiply(pSignal[1],conjugate(pSignal[2]))),multiply(pSignal[2],conjugate(pSignal[3])));
	pOutAutocorrelation[2]=add(multiply(pSignal[0],conjugate(pSignal[2])),multiply(pSignal[1],conjugate(pSignal[3])));
	pOutAutocorrelation[3]=multiply(pSignal[0],conjugate(pSignal[3]));
}

void computeAutocorrelation5(float_complex pOutAutocorrelation[5],const float_complex pSignal[5]){
	pOutAutocorrelation[0]=add(add(add(add(multiply(pSignal[0],conjugate(pSignal[0])),multiply(pSignal[1],conjugate(pSignal[1]))),multiply(pSignal[2],conjugate(pSignal[2]))),multiply(pSignal[3],conjugate(pSignal[3]))),multiply(pSignal[4],conjugate(pSignal[4])));
	pOutAutocorrelation[1]=add(add(add(multiply(pSignal[0],conjugate(pSignal[1])),multiply(pSignal[1],conjugate(pSignal[2]))),multiply(pSignal[2],conjugate(pSignal[3]))),multiply(pSignal[3],conjugate(pSignal[4])));
	pOutAutocorrelation[2]=add(add(multiply(pSignal[0],conjugate(pSignal[2])),multiply(pSignal[1],conjugate(pSignal[3]))),multiply(pSignal[2],conjugate(pSignal[4])));
	pOutAutocorrelation[3]=add(multiply(pSignal[0],conjugate(pSignal[3])),multiply(pSignal[1],conjugate(pSignal[4])));
	pOutAutocorrelation[4]=multiply(pSignal[0],conjugate(pSignal[4]));
}

void computeAutocorrelation6(float_complex pOutAutocorrelation[6],const float_complex pSignal[6]){
	pOutAutocorrelation[0]=add(add(add(add(add(multiply(pSignal[0],conjugate(pSignal[0])),multiply(pSignal[1],conjugate(pSignal[1]))),multiply(pSignal[2],conjugate(pSignal[2]))),multiply(pSignal[3],conjugate(pSignal[3]))),multiply(pSignal[4],conjugate(pSignal[4]))),multiply(pSignal[5],conjugate(pSignal[5])));
	pOutAutocorrelation[1]=add(add(add(add(multiply(pSignal[0],conjugate(pSignal[1])),multiply(pSignal[1],conjugate(pSignal[2]))),multiply(pSignal[2],conjugate(pSignal[3]))),multiply(pSignal[3],conjugate(pSignal[4]))),multiply(pSignal[4],conjugate(pSignal[5])));
	pOutAutocorrelation[2]=add(add(add(multiply(pSignal[0],conjugate(pSignal[2])),multiply(pSignal[1],conjugate(pSignal[3]))),multiply(pSignal[2],conjugate(pSignal[4]))),multiply(pSignal[3],conjugate(pSignal[5])));
	pOutAutocorrelation[3]=add(add(multiply(pSignal[0],conjugate(pSignal[3])),multiply(pSignal[1],conjugate(pSignal[4]))),multiply(pSignal[2],conjugate(pSignal[5])));
	pOutAutocorrelation[4]=add(multiply(pSignal[0],conjugate(pSignal[4])),multiply(pSignal[1],conjugate(pSignal[5])));
	pOutAutocorrelation[5]=multiply(pSignal[0],conjugate(pSignal[5]));
}

void computeAutocorrelation7(float_complex pOutAutocorrelation[7],const float_complex pSignal[7]){
	pOutAutocorrelation[0]=add(add(add(add(add(add(multiply(pSignal[0],conjugate(pSignal[0])),multiply(pSignal[1],conjugate(pSignal[1]))),multiply(pSignal[2],conjugate(pSignal[2]))),multiply(pSignal[3],conjugate(pSignal[3]))),multiply(pSignal[4],conjugate(pSignal[4]))),multiply(pSignal[5],conjugate(pSignal[5]))),multiply(pSignal[6],conjugate(pSignal[6])));
	pOutAutocorrelation[1]=add(add(add(add(add(multiply(pSignal[0],conjugate(pSignal[1])),multiply(pSignal[1],conjugate(pSignal[2]))),multiply(pSignal[2],conjugate(pSignal[3]))),multiply(pSignal[3],conjugate(pSignal[4]))),multiply(pSignal[4],conjugate(pSignal[5]))),multiply(pSignal[5],conjugate(pSignal[6])));
	pOutAutocorrelation[2]=add(add(add(add(multiply(pSignal[0],conjugate(pSignal[2])),multiply(pSignal[1],conjugate(pSignal[3]))),multiply(pSignal[2],conjugate(pSignal[4]))),multiply(pSignal[3],conjugate(pSignal[5]))),multiply(pSignal[4],conjugate(pSignal[6])));
	pOutAutocorrelation[3]=add(add(add(multiply(pSignal[0],conjugate(pSignal[3])),multiply(pSignal[1],conjugate(pSignal[4]))),multiply(pSignal[2],conjugate(pSignal[5]))),multiply(pSignal[3],conjugate(pSignal[6])));
	pOutAutocorrelation[4]=add(add(multiply(pSignal[0],conjugate(pSignal[4])),multiply(pSignal[1],conjugate(pSignal[5]))),multiply(pSignal[2],conjugate(pSignal[6])));
	pOutAutocorrelation[5]=add(multiply(pSignal[0],conjugate(pSignal[5])),multiply(pSignal[1],conjugate(pSignal[6])));
	pOutAutocorrelation[6]=multiply(pSignal[0],conjugate(pSignal[6]));
}

void computeAutocorrelation8(float_complex pOutAutocorrelation[8],const float_complex pSignal[8]){
	pOutAutocorrelation[0]=add(add(add(add(add(add(add(multiply(pSignal[0],conjugate(pSignal[0])),multiply(pSignal[1],conjugate(pSignal[1]))),multiply(pSignal[2],conjugate(pSignal[2]))),multiply(pSignal[3],conjugate(pSignal[3]))),multiply(pSignal[4],conjugate(pSignal[4]))),multiply(pSignal[5],conjugate(pSignal[5]))),multiply(pSignal[6],conjugate(pSignal[6]))),multiply(pSignal[7],conjugate(pSignal[7])));
	pOutAutocorrelation[1]=add(add(add(add(add(add(multiply(pSignal[0],conjugate(pSignal[1])),multiply(pSignal[1],conjugate(pSignal[2]))),multiply(pSignal[2],conjugate(pSignal[3]))),multiply(pSignal[3],conjugate(pSignal[4]))),multiply(pSignal[4],conjugate(pSignal[5]))),multiply(pSignal[5],conjugate(pSignal[6]))),multiply(pSignal[6],conjugate(pSignal[7])));
	pOutAutocorrelation[2]=add(add(add(add(add(multiply(pSignal[0],conjugate(pSignal[2])),multiply(pSignal[1],conjugate(pSignal[3]))),multiply(pSignal[2],conjugate(pSignal[4]))),multiply(pSignal[3],conjugate(pSignal[5]))),multiply(pSignal[4],conjugate(pSignal[6]))),multiply(pSignal[5],conjugate(pSignal[7])));
	pOutAutocorrelation[3]=add(add(add(add(multiply(pSignal[0],conjugate(pSignal[3])),multiply(pSignal[1],conjugate(pSignal[4]))),multiply(pSignal[2],conjugate(pSignal[5]))),multiply(pSignal[3],conjugate(pSignal[6]))),multiply(pSignal[4],conjugate(pSignal[7])));
	pOutAutocorrelation[4]=add(add(add(multiply(pSignal[0],conjugate(pSignal[4])),multiply(pSignal[1],conjugate(pSignal[5]))),multiply(pSignal[2],conjugate(pSignal[6]))),multiply(pSignal[3],conjugate(pSignal[7])));
	pOutAutocorrelation[5]=add(add(multiply(pSignal[0],conjugate(pSignal[5])),multiply(pSignal[1],conjugate(pSignal[6]))),multiply(pSignal[2],conjugate(pSignal[7])));
	pOutAutocorrelation[6]=add(multiply(pSignal[0],conjugate(pSignal[6])),multiply(pSignal[1],conjugate(pSignal[7])));
	pOutAutocorrelation[7]=multiply(pSignal[0],conjugate(pSignal[7]));
}

void computeAutocorrelation9(float_complex pOutAutocorrelation[9],const float_complex pSignal[9]){
	pOutAutocorrelation[0]=add(add(add(add(add(add(add(add(multiply(pSignal[0],conjugate(pSignal[0])),multiply(pSignal[1],conjugate(pSignal[1]))),multiply(pSignal[2],conjugate(pSignal[2]))),multiply(pSignal[3],conjugate(pSignal[3]))),multiply(pSignal[4],conjugate(pSignal[4]))),multiply(pSignal[5],conjugate(pSignal[5]))),multiply(pSignal[6],conjugate(pSignal[6]))),multiply(pSignal[7],conjugate(pSignal[7]))),multiply(pSignal[8],conjugate(pSignal[8])));
	pOutAutocorrelation[1]=add(add(add(add(add(add(add(multiply(pSignal[0],conjugate(pSignal[1])),multiply(pSignal[1],conjugate(pSignal[2]))),multiply(pSignal[2],conjugate(pSignal[3]))),multiply(pSignal[3],conjugate(pSignal[4]))),multiply(pSignal[4],conjugate(pSignal[5]))),multiply(pSignal[5],conjugate(pSignal[6]))),multiply(pSignal[6],conjugate(pSignal[7]))),multiply(pSignal[7],conjugate(pSignal[8])));
	pOutAutocorrelation[2]=add(add(add(add(add(add(multiply(pSignal[0],conjugate(pSignal[2])),multiply(pSignal[1],conjugate(pSignal[3]))),multiply(pSignal[2],conjugate(pSignal[4]))),multiply(pSignal[3],conjugate(pSignal[5]))),multiply(pSignal[4],conjugate(pSignal[6]))),multiply(pSignal[5],conjugate(pSignal[7]))),multiply(pSignal[6],conjugate(pSignal[8])));
	pOutAutocorrelation[3]=add(add(add(add(add(multiply(pSignal[0],conjugate(pSignal[3])),multiply(pSignal[1],conjugate(pSignal[4]))),multiply(pSignal[2],conjugate(pSignal[5]))),multiply(pSignal[3],conjugate(pSignal[6]))),multiply(pSignal[4],conjugate(pSignal[7]))),multiply(pSignal[5],conjugate(pSignal[8])));
	pOutAutocorrelation[4]=add(add(add(add(multiply(pSignal[0],conjugate(pSignal[4])),multiply(pSignal[1],conjugate(pSignal[5]))),multiply(pSignal[2],conjugate(pSignal[6]))),multiply(pSignal[3],conjugate(pSignal[7]))),multiply(pSignal[4],conjugate(pSignal[8])));
	pOutAutocorrelation[5]=add(add(add(multiply(pSignal[0],conjugate(pSignal[5])),multiply(pSignal[1],conjugate(pSignal[6]))),multiply(pSignal[2],conjugate(pSignal[7]))),multiply(pSignal[3],conjugate(pSignal[8])));
	pOutAutocorrelation[6]=add(add(multiply(pSignal[0],conjugate(pSignal[6])),multiply(pSignal[1],conjugate(pSignal[7]))),multiply(pSignal[2],conjugate(pSignal[8])));
	pOutAutocorrelation[7]=add(multiply(pSignal[0],conjugate(pSignal[7])),multiply(pSignal[1],conjugate(pSignal[8])));
	pOutAutocorrelation[8]=multiply(pSignal[0],conjugate(pSignal[8]));
}


void computeCorrelation2(float_complex pOutCorrelation[2],const float_complex pLHS[2],const float_complex pRHS[2]){
	pOutCorrelation[0]=add(multiply(pLHS[0],pRHS[0]),multiply(pLHS[1],pRHS[1]));
	pOutCorrelation[1]=multiply(pLHS[1],pRHS[0]);
}

void computeCorrelation3(float_complex pOutCorrelation[3],const float_complex pLHS[3],const float_complex pRHS[3]){
	pOutCorrelation[0]=add(add(multiply(pLHS[0],pRHS[0]),multiply(pLHS[1],pRHS[1])),multiply(pLHS[2],pRHS[2]));
	pOutCorrelation[1]=add(multiply(pLHS[1],pRHS[0]),multiply(pLHS[2],pRHS[1]));
	pOutCorrelation[2]=multiply(pLHS[2],pRHS[0]);
}

void computeCorrelation4(float_complex pOutCorrelation[4],const float_complex pLHS[4],const float_complex pRHS[4]){
	pOutCorrelation[0]=add(add(add(multiply(pLHS[0],pRHS[0]),multiply(pLHS[1],pRHS[1])),multiply(pLHS[2],pRHS[2])),multiply(pLHS[3],pRHS[3]));
	pOutCorrelation[1]=add(add(multiply(pLHS[1],pRHS[0]),multiply(pLHS[2],pRHS[1])),multiply(pLHS[3],pRHS[2]));
	pOutCorrelation[2]=add(multiply(pLHS[2],pRHS[0]),multiply(pLHS[3],pRHS[1]));
	pOutCorrelation[3]=multiply(pLHS[3],pRHS[0]);
}

void computeCorrelation5(float_complex pOutCorrelation[5],const float_complex pLHS[5],const float_complex pRHS[5]){
	pOutCorrelation[0]=add(add(add(add(multiply(pLHS[0],pRHS[0]),multiply(pLHS[1],pRHS[1])),multiply(pLHS[2],pRHS[2])),multiply(pLHS[3],pRHS[3])),multiply(pLHS[4],pRHS[4]));
	pOutCorrelation[1]=add(add(add(multiply(pLHS[1],pRHS[0]),multiply(pLHS[2],pRHS[1])),multiply(pLHS[3],pRHS[2])),multiply(pLHS[4],pRHS[3]));
	pOutCorrelation[2]=add(add(multiply(pLHS[2],pRHS[0]),multiply(pLHS[3],pRHS[1])),multiply(pLHS[4],pRHS[2]));
	pOutCorrelation[3]=add(multiply(pLHS[3],pRHS[0]),multiply(pLHS[4],pRHS[1]));
	pOutCorrelation[4]=multiply(pLHS[4],pRHS[0]);
}


void computeImaginaryCorrelation3(float pOutCorrelation[3],const float_complex pLHS[3],const float_complex pRHS[3]){
	pOutCorrelation[0]=pLHS[0].x*pRHS[0].y+pLHS[0].y*pRHS[0].x+pLHS[1].x*pRHS[1].y+pLHS[1].y*pRHS[1].x+pLHS[2].x*pRHS[2].y+pLHS[2].y*pRHS[2].x;
	pOutCorrelation[1]=pLHS[1].x*pRHS[0].y+pLHS[1].y*pRHS[0].x+pLHS[2].x*pRHS[1].y+pLHS[2].y*pRHS[1].x;
	pOutCorrelation[2]=pLHS[2].x*pRHS[0].y+pLHS[2].y*pRHS[0].x;
}

void computeImaginaryCorrelation4(float pOutCorrelation[4],const float_complex pLHS[4],const float_complex pRHS[4]){
	pOutCorrelation[0]=pLHS[0].x*pRHS[0].y+pLHS[0].y*pRHS[0].x+pLHS[1].x*pRHS[1].y+pLHS[1].y*pRHS[1].x+pLHS[2].x*pRHS[2].y+pLHS[2].y*pRHS[2].x+pLHS[3].x*pRHS[3].y+pLHS[3].y*pRHS[3].x;
	pOutCorrelation[1]=pLHS[1].x*pRHS[0].y+pLHS[1].y*pRHS[0].x+pLHS[2].x*pRHS[1].y+pLHS[2].y*pRHS[1].x+pLHS[3].x*pRHS[2].y+pLHS[3].y*pRHS[2].x;
	pOutCorrelation[2]=pLHS[2].x*pRHS[0].y+pLHS[2].y*pRHS[0].x+pLHS[3].x*pRHS[1].y+pLHS[3].y*pRHS[1].x;
	pOutCorrelation[3]=pLHS[3].x*pRHS[0].y+pLHS[3].y*pRHS[0].x;
}

void computeImaginaryCorrelation5(float pOutCorrelation[5],const float_complex pLHS[5],const float_complex pRHS[5]){
	pOutCorrelation[0]=pLHS[0].x*pRHS[0].y+pLHS[0].y*pRHS[0].x+pLHS[1].x*pRHS[1].y+pLHS[1].y*pRHS[1].x+pLHS[2].x*pRHS[2].y+pLHS[2].y*pRHS[2].x+pLHS[3].x*pRHS[3].y+pLHS[3].y*pRHS[3].x+pLHS[4].x*pRHS[4].y+pLHS[4].y*pRHS[4].x;
	pOutCorrelation[1]=pLHS[1].x*pRHS[0].y+pLHS[1].y*pRHS[0].x+pLHS[2].x*pRHS[1].y+pLHS[2].y*pRHS[1].x+pLHS[3].x*pRHS[2].y+pLHS[3].y*pRHS[2].x+pLHS[4].x*pRHS[3].y+pLHS[4].y*pRHS[3].x;
	pOutCorrelation[2]=pLHS[2].x*pRHS[0].y+pLHS[2].y*pRHS[0].x+pLHS[3].x*pRHS[1].y+pLHS[3].y*pRHS[1].x+pLHS[4].x*pRHS[2].y+pLHS[4].y*pRHS[2].x;
	pOutCorrelation[3]=pLHS[3].x*pRHS[0].y+pLHS[3].y*pRHS[0].x+pLHS[4].x*pRHS[1].y+pLHS[4].y*pRHS[1].x;
	pOutCorrelation[4]=pLHS[4].x*pRHS[0].y+pLHS[4].y*pRHS[0].x;
}

void computeImaginaryCorrelation6(float pOutCorrelation[6],const float_complex pLHS[6],const float_complex pRHS[6]){
	pOutCorrelation[0]=pLHS[0].x*pRHS[0].y+pLHS[0].y*pRHS[0].x+pLHS[1].x*pRHS[1].y+pLHS[1].y*pRHS[1].x+pLHS[2].x*pRHS[2].y+pLHS[2].y*pRHS[2].x+pLHS[3].x*pRHS[3].y+pLHS[3].y*pRHS[3].x+pLHS[4].x*pRHS[4].y+pLHS[4].y*pRHS[4].x+pLHS[5].x*pRHS[5].y+pLHS[5].y*pRHS[5].x;
	pOutCorrelation[1]=pLHS[1].x*pRHS[0].y+pLHS[1].y*pRHS[0].x+pLHS[2].x*pRHS[1].y+pLHS[2].y*pRHS[1].x+pLHS[3].x*pRHS[2].y+pLHS[3].y*pRHS[2].x+pLHS[4].x*pRHS[3].y+pLHS[4].y*pRHS[3].x+pLHS[5].x*pRHS[4].y+pLHS[5].y*pRHS[4].x;
	pOutCorrelation[2]=pLHS[2].x*pRHS[0].y+pLHS[2].y*pRHS[0].x+pLHS[3].x*pRHS[1].y+pLHS[3].y*pRHS[1].x+pLHS[4].x*pRHS[2].y+pLHS[4].y*pRHS[2].x+pLHS[5].x*pRHS[3].y+pLHS[5].y*pRHS[3].x;
	pOutCorrelation[3]=pLHS[3].x*pRHS[0].y+pLHS[3].y*pRHS[0].x+pLHS[4].x*pRHS[1].y+pLHS[4].y*pRHS[1].x+pLHS[5].x*pRHS[2].y+pLHS[5].y*pRHS[2].x;
	pOutCorrelation[4]=pLHS[4].x*pRHS[0].y+pLHS[4].y*pRHS[0].x+pLHS[5].x*pRHS[1].y+pLHS[5].y*pRHS[1].x;
	pOutCorrelation[5]=pLHS[5].x*pRHS[0].y+pLHS[5].y*pRHS[0].x;
}

void computeImaginaryCorrelation7(float pOutCorrelation[7],const float_complex pLHS[7],const float_complex pRHS[7]){
	pOutCorrelation[0]=pLHS[0].x*pRHS[0].y+pLHS[0].y*pRHS[0].x+pLHS[1].x*pRHS[1].y+pLHS[1].y*pRHS[1].x+pLHS[2].x*pRHS[2].y+pLHS[2].y*pRHS[2].x+pLHS[3].x*pRHS[3].y+pLHS[3].y*pRHS[3].x+pLHS[4].x*pRHS[4].y+pLHS[4].y*pRHS[4].x+pLHS[5].x*pRHS[5].y+pLHS[5].y*pRHS[5].x+pLHS[6].x*pRHS[6].y+pLHS[6].y*pRHS[6].x;
	pOutCorrelation[1]=pLHS[1].x*pRHS[0].y+pLHS[1].y*pRHS[0].x+pLHS[2].x*pRHS[1].y+pLHS[2].y*pRHS[1].x+pLHS[3].x*pRHS[2].y+pLHS[3].y*pRHS[2].x+pLHS[4].x*pRHS[3].y+pLHS[4].y*pRHS[3].x+pLHS[5].x*pRHS[4].y+pLHS[5].y*pRHS[4].x+pLHS[6].x*pRHS[5].y+pLHS[6].y*pRHS[5].x;
	pOutCorrelation[2]=pLHS[2].x*pRHS[0].y+pLHS[2].y*pRHS[0].x+pLHS[3].x*pRHS[1].y+pLHS[3].y*pRHS[1].x+pLHS[4].x*pRHS[2].y+pLHS[4].y*pRHS[2].x+pLHS[5].x*pRHS[3].y+pLHS[5].y*pRHS[3].x+pLHS[6].x*pRHS[4].y+pLHS[6].y*pRHS[4].x;
	pOutCorrelation[3]=pLHS[3].x*pRHS[0].y+pLHS[3].y*pRHS[0].x+pLHS[4].x*pRHS[1].y+pLHS[4].y*pRHS[1].x+pLHS[5].x*pRHS[2].y+pLHS[5].y*pRHS[2].x+pLHS[6].x*pRHS[3].y+pLHS[6].y*pRHS[3].x;
	pOutCorrelation[4]=pLHS[4].x*pRHS[0].y+pLHS[4].y*pRHS[0].x+pLHS[5].x*pRHS[1].y+pLHS[5].y*pRHS[1].x+pLHS[6].x*pRHS[2].y+pLHS[6].y*pRHS[2].x;
	pOutCorrelation[5]=pLHS[5].x*pRHS[0].y+pLHS[5].y*pRHS[0].x+pLHS[6].x*pRHS[1].y+pLHS[6].y*pRHS[1].x;
	pOutCorrelation[6]=pLHS[6].x*pRHS[0].y+pLHS[6].y*pRHS[0].x;
}

void computeImaginaryCorrelation8(float pOutCorrelation[8],const float_complex pLHS[8],const float_complex pRHS[8]){
	pOutCorrelation[0]=pLHS[0].x*pRHS[0].y+pLHS[0].y*pRHS[0].x+pLHS[1].x*pRHS[1].y+pLHS[1].y*pRHS[1].x+pLHS[2].x*pRHS[2].y+pLHS[2].y*pRHS[2].x+pLHS[3].x*pRHS[3].y+pLHS[3].y*pRHS[3].x+pLHS[4].x*pRHS[4].y+pLHS[4].y*pRHS[4].x+pLHS[5].x*pRHS[5].y+pLHS[5].y*pRHS[5].x+pLHS[6].x*pRHS[6].y+pLHS[6].y*pRHS[6].x+pLHS[7].x*pRHS[7].y+pLHS[7].y*pRHS[7].x;
	pOutCorrelation[1]=pLHS[1].x*pRHS[0].y+pLHS[1].y*pRHS[0].x+pLHS[2].x*pRHS[1].y+pLHS[2].y*pRHS[1].x+pLHS[3].x*pRHS[2].y+pLHS[3].y*pRHS[2].x+pLHS[4].x*pRHS[3].y+pLHS[4].y*pRHS[3].x+pLHS[5].x*pRHS[4].y+pLHS[5].y*pRHS[4].x+pLHS[6].x*pRHS[5].y+pLHS[6].y*pRHS[5].x+pLHS[7].x*pRHS[6].y+pLHS[7].y*pRHS[6].x;
	pOutCorrelation[2]=pLHS[2].x*pRHS[0].y+pLHS[2].y*pRHS[0].x+pLHS[3].x*pRHS[1].y+pLHS[3].y*pRHS[1].x+pLHS[4].x*pRHS[2].y+pLHS[4].y*pRHS[2].x+pLHS[5].x*pRHS[3].y+pLHS[5].y*pRHS[3].x+pLHS[6].x*pRHS[4].y+pLHS[6].y*pRHS[4].x+pLHS[7].x*pRHS[5].y+pLHS[7].y*pRHS[5].x;
	pOutCorrelation[3]=pLHS[3].x*pRHS[0].y+pLHS[3].y*pRHS[0].x+pLHS[4].x*pRHS[1].y+pLHS[4].y*pRHS[1].x+pLHS[5].x*pRHS[2].y+pLHS[5].y*pRHS[2].x+pLHS[6].x*pRHS[3].y+pLHS[6].y*pRHS[3].x+pLHS[7].x*pRHS[4].y+pLHS[7].y*pRHS[4].x;
	pOutCorrelation[4]=pLHS[4].x*pRHS[0].y+pLHS[4].y*pRHS[0].x+pLHS[5].x*pRHS[1].y+pLHS[5].y*pRHS[1].x+pLHS[6].x*pRHS[2].y+pLHS[6].y*pRHS[2].x+pLHS[7].x*pRHS[3].y+pLHS[7].y*pRHS[3].x;
	pOutCorrelation[5]=pLHS[5].x*pRHS[0].y+pLHS[5].y*pRHS[0].x+pLHS[6].x*pRHS[1].y+pLHS[6].y*pRHS[1].x+pLHS[7].x*pRHS[2].y+pLHS[7].y*pRHS[2].x;
	pOutCorrelation[6]=pLHS[6].x*pRHS[0].y+pLHS[6].y*pRHS[0].x+pLHS[7].x*pRHS[1].y+pLHS[7].y*pRHS[1].x;
	pOutCorrelation[7]=pLHS[7].x*pRHS[0].y+pLHS[7].y*pRHS[0].x;
}

void computeImaginaryCorrelation9(float pOutCorrelation[9],const float_complex pLHS[9],const float_complex pRHS[9]){
	pOutCorrelation[0]=pLHS[0].x*pRHS[0].y+pLHS[0].y*pRHS[0].x+pLHS[1].x*pRHS[1].y+pLHS[1].y*pRHS[1].x+pLHS[2].x*pRHS[2].y+pLHS[2].y*pRHS[2].x+pLHS[3].x*pRHS[3].y+pLHS[3].y*pRHS[3].x+pLHS[4].x*pRHS[4].y+pLHS[4].y*pRHS[4].x+pLHS[5].x*pRHS[5].y+pLHS[5].y*pRHS[5].x+pLHS[6].x*pRHS[6].y+pLHS[6].y*pRHS[6].x+pLHS[7].x*pRHS[7].y+pLHS[7].y*pRHS[7].x+pLHS[8].x*pRHS[8].y+pLHS[8].y*pRHS[8].x;
	pOutCorrelation[1]=pLHS[1].x*pRHS[0].y+pLHS[1].y*pRHS[0].x+pLHS[2].x*pRHS[1].y+pLHS[2].y*pRHS[1].x+pLHS[3].x*pRHS[2].y+pLHS[3].y*pRHS[2].x+pLHS[4].x*pRHS[3].y+pLHS[4].y*pRHS[3].x+pLHS[5].x*pRHS[4].y+pLHS[5].y*pRHS[4].x+pLHS[6].x*pRHS[5].y+pLHS[6].y*pRHS[5].x+pLHS[7].x*pRHS[6].y+pLHS[7].y*pRHS[6].x+pLHS[8].x*pRHS[7].y+pLHS[8].y*pRHS[7].x;
	pOutCorrelation[2]=pLHS[2].x*pRHS[0].y+pLHS[2].y*pRHS[0].x+pLHS[3].x*pRHS[1].y+pLHS[3].y*pRHS[1].x+pLHS[4].x*pRHS[2].y+pLHS[4].y*pRHS[2].x+pLHS[5].x*pRHS[3].y+pLHS[5].y*pRHS[3].x+pLHS[6].x*pRHS[4].y+pLHS[6].y*pRHS[4].x+pLHS[7].x*pRHS[5].y+pLHS[7].y*pRHS[5].x+pLHS[8].x*pRHS[6].y+pLHS[8].y*pRHS[6].x;
	pOutCorrelation[3]=pLHS[3].x*pRHS[0].y+pLHS[3].y*pRHS[0].x+pLHS[4].x*pRHS[1].y+pLHS[4].y*pRHS[1].x+pLHS[5].x*pRHS[2].y+pLHS[5].y*pRHS[2].x+pLHS[6].x*pRHS[3].y+pLHS[6].y*pRHS[3].x+pLHS[7].x*pRHS[4].y+pLHS[7].y*pRHS[4].x+pLHS[8].x*pRHS[5].y+pLHS[8].y*pRHS[5].x;
	pOutCorrelation[4]=pLHS[4].x*pRHS[0].y+pLHS[4].y*pRHS[0].x+pLHS[5].x*pRHS[1].y+pLHS[5].y*pRHS[1].x+pLHS[6].x*pRHS[2].y+pLHS[6].y*pRHS[2].x+pLHS[7].x*pRHS[3].y+pLHS[7].y*pRHS[3].x+pLHS[8].x*pRHS[4].y+pLHS[8].y*pRHS[4].x;
	pOutCorrelation[5]=pLHS[5].x*pRHS[0].y+pLHS[5].y*pRHS[0].x+pLHS[6].x*pRHS[1].y+pLHS[6].y*pRHS[1].x+pLHS[7].x*pRHS[2].y+pLHS[7].y*pRHS[2].x+pLHS[8].x*pRHS[3].y+pLHS[8].y*pRHS[3].x;
	pOutCorrelation[6]=pLHS[6].x*pRHS[0].y+pLHS[6].y*pRHS[0].x+pLHS[7].x*pRHS[1].y+pLHS[7].y*pRHS[1].x+pLHS[8].x*pRHS[2].y+pLHS[8].y*pRHS[2].x;
	pOutCorrelation[7]=pLHS[7].x*pRHS[0].y+pLHS[7].y*pRHS[0].x+pLHS[8].x*pRHS[1].y+pLHS[8].y*pRHS[1].x;
	pOutCorrelation[8]=pLHS[8].x*pRHS[0].y+pLHS[8].y*pRHS[0].x;
}


float_complex evaluateFastHerglotzTransform2(const float_complex circlePoint,const float_complex pExponentialMoment[2],const float_complex pEvaluationPolynomial[2]){
	float_complex conjCirclePoint=conjugate(circlePoint);
	float polynomial1=pEvaluationPolynomial[0].x;
	float_complex polynomial0=add(pEvaluationPolynomial[1],multiply_mixed(polynomial1,conjCirclePoint));
	float_complex dotProduct=multiply_mixed(polynomial1,pExponentialMoment[1]);
	return add(pExponentialMoment[0],multiply_mixed(2.0f,divide(dotProduct,polynomial0)));
}

float_complex evaluateFastHerglotzTransform3(const float_complex circlePoint,const float_complex pExponentialMoment[3],const float_complex pEvaluationPolynomial[3]){
	float_complex conjCirclePoint=conjugate(circlePoint);
	float polynomial2=pEvaluationPolynomial[0].x;
	float_complex polynomial1=add(pEvaluationPolynomial[1],multiply_mixed(polynomial2,conjCirclePoint));
	float_complex polynomial0=add(pEvaluationPolynomial[2],multiply(conjCirclePoint,polynomial1));
	float_complex dotProduct=add(multiply(polynomial1,pExponentialMoment[1]),multiply_mixed(polynomial2,pExponentialMoment[2]));
	return add(pExponentialMoment[0],multiply_mixed(2.0f,divide(dotProduct,polynomial0)));
}

float_complex evaluateFastHerglotzTransform4(const float_complex circlePoint,const float_complex pExponentialMoment[4],const float_complex pEvaluationPolynomial[4]){
	float_complex conjCirclePoint=conjugate(circlePoint);
	float polynomial3=pEvaluationPolynomial[0].x;
	float_complex polynomial2=add(pEvaluationPolynomial[1],multiply_mixed(polynomial3,conjCirclePoint));
	float_complex polynomial1=add(pEvaluationPolynomial[2],multiply(conjCirclePoint,polynomial2));
	float_complex polynomial0=add(pEvaluationPolynomial[3],multiply(conjCirclePoint,polynomial1));
	float_complex dotProduct=add(add(multiply(polynomial1,pExponentialMoment[1]),multiply(polynomial2,pExponentialMoment[2])),multiply_mixed(polynomial3,pExponentialMoment[3]));
	return add(pExponentialMoment[0],multiply_mixed(2.0f,divide(dotProduct,polynomial0)));
}

float_complex evaluateFastHerglotzTransform5(const float_complex circlePoint,const float_complex pExponentialMoment[5],const float_complex pEvaluationPolynomial[5]){
	float_complex conjCirclePoint=conjugate(circlePoint);
	float polynomial4=pEvaluationPolynomial[0].x;
	float_complex polynomial3=add(pEvaluationPolynomial[1],multiply_mixed(polynomial4,conjCirclePoint));
	float_complex polynomial2=add(pEvaluationPolynomial[2],multiply(conjCirclePoint,polynomial3));
	float_complex polynomial1=add(pEvaluationPolynomial[3],multiply(conjCirclePoint,polynomial2));
	float_complex polynomial0=add(pEvaluationPolynomial[4],multiply(conjCirclePoint,polynomial1));
	float_complex dotProduct=add(add(add(multiply(polynomial1,pExponentialMoment[1]),multiply(polynomial2,pExponentialMoment[2])),multiply(polynomial3,pExponentialMoment[3])),multiply_mixed(polynomial4,pExponentialMoment[4]));
	return add(pExponentialMoment[0],multiply_mixed(2.0f,divide(dotProduct,polynomial0)));
}

float_complex evaluateFastHerglotzTransform6(const float_complex circlePoint,const float_complex pExponentialMoment[6],const float_complex pEvaluationPolynomial[6]){
	float_complex conjCirclePoint=conjugate(circlePoint);
	float polynomial5=pEvaluationPolynomial[0].x;
	float_complex polynomial4=add(pEvaluationPolynomial[1],multiply_mixed(polynomial5,conjCirclePoint));
	float_complex polynomial3=add(pEvaluationPolynomial[2],multiply(conjCirclePoint,polynomial4));
	float_complex polynomial2=add(pEvaluationPolynomial[3],multiply(conjCirclePoint,polynomial3));
	float_complex polynomial1=add(pEvaluationPolynomial[4],multiply(conjCirclePoint,polynomial2));
	float_complex polynomial0=add(pEvaluationPolynomial[5],multiply(conjCirclePoint,polynomial1));
	float_complex dotProduct=add(add(add(add(multiply(polynomial1,pExponentialMoment[1]),multiply(polynomial2,pExponentialMoment[2])),multiply(polynomial3,pExponentialMoment[3])),multiply(polynomial4,pExponentialMoment[4])),multiply_mixed(polynomial5,pExponentialMoment[5]));
	return add(pExponentialMoment[0],multiply_mixed(2.0f,divide(dotProduct,polynomial0)));
}

float_complex evaluateFastHerglotzTransform7(const float_complex circlePoint,const float_complex pExponentialMoment[7],const float_complex pEvaluationPolynomial[7]){
	float_complex conjCirclePoint=conjugate(circlePoint);
	float polynomial6=pEvaluationPolynomial[0].x;
	float_complex polynomial5=add(pEvaluationPolynomial[1],multiply_mixed(polynomial6,conjCirclePoint));
	float_complex polynomial4=add(pEvaluationPolynomial[2],multiply(conjCirclePoint,polynomial5));
	float_complex polynomial3=add(pEvaluationPolynomial[3],multiply(conjCirclePoint,polynomial4));
	float_complex polynomial2=add(pEvaluationPolynomial[4],multiply(conjCirclePoint,polynomial3));
	float_complex polynomial1=add(pEvaluationPolynomial[5],multiply(conjCirclePoint,polynomial2));
	float_complex polynomial0=add(pEvaluationPolynomial[6],multiply(conjCirclePoint,polynomial1));
	float_complex dotProduct=add(add(add(add(add(multiply(polynomial1,pExponentialMoment[1]),multiply(polynomial2,pExponentialMoment[2])),multiply(polynomial3,pExponentialMoment[3])),multiply(polynomial4,pExponentialMoment[4])),multiply(polynomial5,pExponentialMoment[5])),multiply_mixed(polynomial6,pExponentialMoment[6]));
	return add(pExponentialMoment[0],multiply_mixed(2.0f,divide(dotProduct,polynomial0)));
}

float_complex evaluateFastHerglotzTransform8(const float_complex circlePoint,const float_complex pExponentialMoment[8],const float_complex pEvaluationPolynomial[8]){
	float_complex conjCirclePoint=conjugate(circlePoint);
	float polynomial7=pEvaluationPolynomial[0].x;
	float_complex polynomial6=add(pEvaluationPolynomial[1],multiply_mixed(polynomial7,conjCirclePoint));
	float_complex polynomial5=add(pEvaluationPolynomial[2],multiply(conjCirclePoint,polynomial6));
	float_complex polynomial4=add(pEvaluationPolynomial[3],multiply(conjCirclePoint,polynomial5));
	float_complex polynomial3=add(pEvaluationPolynomial[4],multiply(conjCirclePoint,polynomial4));
	float_complex polynomial2=add(pEvaluationPolynomial[5],multiply(conjCirclePoint,polynomial3));
	float_complex polynomial1=add(pEvaluationPolynomial[6],multiply(conjCirclePoint,polynomial2));
	float_complex polynomial0=add(pEvaluationPolynomial[7],multiply(conjCirclePoint,polynomial1));
	float_complex dotProduct=add(add(add(add(add(add(multiply(polynomial1,pExponentialMoment[1]),multiply(polynomial2,pExponentialMoment[2])),multiply(polynomial3,pExponentialMoment[3])),multiply(polynomial4,pExponentialMoment[4])),multiply(polynomial5,pExponentialMoment[5])),multiply(polynomial6,pExponentialMoment[6])),multiply_mixed(polynomial7,pExponentialMoment[7]));
	return add(pExponentialMoment[0],multiply_mixed(2.0f,divide(dotProduct,polynomial0)));
}

float_complex evaluateFastHerglotzTransform9(const float_complex circlePoint,const float_complex pExponentialMoment[9],const float_complex pEvaluationPolynomial[9]){
	float_complex conjCirclePoint=conjugate(circlePoint);
	float polynomial8=pEvaluationPolynomial[0].x;
	float_complex polynomial7=add(pEvaluationPolynomial[1],multiply_mixed(polynomial8,conjCirclePoint));
	float_complex polynomial6=add(pEvaluationPolynomial[2],multiply(conjCirclePoint,polynomial7));
	float_complex polynomial5=add(pEvaluationPolynomial[3],multiply(conjCirclePoint,polynomial6));
	float_complex polynomial4=add(pEvaluationPolynomial[4],multiply(conjCirclePoint,polynomial5));
	float_complex polynomial3=add(pEvaluationPolynomial[5],multiply(conjCirclePoint,polynomial4));
	float_complex polynomial2=add(pEvaluationPolynomial[6],multiply(conjCirclePoint,polynomial3));
	float_complex polynomial1=add(pEvaluationPolynomial[7],multiply(conjCirclePoint,polynomial2));
	float_complex polynomial0=add(pEvaluationPolynomial[8],multiply(conjCirclePoint,polynomial1));
	float_complex dotProduct=add(add(add(add(add(add(add(multiply(polynomial1,pExponentialMoment[1]),multiply(polynomial2,pExponentialMoment[2])),multiply(polynomial3,pExponentialMoment[3])),multiply(polynomial4,pExponentialMoment[4])),multiply(polynomial5,pExponentialMoment[5])),multiply(polynomial6,pExponentialMoment[6])),multiply(polynomial7,pExponentialMoment[7])),multiply_mixed(polynomial8,pExponentialMoment[8]));
	return add(pExponentialMoment[0],multiply_mixed(2.0f,divide(dotProduct,polynomial0)));
}


float evaluateFourierSeries2(const float_complex circlePoint,const float_complex pFourierCoefficient[2]){
	// Minimize sequential dependencies by computing powers of circlePoint
	// by multiplying previous powers by powers of two
	float_complex circlePointPower1=circlePoint;
	float result=pFourierCoefficient[1].x*circlePointPower1.x-pFourierCoefficient[1].y*circlePointPower1.y;
	return 2.0f*result+pFourierCoefficient[0].x;
}

float evaluateFourierSeries3(const float_complex circlePoint,const float_complex pFourierCoefficient[3]){
	// Minimize sequential dependencies by computing powers of circlePoint
	// by multiplying previous powers by powers of two
	float_complex circlePointPower1=circlePoint;
	float_complex circlePointPower2=multiply(circlePointPower1,circlePointPower1);
	float result=pFourierCoefficient[1].x*circlePointPower1.x-pFourierCoefficient[1].y*circlePointPower1.y+pFourierCoefficient[2].x*circlePointPower2.x-pFourierCoefficient[2].y*circlePointPower2.y;
	return 2.0f*result+pFourierCoefficient[0].x;
}

float evaluateFourierSeries4(const float_complex circlePoint,const float_complex pFourierCoefficient[4]){
	// Minimize sequential dependencies by computing powers of circlePoint
	// by multiplying previous powers by powers of two
	float_complex circlePointPower1=circlePoint;
	float_complex circlePointPower2=multiply(circlePointPower1,circlePointPower1);
	float_complex circlePointPower3=multiply(circlePointPower1,circlePointPower2);
	float result=pFourierCoefficient[1].x*circlePointPower1.x-pFourierCoefficient[1].y*circlePointPower1.y+pFourierCoefficient[2].x*circlePointPower2.x-pFourierCoefficient[2].y*circlePointPower2.y+pFourierCoefficient[3].x*circlePointPower3.x-pFourierCoefficient[3].y*circlePointPower3.y;
	return 2.0f*result+pFourierCoefficient[0].x;
}

float evaluateFourierSeries5(const float_complex circlePoint,const float_complex pFourierCoefficient[5]){
	// Minimize sequential dependencies by computing powers of circlePoint
	// by multiplying previous powers by powers of two
	float_complex circlePointPower1=circlePoint;
	float_complex circlePointPower2=multiply(circlePointPower1,circlePointPower1);
	float_complex circlePointPower3=multiply(circlePointPower1,circlePointPower2);
	float_complex circlePointPower4=multiply(circlePointPower2,circlePointPower2);
	float result=pFourierCoefficient[1].x*circlePointPower1.x-pFourierCoefficient[1].y*circlePointPower1.y+pFourierCoefficient[2].x*circlePointPower2.x-pFourierCoefficient[2].y*circlePointPower2.y+pFourierCoefficient[3].x*circlePointPower3.x-pFourierCoefficient[3].y*circlePointPower3.y+pFourierCoefficient[4].x*circlePointPower4.x-pFourierCoefficient[4].y*circlePointPower4.y;
	return 2.0f*result+pFourierCoefficient[0].x;
}


float evaluateFourierSeriesReal3(const float_complex circlePoint,const float pFourierCoefficient[3]){
	// Minimize sequential dependencies by computing powers of circlePoint
	// by multiplying previous powers by powers of two
	float_complex circlePointPower1=circlePoint;
	float_complex circlePointPower2=multiply(circlePointPower1,circlePointPower1);
	float result=pFourierCoefficient[1]*circlePointPower1.x+pFourierCoefficient[2]*circlePointPower2.x;
	return 2.0f*result+pFourierCoefficient[0];
}

float evaluateFourierSeriesReal4(const float_complex circlePoint,const float pFourierCoefficient[4]){
	// Minimize sequential dependencies by computing powers of circlePoint
	// by multiplying previous powers by powers of two
	float_complex circlePointPower1=circlePoint;
	float_complex circlePointPower2=multiply(circlePointPower1,circlePointPower1);
	float_complex circlePointPower3=multiply(circlePointPower1,circlePointPower2);
	float result=pFourierCoefficient[1]*circlePointPower1.x+pFourierCoefficient[2]*circlePointPower2.x+pFourierCoefficient[3]*circlePointPower3.x;
	return 2.0f*result+pFourierCoefficient[0];
}

float evaluateFourierSeriesReal5(const float_complex circlePoint,const float pFourierCoefficient[5]){
	// Minimize sequential dependencies by computing powers of circlePoint
	// by multiplying previous powers by powers of two
	float_complex circlePointPower1=circlePoint;
	float_complex circlePointPower2=multiply(circlePointPower1,circlePointPower1);
	float_complex circlePointPower3=multiply(circlePointPower1,circlePointPower2);
	float_complex circlePointPower4=multiply(circlePointPower2,circlePointPower2);
	float result=pFourierCoefficient[1]*circlePointPower1.x+pFourierCoefficient[2]*circlePointPower2.x+pFourierCoefficient[3]*circlePointPower3.x+pFourierCoefficient[4]*circlePointPower4.x;
	return 2.0f*result+pFourierCoefficient[0];
}

float evaluateFourierSeriesReal6(const float_complex circlePoint,const float pFourierCoefficient[6]){
	// Minimize sequential dependencies by computing powers of circlePoint
	// by multiplying previous powers by powers of two
	float_complex circlePointPower1=circlePoint;
	float_complex circlePointPower2=multiply(circlePointPower1,circlePointPower1);
	float_complex circlePointPower3=multiply(circlePointPower1,circlePointPower2);
	float_complex circlePointPower4=multiply(circlePointPower2,circlePointPower2);
	float_complex circlePointPower5=multiply(circlePointPower1,circlePointPower4);
	float result=pFourierCoefficient[1]*circlePointPower1.x+pFourierCoefficient[2]*circlePointPower2.x+pFourierCoefficient[3]*circlePointPower3.x+pFourierCoefficient[4]*circlePointPower4.x+pFourierCoefficient[5]*circlePointPower5.x;
	return 2.0f*result+pFourierCoefficient[0];
}

float evaluateFourierSeriesReal7(const float_complex circlePoint,const float pFourierCoefficient[7]){
	// Minimize sequential dependencies by computing powers of circlePoint
	// by multiplying previous powers by powers of two
	float_complex circlePointPower1=circlePoint;
	float_complex circlePointPower2=multiply(circlePointPower1,circlePointPower1);
	float_complex circlePointPower3=multiply(circlePointPower1,circlePointPower2);
	float_complex circlePointPower4=multiply(circlePointPower2,circlePointPower2);
	float_complex circlePointPower5=multiply(circlePointPower1,circlePointPower4);
	float_complex circlePointPower6=multiply(circlePointPower2,circlePointPower4);
	float result=pFourierCoefficient[1]*circlePointPower1.x+pFourierCoefficient[2]*circlePointPower2.x+pFourierCoefficient[3]*circlePointPower3.x+pFourierCoefficient[4]*circlePointPower4.x+pFourierCoefficient[5]*circlePointPower5.x+pFourierCoefficient[6]*circlePointPower6.x;
	return 2.0f*result+pFourierCoefficient[0];
}

float evaluateFourierSeriesReal8(const float_complex circlePoint,const float pFourierCoefficient[8]){
	// Minimize sequential dependencies by computing powers of circlePoint
	// by multiplying previous powers by powers of two
	float_complex circlePointPower1=circlePoint;
	float_complex circlePointPower2=multiply(circlePointPower1,circlePointPower1);
	float_complex circlePointPower3=multiply(circlePointPower1,circlePointPower2);
	float_complex circlePointPower4=multiply(circlePointPower2,circlePointPower2);
	float_complex circlePointPower5=multiply(circlePointPower1,circlePointPower4);
	float_complex circlePointPower6=multiply(circlePointPower2,circlePointPower4);
	float_complex circlePointPower7=multiply(circlePointPower3,circlePointPower4);
	float result=pFourierCoefficient[1]*circlePointPower1.x+pFourierCoefficient[2]*circlePointPower2.x+pFourierCoefficient[3]*circlePointPower3.x+pFourierCoefficient[4]*circlePointPower4.x+pFourierCoefficient[5]*circlePointPower5.x+pFourierCoefficient[6]*circlePointPower6.x+pFourierCoefficient[7]*circlePointPower7.x;
	return 2.0f*result+pFourierCoefficient[0];
}

float evaluateFourierSeriesReal9(const float_complex circlePoint,const float pFourierCoefficient[9]){
	// Minimize sequential dependencies by computing powers of circlePoint
	// by multiplying previous powers by powers of two
	float_complex circlePointPower1=circlePoint;
	float_complex circlePointPower2=multiply(circlePointPower1,circlePointPower1);
	float_complex circlePointPower3=multiply(circlePointPower1,circlePointPower2);
	float_complex circlePointPower4=multiply(circlePointPower2,circlePointPower2);
	float_complex circlePointPower5=multiply(circlePointPower1,circlePointPower4);
	float_complex circlePointPower6=multiply(circlePointPower2,circlePointPower4);
	float_complex circlePointPower7=multiply(circlePointPower3,circlePointPower4);
	float_complex circlePointPower8=multiply(circlePointPower4,circlePointPower4);
	float result=pFourierCoefficient[1]*circlePointPower1.x+pFourierCoefficient[2]*circlePointPower2.x+pFourierCoefficient[3]*circlePointPower3.x+pFourierCoefficient[4]*circlePointPower4.x+pFourierCoefficient[5]*circlePointPower5.x+pFourierCoefficient[6]*circlePointPower6.x+pFourierCoefficient[7]*circlePointPower7.x+pFourierCoefficient[8]*circlePointPower8.x;
	return 2.0f*result+pFourierCoefficient[0];
}


void prepareReflectanceSpectrum2(float_complex pOutExponentialMoment[2],float_complex pOutEvaluationPolynomial[2],const float_complex pTrigonometricMoment[2]){
	trigonometricToExponentialMoments2(pOutExponentialMoment,pTrigonometricMoment);
	levinsonsAlgorithm2(pOutEvaluationPolynomial,pOutExponentialMoment);
	pOutEvaluationPolynomial[0]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[0]);
	pOutEvaluationPolynomial[1]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[1]);
}

void prepareReflectanceSpectrum3(float_complex pOutExponentialMoment[3],float_complex pOutEvaluationPolynomial[3],const float_complex pTrigonometricMoment[3]){
	trigonometricToExponentialMoments3(pOutExponentialMoment,pTrigonometricMoment);
	levinsonsAlgorithm3(pOutEvaluationPolynomial,pOutExponentialMoment);
	pOutEvaluationPolynomial[0]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[0]);
	pOutEvaluationPolynomial[1]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[1]);
	pOutEvaluationPolynomial[2]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[2]);
}

void prepareReflectanceSpectrum4(float_complex pOutExponentialMoment[4],float_complex pOutEvaluationPolynomial[4],const float_complex pTrigonometricMoment[4]){
	trigonometricToExponentialMoments4(pOutExponentialMoment,pTrigonometricMoment);
	levinsonsAlgorithm4(pOutEvaluationPolynomial,pOutExponentialMoment);
	pOutEvaluationPolynomial[0]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[0]);
	pOutEvaluationPolynomial[1]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[1]);
	pOutEvaluationPolynomial[2]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[2]);
	pOutEvaluationPolynomial[3]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[3]);
}

void prepareReflectanceSpectrum5(float_complex pOutExponentialMoment[5],float_complex pOutEvaluationPolynomial[5],const float_complex pTrigonometricMoment[5]){
	trigonometricToExponentialMoments5(pOutExponentialMoment,pTrigonometricMoment);
	levinsonsAlgorithm5(pOutEvaluationPolynomial,pOutExponentialMoment);
	pOutEvaluationPolynomial[0]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[0]);
	pOutEvaluationPolynomial[1]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[1]);
	pOutEvaluationPolynomial[2]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[2]);
	pOutEvaluationPolynomial[3]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[3]);
	pOutEvaluationPolynomial[4]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[4]);
}

void prepareReflectanceSpectrumReal3(float_complex pOutExponentialMoment[3],float_complex pOutEvaluationPolynomial[3],const float pTrigonometricMoment[3]){
	trigonometricToExponentialMomentsReal3(pOutExponentialMoment,pTrigonometricMoment);
	levinsonsAlgorithm3(pOutEvaluationPolynomial,pOutExponentialMoment);
	pOutEvaluationPolynomial[0]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[0]);
	pOutEvaluationPolynomial[1]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[1]);
	pOutEvaluationPolynomial[2]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[2]);
}

void prepareReflectanceSpectrumReal4(float_complex pOutExponentialMoment[4],float_complex pOutEvaluationPolynomial[4],const float pTrigonometricMoment[4]){
	trigonometricToExponentialMomentsReal4(pOutExponentialMoment,pTrigonometricMoment);
	levinsonsAlgorithm4(pOutEvaluationPolynomial,pOutExponentialMoment);
	pOutEvaluationPolynomial[0]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[0]);
	pOutEvaluationPolynomial[1]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[1]);
	pOutEvaluationPolynomial[2]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[2]);
	pOutEvaluationPolynomial[3]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[3]);
}

void prepareReflectanceSpectrumReal5(float_complex pOutExponentialMoment[5],float_complex pOutEvaluationPolynomial[5],const float pTrigonometricMoment[5]){
	trigonometricToExponentialMomentsReal5(pOutExponentialMoment,pTrigonometricMoment);
	levinsonsAlgorithm5(pOutEvaluationPolynomial,pOutExponentialMoment);
	pOutEvaluationPolynomial[0]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[0]);
	pOutEvaluationPolynomial[1]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[1]);
	pOutEvaluationPolynomial[2]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[2]);
	pOutEvaluationPolynomial[3]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[3]);
	pOutEvaluationPolynomial[4]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[4]);
}

void prepareReflectanceSpectrumReal6(float_complex pOutExponentialMoment[6],float_complex pOutEvaluationPolynomial[6],const float pTrigonometricMoment[6]){
	trigonometricToExponentialMomentsReal6(pOutExponentialMoment,pTrigonometricMoment);
	levinsonsAlgorithm6(pOutEvaluationPolynomial,pOutExponentialMoment);
	pOutEvaluationPolynomial[0]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[0]);
	pOutEvaluationPolynomial[1]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[1]);
	pOutEvaluationPolynomial[2]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[2]);
	pOutEvaluationPolynomial[3]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[3]);
	pOutEvaluationPolynomial[4]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[4]);
	pOutEvaluationPolynomial[5]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[5]);
}

void prepareReflectanceSpectrumReal7(float_complex pOutExponentialMoment[7],float_complex pOutEvaluationPolynomial[7],const float pTrigonometricMoment[7]){
	trigonometricToExponentialMomentsReal7(pOutExponentialMoment,pTrigonometricMoment);
	levinsonsAlgorithm7(pOutEvaluationPolynomial,pOutExponentialMoment);
	pOutEvaluationPolynomial[0]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[0]);
	pOutEvaluationPolynomial[1]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[1]);
	pOutEvaluationPolynomial[2]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[2]);
	pOutEvaluationPolynomial[3]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[3]);
	pOutEvaluationPolynomial[4]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[4]);
	pOutEvaluationPolynomial[5]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[5]);
	pOutEvaluationPolynomial[6]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[6]);
}

void prepareReflectanceSpectrumReal8(float_complex pOutExponentialMoment[8],float_complex pOutEvaluationPolynomial[8],const float pTrigonometricMoment[8]){
	trigonometricToExponentialMomentsReal8(pOutExponentialMoment,pTrigonometricMoment);
	levinsonsAlgorithm8(pOutEvaluationPolynomial,pOutExponentialMoment);
	pOutEvaluationPolynomial[0]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[0]);
	pOutEvaluationPolynomial[1]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[1]);
	pOutEvaluationPolynomial[2]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[2]);
	pOutEvaluationPolynomial[3]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[3]);
	pOutEvaluationPolynomial[4]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[4]);
	pOutEvaluationPolynomial[5]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[5]);
	pOutEvaluationPolynomial[6]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[6]);
	pOutEvaluationPolynomial[7]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[7]);
}

void prepareReflectanceSpectrumReal9(float_complex pOutExponentialMoment[9],float_complex pOutEvaluationPolynomial[9],const float pTrigonometricMoment[9]){
	trigonometricToExponentialMomentsReal9(pOutExponentialMoment,pTrigonometricMoment);
	levinsonsAlgorithm9(pOutEvaluationPolynomial,pOutExponentialMoment);
	pOutEvaluationPolynomial[0]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[0]);
	pOutEvaluationPolynomial[1]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[1]);
	pOutEvaluationPolynomial[2]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[2]);
	pOutEvaluationPolynomial[3]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[3]);
	pOutEvaluationPolynomial[4]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[4]);
	pOutEvaluationPolynomial[5]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[5]);
	pOutEvaluationPolynomial[6]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[6]);
	pOutEvaluationPolynomial[7]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[7]);
	pOutEvaluationPolynomial[8]=multiply_mixed(6.28318531f,pOutEvaluationPolynomial[8]);
}


float evaluateReflectanceSpectrum2(const float phase,const float_complex pExponentialMoment[2],const float_complex pEvaluationPolynomial[2]){
	float_complex circlePoint;
	circlePoint=(float_complex){cosf(phase),sinf(phase)};
	float_complex herglotzTransform;
	herglotzTransform=evaluateFastHerglotzTransform2(circlePoint,pExponentialMoment,pEvaluationPolynomial);
	return fast_atan(herglotzTransform.y/herglotzTransform.x)*0.318309886f+0.5f;
}

float evaluateReflectanceSpectrum3(const float phase,const float_complex pExponentialMoment[3],const float_complex pEvaluationPolynomial[3]){
	float_complex circlePoint;
	circlePoint=(float_complex){cosf(phase),sinf(phase)};
	float_complex herglotzTransform;
	herglotzTransform=evaluateFastHerglotzTransform3(circlePoint,pExponentialMoment,pEvaluationPolynomial);
	return fast_atan(herglotzTransform.y/herglotzTransform.x)*0.318309886f+0.5f;
}

float evaluateReflectanceSpectrum4(const float phase,const float_complex pExponentialMoment[4],const float_complex pEvaluationPolynomial[4]){
	float_complex circlePoint;
	circlePoint=(float_complex){cosf(phase),sinf(phase)};
	float_complex herglotzTransform;
	herglotzTransform=evaluateFastHerglotzTransform4(circlePoint,pExponentialMoment,pEvaluationPolynomial);
	return fast_atan(herglotzTransform.y/herglotzTransform.x)*0.318309886f+0.5f;
}

float evaluateReflectanceSpectrum5(const float phase,const float_complex pExponentialMoment[5],const float_complex pEvaluationPolynomial[5]){
	float_complex circlePoint;
	circlePoint=(float_complex){cosf(phase),sinf(phase)};
	float_complex herglotzTransform;
	herglotzTransform=evaluateFastHerglotzTransform5(circlePoint,pExponentialMoment,pEvaluationPolynomial);
	return fast_atan(herglotzTransform.y/herglotzTransform.x)*0.318309886f+0.5f;
}

float evaluateReflectanceSpectrum6(const float phase,const float_complex pExponentialMoment[6],const float_complex pEvaluationPolynomial[6]){
	float_complex circlePoint;
	circlePoint=(float_complex){cosf(phase),sinf(phase)};
	float_complex herglotzTransform;
	herglotzTransform=evaluateFastHerglotzTransform6(circlePoint,pExponentialMoment,pEvaluationPolynomial);
	return fast_atan(herglotzTransform.y/herglotzTransform.x)*0.318309886f+0.5f;
}

float evaluateReflectanceSpectrum7(const float phase,const float_complex pExponentialMoment[7],const float_complex pEvaluationPolynomial[7]){
	float_complex circlePoint;
	circlePoint=(float_complex){cosf(phase),sinf(phase)};
	float_complex herglotzTransform;
	herglotzTransform=evaluateFastHerglotzTransform7(circlePoint,pExponentialMoment,pEvaluationPolynomial);
	return fast_atan(herglotzTransform.y/herglotzTransform.x)*0.318309886f+0.5f;
}

float evaluateReflectanceSpectrum8(const float phase,const float_complex pExponentialMoment[8],const float_complex pEvaluationPolynomial[8]){
	float_complex circlePoint;
	circlePoint=(float_complex){cosf(phase),sinf(phase)};
	float_complex herglotzTransform;
	herglotzTransform=evaluateFastHerglotzTransform8(circlePoint,pExponentialMoment,pEvaluationPolynomial);
	return fast_atan(herglotzTransform.y/herglotzTransform.x)*0.318309886f+0.5f;
}

float evaluateReflectanceSpectrum9(const float phase,const float_complex pExponentialMoment[9],const float_complex pEvaluationPolynomial[9]){
	float_complex circlePoint;
	circlePoint=(float_complex){cosf(phase),sinf(phase)};
	float_complex herglotzTransform;
	herglotzTransform=evaluateFastHerglotzTransform9(circlePoint,pExponentialMoment,pEvaluationPolynomial);
	return fast_atan(herglotzTransform.y/herglotzTransform.x)*0.318309886f+0.5f;
}


void prepareReflectanceSpectrumLagrange2(float_complex pOutLagrangeMultiplier[2],const float_complex pTrigonometricMoment[2]){
	float_complex pExponentialMoment[2];
	trigonometricToExponentialMoments2(pExponentialMoment,pTrigonometricMoment);
	float_complex pEvaluationPolynomial[2];
	levinsonsAlgorithm2(pEvaluationPolynomial,pExponentialMoment);
	pEvaluationPolynomial[0]=multiply_mixed(6.28318531f,pEvaluationPolynomial[0]);
	pEvaluationPolynomial[1]=multiply_mixed(6.28318531f,pEvaluationPolynomial[1]);
	float_complex pAutocorrelation[2];
	computeAutocorrelation2(pAutocorrelation,pEvaluationPolynomial);
	pExponentialMoment[0]=multiply_mixed(0.5f,pExponentialMoment[0]);
	computeCorrelation2(pOutLagrangeMultiplier,pAutocorrelation,pExponentialMoment);
	float normalizationFactor=1.0f/(3.14159265f*pEvaluationPolynomial[0].x);
	pOutLagrangeMultiplier[0]=multiply_mixed(normalizationFactor,(multiply((float_complex){-0.0f,-1.0f},pOutLagrangeMultiplier[0])));
	pOutLagrangeMultiplier[1]=multiply_mixed(normalizationFactor,(multiply((float_complex){-0.0f,-1.0f},pOutLagrangeMultiplier[1])));
	pOutLagrangeMultiplier[0]=(float_complex){pOutLagrangeMultiplier[0].x,0.0f};
}

void prepareReflectanceSpectrumLagrange3(float_complex pOutLagrangeMultiplier[3],const float_complex pTrigonometricMoment[3]){
	float_complex pExponentialMoment[3];
	trigonometricToExponentialMoments3(pExponentialMoment,pTrigonometricMoment);
	float_complex pEvaluationPolynomial[3];
	levinsonsAlgorithm3(pEvaluationPolynomial,pExponentialMoment);
	pEvaluationPolynomial[0]=multiply_mixed(6.28318531f,pEvaluationPolynomial[0]);
	pEvaluationPolynomial[1]=multiply_mixed(6.28318531f,pEvaluationPolynomial[1]);
	pEvaluationPolynomial[2]=multiply_mixed(6.28318531f,pEvaluationPolynomial[2]);
	float_complex pAutocorrelation[3];
	computeAutocorrelation3(pAutocorrelation,pEvaluationPolynomial);
	pExponentialMoment[0]=multiply_mixed(0.5f,pExponentialMoment[0]);
	computeCorrelation3(pOutLagrangeMultiplier,pAutocorrelation,pExponentialMoment);
	float normalizationFactor=1.0f/(3.14159265f*pEvaluationPolynomial[0].x);
	pOutLagrangeMultiplier[0]=multiply_mixed(normalizationFactor,(multiply((float_complex){-0.0f,-1.0f},pOutLagrangeMultiplier[0])));
	pOutLagrangeMultiplier[1]=multiply_mixed(normalizationFactor,(multiply((float_complex){-0.0f,-1.0f},pOutLagrangeMultiplier[1])));
	pOutLagrangeMultiplier[2]=multiply_mixed(normalizationFactor,(multiply((float_complex){-0.0f,-1.0f},pOutLagrangeMultiplier[2])));
	pOutLagrangeMultiplier[0]=(float_complex){pOutLagrangeMultiplier[0].x,0.0f};
}

void prepareReflectanceSpectrumLagrange4(float_complex pOutLagrangeMultiplier[4],const float_complex pTrigonometricMoment[4]){
	float_complex pExponentialMoment[4];
	trigonometricToExponentialMoments4(pExponentialMoment,pTrigonometricMoment);
	float_complex pEvaluationPolynomial[4];
	levinsonsAlgorithm4(pEvaluationPolynomial,pExponentialMoment);
	pEvaluationPolynomial[0]=multiply_mixed(6.28318531f,pEvaluationPolynomial[0]);
	pEvaluationPolynomial[1]=multiply_mixed(6.28318531f,pEvaluationPolynomial[1]);
	pEvaluationPolynomial[2]=multiply_mixed(6.28318531f,pEvaluationPolynomial[2]);
	pEvaluationPolynomial[3]=multiply_mixed(6.28318531f,pEvaluationPolynomial[3]);
	float_complex pAutocorrelation[4];
	computeAutocorrelation4(pAutocorrelation,pEvaluationPolynomial);
	pExponentialMoment[0]=multiply_mixed(0.5f,pExponentialMoment[0]);
	computeCorrelation4(pOutLagrangeMultiplier,pAutocorrelation,pExponentialMoment);
	float normalizationFactor=1.0f/(3.14159265f*pEvaluationPolynomial[0].x);
	pOutLagrangeMultiplier[0]=multiply_mixed(normalizationFactor,(multiply((float_complex){-0.0f,-1.0f},pOutLagrangeMultiplier[0])));
	pOutLagrangeMultiplier[1]=multiply_mixed(normalizationFactor,(multiply((float_complex){-0.0f,-1.0f},pOutLagrangeMultiplier[1])));
	pOutLagrangeMultiplier[2]=multiply_mixed(normalizationFactor,(multiply((float_complex){-0.0f,-1.0f},pOutLagrangeMultiplier[2])));
	pOutLagrangeMultiplier[3]=multiply_mixed(normalizationFactor,(multiply((float_complex){-0.0f,-1.0f},pOutLagrangeMultiplier[3])));
	pOutLagrangeMultiplier[0]=(float_complex){pOutLagrangeMultiplier[0].x,0.0f};
}

void prepareReflectanceSpectrumLagrange5(float_complex pOutLagrangeMultiplier[5],const float_complex pTrigonometricMoment[5]){
	float_complex pExponentialMoment[5];
	trigonometricToExponentialMoments5(pExponentialMoment,pTrigonometricMoment);
	float_complex pEvaluationPolynomial[5];
	levinsonsAlgorithm5(pEvaluationPolynomial,pExponentialMoment);
	pEvaluationPolynomial[0]=multiply_mixed(6.28318531f,pEvaluationPolynomial[0]);
	pEvaluationPolynomial[1]=multiply_mixed(6.28318531f,pEvaluationPolynomial[1]);
	pEvaluationPolynomial[2]=multiply_mixed(6.28318531f,pEvaluationPolynomial[2]);
	pEvaluationPolynomial[3]=multiply_mixed(6.28318531f,pEvaluationPolynomial[3]);
	pEvaluationPolynomial[4]=multiply_mixed(6.28318531f,pEvaluationPolynomial[4]);
	float_complex pAutocorrelation[5];
	computeAutocorrelation5(pAutocorrelation,pEvaluationPolynomial);
	pExponentialMoment[0]=multiply_mixed(0.5f,pExponentialMoment[0]);
	computeCorrelation5(pOutLagrangeMultiplier,pAutocorrelation,pExponentialMoment);
	float normalizationFactor=1.0f/(3.14159265f*pEvaluationPolynomial[0].x);
	pOutLagrangeMultiplier[0]=multiply_mixed(normalizationFactor,(multiply((float_complex){-0.0f,-1.0f},pOutLagrangeMultiplier[0])));
	pOutLagrangeMultiplier[1]=multiply_mixed(normalizationFactor,(multiply((float_complex){-0.0f,-1.0f},pOutLagrangeMultiplier[1])));
	pOutLagrangeMultiplier[2]=multiply_mixed(normalizationFactor,(multiply((float_complex){-0.0f,-1.0f},pOutLagrangeMultiplier[2])));
	pOutLagrangeMultiplier[3]=multiply_mixed(normalizationFactor,(multiply((float_complex){-0.0f,-1.0f},pOutLagrangeMultiplier[3])));
	pOutLagrangeMultiplier[4]=multiply_mixed(normalizationFactor,(multiply((float_complex){-0.0f,-1.0f},pOutLagrangeMultiplier[4])));
	pOutLagrangeMultiplier[0]=(float_complex){pOutLagrangeMultiplier[0].x,0.0f};
}

void prepareReflectanceSpectrumLagrangeReal3(float pOutLagrangeMultiplier[3],const float pTrigonometricMoment[3]){
	float_complex pExponentialMoment[3];
	trigonometricToExponentialMomentsReal3(pExponentialMoment,pTrigonometricMoment);
	float_complex pEvaluationPolynomial[3];
	levinsonsAlgorithm3(pEvaluationPolynomial,pExponentialMoment);
	pEvaluationPolynomial[0]=multiply_mixed(6.28318531f,pEvaluationPolynomial[0]);
	pEvaluationPolynomial[1]=multiply_mixed(6.28318531f,pEvaluationPolynomial[1]);
	pEvaluationPolynomial[2]=multiply_mixed(6.28318531f,pEvaluationPolynomial[2]);
	float_complex pAutocorrelation[3];
	computeAutocorrelation3(pAutocorrelation,pEvaluationPolynomial);
	pExponentialMoment[0]=multiply_mixed(0.5f,pExponentialMoment[0]);
	computeImaginaryCorrelation3(pOutLagrangeMultiplier,pAutocorrelation,pExponentialMoment);
	float normalizationFactor=1.0f/(3.14159265f*pEvaluationPolynomial[0].x);
	pOutLagrangeMultiplier[0]=normalizationFactor*pOutLagrangeMultiplier[0];
	pOutLagrangeMultiplier[1]=normalizationFactor*pOutLagrangeMultiplier[1];
	pOutLagrangeMultiplier[2]=normalizationFactor*pOutLagrangeMultiplier[2];
}

void prepareReflectanceSpectrumLagrangeReal4(float pOutLagrangeMultiplier[4],const float pTrigonometricMoment[4]){
	float_complex pExponentialMoment[4];
	trigonometricToExponentialMomentsReal4(pExponentialMoment,pTrigonometricMoment);
	float_complex pEvaluationPolynomial[4];
	levinsonsAlgorithm4(pEvaluationPolynomial,pExponentialMoment);
	pEvaluationPolynomial[0]=multiply_mixed(6.28318531f,pEvaluationPolynomial[0]);
	pEvaluationPolynomial[1]=multiply_mixed(6.28318531f,pEvaluationPolynomial[1]);
	pEvaluationPolynomial[2]=multiply_mixed(6.28318531f,pEvaluationPolynomial[2]);
	pEvaluationPolynomial[3]=multiply_mixed(6.28318531f,pEvaluationPolynomial[3]);
	float_complex pAutocorrelation[4];
	computeAutocorrelation4(pAutocorrelation,pEvaluationPolynomial);
	pExponentialMoment[0]=multiply_mixed(0.5f,pExponentialMoment[0]);
	computeImaginaryCorrelation4(pOutLagrangeMultiplier,pAutocorrelation,pExponentialMoment);
	float normalizationFactor=1.0f/(3.14159265f*pEvaluationPolynomial[0].x);
	pOutLagrangeMultiplier[0]=normalizationFactor*pOutLagrangeMultiplier[0];
	pOutLagrangeMultiplier[1]=normalizationFactor*pOutLagrangeMultiplier[1];
	pOutLagrangeMultiplier[2]=normalizationFactor*pOutLagrangeMultiplier[2];
	pOutLagrangeMultiplier[3]=normalizationFactor*pOutLagrangeMultiplier[3];
}

void prepareReflectanceSpectrumLagrangeReal5(float pOutLagrangeMultiplier[5],const float pTrigonometricMoment[5]){
	float_complex pExponentialMoment[5];
	trigonometricToExponentialMomentsReal5(pExponentialMoment,pTrigonometricMoment);
	float_complex pEvaluationPolynomial[5];
	levinsonsAlgorithm5(pEvaluationPolynomial,pExponentialMoment);
	pEvaluationPolynomial[0]=multiply_mixed(6.28318531f,pEvaluationPolynomial[0]);
	pEvaluationPolynomial[1]=multiply_mixed(6.28318531f,pEvaluationPolynomial[1]);
	pEvaluationPolynomial[2]=multiply_mixed(6.28318531f,pEvaluationPolynomial[2]);
	pEvaluationPolynomial[3]=multiply_mixed(6.28318531f,pEvaluationPolynomial[3]);
	pEvaluationPolynomial[4]=multiply_mixed(6.28318531f,pEvaluationPolynomial[4]);
	float_complex pAutocorrelation[5];
	computeAutocorrelation5(pAutocorrelation,pEvaluationPolynomial);
	pExponentialMoment[0]=multiply_mixed(0.5f,pExponentialMoment[0]);
	computeImaginaryCorrelation5(pOutLagrangeMultiplier,pAutocorrelation,pExponentialMoment);
	float normalizationFactor=1.0f/(3.14159265f*pEvaluationPolynomial[0].x);
	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];
}

void prepareReflectanceSpectrumLagrangeReal6(float pOutLagrangeMultiplier[6],const float pTrigonometricMoment[6]){
	float_complex pExponentialMoment[6];
	trigonometricToExponentialMomentsReal6(pExponentialMoment,pTrigonometricMoment);
	float_complex pEvaluationPolynomial[6];
	levinsonsAlgorithm6(pEvaluationPolynomial,pExponentialMoment);
	pEvaluationPolynomial[0]=multiply_mixed(6.28318531f,pEvaluationPolynomial[0]);
	pEvaluationPolynomial[1]=multiply_mixed(6.28318531f,pEvaluationPolynomial[1]);
	pEvaluationPolynomial[2]=multiply_mixed(6.28318531f,pEvaluationPolynomial[2]);
	pEvaluationPolynomial[3]=multiply_mixed(6.28318531f,pEvaluationPolynomial[3]);
	pEvaluationPolynomial[4]=multiply_mixed(6.28318531f,pEvaluationPolynomial[4]);
	pEvaluationPolynomial[5]=multiply_mixed(6.28318531f,pEvaluationPolynomial[5]);
	float_complex pAutocorrelation[6];
	computeAutocorrelation6(pAutocorrelation,pEvaluationPolynomial);
	pExponentialMoment[0]=multiply_mixed(0.5f,pExponentialMoment[0]);
	computeImaginaryCorrelation6(pOutLagrangeMultiplier,pAutocorrelation,pExponentialMoment);
	float normalizationFactor=1.0f/(3.14159265f*pEvaluationPolynomial[0].x);
	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];
}

void prepareReflectanceSpectrumLagrangeReal7(float pOutLagrangeMultiplier[7],const float pTrigonometricMoment[7]){
	float_complex pExponentialMoment[7];
	trigonometricToExponentialMomentsReal7(pExponentialMoment,pTrigonometricMoment);
	float_complex pEvaluationPolynomial[7];
	levinsonsAlgorithm7(pEvaluationPolynomial,pExponentialMoment);
	pEvaluationPolynomial[0]=multiply_mixed(6.28318531f,pEvaluationPolynomial[0]);
	pEvaluationPolynomial[1]=multiply_mixed(6.28318531f,pEvaluationPolynomial[1]);
	pEvaluationPolynomial[2]=multiply_mixed(6.28318531f,pEvaluationPolynomial[2]);
	pEvaluationPolynomial[3]=multiply_mixed(6.28318531f,pEvaluationPolynomial[3]);
	pEvaluationPolynomial[4]=multiply_mixed(6.28318531f,pEvaluationPolynomial[4]);
	pEvaluationPolynomial[5]=multiply_mixed(6.28318531f,pEvaluationPolynomial[5]);
	pEvaluationPolynomial[6]=multiply_mixed(6.28318531f,pEvaluationPolynomial[6]);
	float_complex pAutocorrelation[7];
	computeAutocorrelation7(pAutocorrelation,pEvaluationPolynomial);
	pExponentialMoment[0]=multiply_mixed(0.5f,pExponentialMoment[0]);
	computeImaginaryCorrelation7(pOutLagrangeMultiplier,pAutocorrelation,pExponentialMoment);
	float normalizationFactor=1.0f/(3.14159265f*pEvaluationPolynomial[0].x);
	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];
}

void prepareReflectanceSpectrumLagrangeReal8(float pOutLagrangeMultiplier[8],const float pTrigonometricMoment[8]){
	float_complex pExponentialMoment[8];
	trigonometricToExponentialMomentsReal8(pExponentialMoment,pTrigonometricMoment);
	float_complex pEvaluationPolynomial[8];
	levinsonsAlgorithm8(pEvaluationPolynomial,pExponentialMoment);
	pEvaluationPolynomial[0]=multiply_mixed(6.28318531f,pEvaluationPolynomial[0]);
	pEvaluationPolynomial[1]=multiply_mixed(6.28318531f,pEvaluationPolynomial[1]);
	pEvaluationPolynomial[2]=multiply_mixed(6.28318531f,pEvaluationPolynomial[2]);
	pEvaluationPolynomial[3]=multiply_mixed(6.28318531f,pEvaluationPolynomial[3]);
	pEvaluationPolynomial[4]=multiply_mixed(6.28318531f,pEvaluationPolynomial[4]);
	pEvaluationPolynomial[5]=multiply_mixed(6.28318531f,pEvaluationPolynomial[5]);
	pEvaluationPolynomial[6]=multiply_mixed(6.28318531f,pEvaluationPolynomial[6]);
	pEvaluationPolynomial[7]=multiply_mixed(6.28318531f,pEvaluationPolynomial[7]);
	float_complex pAutocorrelation[8];
	computeAutocorrelation8(pAutocorrelation,pEvaluationPolynomial);
	pExponentialMoment[0]=multiply_mixed(0.5f,pExponentialMoment[0]);
	computeImaginaryCorrelation8(pOutLagrangeMultiplier,pAutocorrelation,pExponentialMoment);
	float normalizationFactor=1.0f/(3.14159265f*pEvaluationPolynomial[0].x);
	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];
}

void prepareReflectanceSpectrumLagrangeReal9(float pOutLagrangeMultiplier[9],const float pTrigonometricMoment[9]){
	float_complex pExponentialMoment[9];
	trigonometricToExponentialMomentsReal9(pExponentialMoment,pTrigonometricMoment);
	float_complex pEvaluationPolynomial[9];
	levinsonsAlgorithm9(pEvaluationPolynomial,pExponentialMoment);
	pEvaluationPolynomial[0]=multiply_mixed(6.28318531f,pEvaluationPolynomial[0]);
	pEvaluationPolynomial[1]=multiply_mixed(6.28318531f,pEvaluationPolynomial[1]);
	pEvaluationPolynomial[2]=multiply_mixed(6.28318531f,pEvaluationPolynomial[2]);
	pEvaluationPolynomial[3]=multiply_mixed(6.28318531f,pEvaluationPolynomial[3]);
	pEvaluationPolynomial[4]=multiply_mixed(6.28318531f,pEvaluationPolynomial[4]);
	pEvaluationPolynomial[5]=multiply_mixed(6.28318531f,pEvaluationPolynomial[5]);
	pEvaluationPolynomial[6]=multiply_mixed(6.28318531f,pEvaluationPolynomial[6]);
	pEvaluationPolynomial[7]=multiply_mixed(6.28318531f,pEvaluationPolynomial[7]);
	pEvaluationPolynomial[8]=multiply_mixed(6.28318531f,pEvaluationPolynomial[8]);
	float_complex pAutocorrelation[9];
	computeAutocorrelation9(pAutocorrelation,pEvaluationPolynomial);
	pExponentialMoment[0]=multiply_mixed(0.5f,pExponentialMoment[0]);
	computeImaginaryCorrelation9(pOutLagrangeMultiplier,pAutocorrelation,pExponentialMoment);
	float normalizationFactor=1.0f/(3.14159265f*pEvaluationPolynomial[0].x);
	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];
}


float evaluateReflectanceSpectrumLagrange2(const float phase,const float_complex pLagrangeMultiplier[2]){
	float_complex conjCirclePoint;
	conjCirclePoint=(float_complex){cosf(-phase),sinf(-phase)};
	float lagrangeSeries;
	lagrangeSeries=evaluateFourierSeries2(conjCirclePoint,pLagrangeMultiplier);
	return fast_atan(lagrangeSeries)*0.318309886f+0.5f;
}

float evaluateReflectanceSpectrumLagrange3(const float phase,const float_complex pLagrangeMultiplier[3]){
	float_complex conjCirclePoint;
	conjCirclePoint=(float_complex){cosf(-phase),sinf(-phase)};
	float lagrangeSeries;
	lagrangeSeries=evaluateFourierSeries3(conjCirclePoint,pLagrangeMultiplier);
	return fast_atan(lagrangeSeries)*0.318309886f+0.5f;
}

float evaluateReflectanceSpectrumLagrange4(const float phase,const float_complex pLagrangeMultiplier[4]){
	float_complex conjCirclePoint;
	conjCirclePoint=(float_complex){cosf(-phase),sinf(-phase)};
	float lagrangeSeries;
	lagrangeSeries=evaluateFourierSeries4(conjCirclePoint,pLagrangeMultiplier);
	return fast_atan(lagrangeSeries)*0.318309886f+0.5f;
}

float evaluateReflectanceSpectrumLagrange5(const float phase,const float_complex pLagrangeMultiplier[5]){
	float_complex conjCirclePoint;
	conjCirclePoint=(float_complex){cosf(-phase),sinf(-phase)};
	float lagrangeSeries;
	lagrangeSeries=evaluateFourierSeries5(conjCirclePoint,pLagrangeMultiplier);
	return fast_atan(lagrangeSeries)*0.318309886f+0.5f;
}

float evaluateReflectanceSpectrumLagrangeReal3(const float phase,const float pLagrangeMultiplier[3]){
	float_complex conjCirclePoint;
	conjCirclePoint=(float_complex){cosf(-phase),sinf(-phase)};
	float lagrangeSeries;
	lagrangeSeries=evaluateFourierSeriesReal3(conjCirclePoint,pLagrangeMultiplier);
	return fast_atan(lagrangeSeries)*0.318309886f+0.5f;
}

float evaluateReflectanceSpectrumLagrangeReal4(const float phase,const float pLagrangeMultiplier[4]){
	float_complex conjCirclePoint;
	conjCirclePoint=(float_complex){cosf(-phase),sinf(-phase)};
	float lagrangeSeries;
	lagrangeSeries=evaluateFourierSeriesReal4(conjCirclePoint,pLagrangeMultiplier);
	return fast_atan(lagrangeSeries)*0.318309886f+0.5f;
}

float evaluateReflectanceSpectrumLagrangeReal5(const float phase,const float pLagrangeMultiplier[5]){
	float_complex conjCirclePoint;
	conjCirclePoint=(float_complex){cosf(-phase),sinf(-phase)};
	float lagrangeSeries;
	lagrangeSeries=evaluateFourierSeriesReal5(conjCirclePoint,pLagrangeMultiplier);
	return fast_atan(lagrangeSeries)*0.318309886f+0.5f;
}

float evaluateReflectanceSpectrumLagrangeReal6(const float phase,const float pLagrangeMultiplier[6]){
	float_complex conjCirclePoint;
	conjCirclePoint=(float_complex){cosf(-phase),sinf(-phase)};
	float lagrangeSeries;
	lagrangeSeries=evaluateFourierSeriesReal6(conjCirclePoint,pLagrangeMultiplier);
	return fast_atan(lagrangeSeries)*0.318309886f+0.5f;
}

float evaluateReflectanceSpectrumLagrangeReal7(const float phase,const float pLagrangeMultiplier[7]){
	float_complex conjCirclePoint;
	conjCirclePoint=(float_complex){cosf(-phase),sinf(-phase)};
	float lagrangeSeries;
	lagrangeSeries=evaluateFourierSeriesReal7(conjCirclePoint,pLagrangeMultiplier);
	return fast_atan(lagrangeSeries)*0.318309886f+0.5f;
}

float evaluateReflectanceSpectrumLagrangeReal8(const float phase,const float pLagrangeMultiplier[8]){
	float_complex conjCirclePoint;
	conjCirclePoint=(float_complex){cosf(-phase),sinf(-phase)};
	float lagrangeSeries;
	lagrangeSeries=evaluateFourierSeriesReal8(conjCirclePoint,pLagrangeMultiplier);
	return fast_atan(lagrangeSeries)*0.318309886f+0.5f;
}

float evaluateReflectanceSpectrumLagrangeReal9(const float phase,const float pLagrangeMultiplier[9]){
	float_complex conjCirclePoint;
	conjCirclePoint=(float_complex){cosf(-phase),sinf(-phase)};
	float lagrangeSeries;
	lagrangeSeries=evaluateFourierSeriesReal9(conjCirclePoint,pLagrangeMultiplier);
	return fast_atan(lagrangeSeries)*0.318309886f+0.5f;
}


