/usr/include/rheolef/jacobi_roots.icc is in librheolef-dev 6.6-1build2.
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 | /// This file is part of Rheolef.
///
/// Copyright (C) 2000-2009 Pierre Saramito
///
/// Rheolef is free software; you can redistribute it and/or modify
/// it under the terms of the GNU General Public License as published by
/// the Free Software Foundation; either version 2 of the License, or
/// (at your option) any later version.
///
/// Rheolef is distributed in the hope that it will be useful,
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/// GNU General Public License for more details.
///
/// You should have received a copy of the GNU General Public License
/// along with Rheolef; if not, write to the Free Software
/// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
/// lexer for qmg mesh files
/// =========================================================================
#include "rheolef/tqli.h"
#include "rheolef/sqr.h"
#include <vector>
#include <cmath>
#include <algorithm>
template <class Size, class T, class OutputIterator>
void jacobi_roots (Size R, T alpha, T beta, OutputIterator zeta) {
if (R == 0) { return; }
if (R == 1) { zeta [0] = (beta-alpha)/(alpha+beta+2); return; }
OutputIterator a = zeta;
a[0] = (beta-alpha)/(alpha+beta+2);
for (size_t r = 1; r < R; r++)
a[r] = (sqr(beta) - sqr(alpha))/((alpha+beta+T(2.*r))*(alpha+beta+T(2.*r+2)));
std::vector<T> b(R);
b[0] = 0.;
b[1] = 2/(alpha+beta+2)*sqrt((alpha+1)*(beta+1)/(alpha+beta+3));
for (size_t r = 2; r < R; r++)
b[r] = 2/(alpha+beta+T(2.*r))
*sqrt(T(1.*r)*(alpha+T(1.*r))*(beta+T(1.*r))*(alpha+beta+T(1.*r))/((alpha+beta+T(2.*r-1))*(alpha+beta+T(2.*r+1))));
tqli (zeta-1, b.begin()-1, R);
sort (zeta, zeta+R);
if (alpha == beta && R % 2 == 1) zeta[R/2] = 0.;
}
|