<commit_before>//-----------------------------------------------------------------------------
//    $Id$
//    Version: $Name$ 
//
//    Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 by the deal.II authors
//
//    This file is subject to QPL and may not be  distributed
//    without copyright and license information. Please refer
//    to the file deal.II/doc/license.html for the  text  and
//    further information on this license.
//
//-----------------------------------------------------------------------------

// Test Lagrange interpolation

#include "../tests.h"
#include <iomanip>
#include <fstream>
#include <cmath>

#include <base/logstream.h>
#include <base/polynomial.h>
#include <base/quadrature_lib.h>

using namespace Polynomials;

void check_interpolation (const std::vector<Polynomial<double> >& p,
			  const std::vector<Point<1> >& x)
{
  for (unsigned int i=0;i<p.size();++i)
    {
      deallog << i;
      for (unsigned int k=0;k<x.size();++k)
	{
	  deallog << '.';
	  const double y = p[i].value(x[k](0));
	  if (i == k)
	    {
	      if (std::fabs(y-1.) > 2.e-10)
		deallog << "Error1  lg y=" << std::log10(std::fabs(y-1.))
			<< std::endl;
	    }
	  else
	    {
	      if (std::fabs(y) > 3.e-10)
		deallog << "Error0  lg y=" << std::log10(std::fabs(y))
			<< std::endl;
	    }
	}
      deallog << std::endl;
    }
}


void
check_poly (const Quadrature<1>& q)
{
  deallog << "Points: " << q.n_quadrature_points << std::endl;
  std::vector<Polynomial<double> > p = Lagrange::generate_complete_basis(q.get_points());
  check_interpolation(p, q.get_points());
}


void
check_lge (unsigned int n)
{
  deallog << "Points: " << n+1 << std::endl;
  std::vector<Polynomial<double> > p = LagrangeEquidistant::generate_complete_basis(n);
  std::vector<Point<1> > x(n+1);
  const double h = 1./n;
  for (unsigned int i=0;i<=n;++i)
    x[i](0) = h*i;
  check_interpolation(p, x);<commit_msg>Adjust call to new name of a function.<commit_after>//-----------------------------------------------------------------------------
//    $Id$
//    Version: $Name$ 
//
//    Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2010 by the deal.II authors
//
//    This file is subject to QPL and may not be  distributed
//    without copyright and license information. Please refer
//    to the file deal.II/doc/license.html for the  text  and
//    further information on this license.
//
//-----------------------------------------------------------------------------

// Test Lagrange interpolation

#include "../tests.h"
#include <iomanip>
#include <fstream>
#include <cmath>

#include <base/logstream.h>
#include <base/polynomial.h>
#include <base/quadrature_lib.h>

using namespace Polynomials;

void check_interpolation (const std::vector<Polynomial<double> >& p,
			  const std::vector<Point<1> >& x)
{
  for (unsigned int i=0;i<p.size();++i)
    {
      deallog << i;
      for (unsigned int k=0;k<x.size();++k)
	{
	  deallog << '.';
	  const double y = p[i].value(x[k](0));
	  if (i == k)
	    {
	      if (std::fabs(y-1.) > 2.e-10)
		deallog << "Error1  lg y=" << std::log10(std::fabs(y-1.))
			<< std::endl;
	    }
	  else
	    {
	      if (std::fabs(y) > 3.e-10)
		deallog << "Error0  lg y=" << std::log10(std::fabs(y))
			<< std::endl;
	    }
	}
      deallog << std::endl;
    }
}


void
check_poly (const Quadrature<1>& q)
{
  deallog << "Points: " << q.n_quadrature_points << std::endl;
  std::vector<Polynomial<double> > p = generate_complete_Lagrange_basis(q.get_points());
  check_interpolation(p, q.get_points());
}


void
check_lge (unsigned int n)
{
  deallog << "Points: " << n+1 << std::endl;
  std::vector<Polynomial<double> > p = LagrangeEquidistant::generate_complete_basis(n);
  std::vector<Point<1> > x(n+1);
  const double h = 1./n;
  for (unsigned int i=0;i<=n;++i)
    x[i](0) = h*i;
  check_interpolation(p, x);
{'fraction_non_alphanumeric': 0.2479253112033195, 'fraction_numerical': 0.026452282157676348, 'mean_word_length': 2.3422876949740035, 'pattern_counts': {'":': 0, '<': 103, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '952876', 'n_tokens_mistral': 1503, 'n_tokens_neox': 1391, 'n_words': 315}