/usr/lib/python2.7/dist-packages/pyopencl/cl/pyopencl-eval-tbl.cl is in python-pyopencl 2016.1+git20161130-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | // Pieced together from Boost C++ and Cephes by
// Andreas Kloeckner (C) 2012
//
// Pieces from:
//
// Copyright (c) 2006 Xiaogang Zhang, John Maddock
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See
// http://www.boost.org/LICENSE_1_0.txt)
//
// Cephes Math Library Release 2.8: June, 2000
// Copyright 1984, 1987, 1989, 1992, 2000 by Stephen L. Moshier
// What you see here may be used freely, but it comes with no support or
// guarantee.
#pragma once
typedef double special_func_scalar_type;
// {{{ cephes_polevl
/*
* DESCRIPTION:
*
* Evaluates polynomial of degree N:
*
* 2 N
* y = C + C x + C x +...+ C x
* 0 1 2 N
*
* Coefficients are stored in reverse order:
*
* coef[0] = C , ..., coef[N] = C .
* N 0
*
* The function p1evl() assumes that coef[N] = 1.0 and is
* omitted from the array. Its calling arguments are
* otherwise the same as polevl().
*
*/
special_func_scalar_type cephes_polevl(special_func_scalar_type x, __constant const special_func_scalar_type *coef, int N)
{
special_func_scalar_type ans;
int i;
__constant const special_func_scalar_type *p;
p = coef;
ans = *p++;
i = N;
do
ans = ans * x + *p++;
while( --i );
return( ans );
}
// }}}
// {{{ cephes_p1evl
special_func_scalar_type cephes_p1evl( special_func_scalar_type x, __constant const special_func_scalar_type *coef, int N )
{
special_func_scalar_type ans;
__constant const special_func_scalar_type *p;
int i;
p = coef;
ans = x + *p++;
i = N-1;
do
ans = ans * x + *p++;
while( --i );
return( ans );
}
// }}}
// {{{ boost_evaluate_rational
special_func_scalar_type boost_evaluate_rational_backend(__constant const special_func_scalar_type* num, __constant const special_func_scalar_type* denom, special_func_scalar_type z, int count)
{
special_func_scalar_type s1, s2;
if(z <= 1)
{
s1 = num[count-1];
s2 = denom[count-1];
for(int i = (int)count - 2; i >= 0; --i)
{
s1 *= z;
s2 *= z;
s1 += num[i];
s2 += denom[i];
}
}
else
{
z = 1 / z;
s1 = num[0];
s2 = denom[0];
for(unsigned i = 1; i < count; ++i)
{
s1 *= z;
s2 *= z;
s1 += num[i];
s2 += denom[i];
}
}
return s1 / s2;
}
#define boost_evaluate_rational(num, denom, z) \
boost_evaluate_rational_backend(num, denom, z, sizeof(num)/sizeof(special_func_scalar_type))
// }}}
// vim: fdm=marker
|