Blame view

validate/validate-legendre.cpp 731 Bytes
f1402849   dmayerich   renewed commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
  #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;

  

  	}
  

  }