validate-legendre.cpp 731 Bytes
#include <complex>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include "rts/legendre.h"

#include "compare.h"

typedef float precision;
int l = 0;


void cpuValidateLegendre()
{

	//order
	precision v = 5;
	precision vm;

	//parameter
	precision max_z = 2;
	int nz = 20;
	precision dz = max_z / nz;

	//bessel function results (first and second kind)
	int S = sizeof(precision) * (v + 1);

	precision* P = (precision*)malloc(S);


    std::cout<<"---------j_v(x)-------------"<<std::endl;
	precision z;
	for(int iz = 0; iz < nz; iz++)
	{
		z = iz * dz - 1.0;

		rts::legendre<precision>(v, z, P);

		std::cout<<z<<", "<<P[0]<<", "<<P[1]<<", "<<P[2]<<", "<<P[3]<<std::endl;

	}

}