<commit_before>// ---------------------------------------------------------------------
//
// Copyright (C) 2004 - 2016 by the deal.II authors
//
// This file is part of the deal.II library.
//
// The deal.II library is free software; you can use it, redistribute
// it, and/or modify it under the terms of the GNU Lesser General
// Public License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// The full text of the license can be found in the file LICENSE at
// the top level of the deal.II distribution.
//
// ---------------------------------------------------------------------



// check PETScWrappers::Vector::l1_norm()

#include "../tests.h"
#include <deal.II/lac/petsc_vector.h>
#include <fstream>
#include <iostream>
#include <vector>


void test (PETScWrappers::Vector &v)
{
  // set some elements of the vector
  double norm = 0;
  for (unsigned int k=0; k<v.size(); k+=1+k)
    {
      const PetscScalar  s(1.*k,2.*k);
      v(k) = s;
      norm += std::abs (s);
    }
  v.compress (VectorOperation::insert);

  // then check the norm
  AssertThrow (v.l1_norm() == norm, ExcInternalError());

  deallog << "OK" << std::endl;
}


int main (int argc,char **argv)
{
  std::ofstream logfile("output");
  deallog.attach(logfile);<commit_msg>ugly fix of PETSc complex l1_norm()<commit_after>// ---------------------------------------------------------------------
//
// Copyright (C) 2004 - 2016 by the deal.II authors
//
// This file is part of the deal.II library.
//
// The deal.II library is free software; you can use it, redistribute
// it, and/or modify it under the terms of the GNU Lesser General
// Public License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// The full text of the license can be found in the file LICENSE at
// the top level of the deal.II distribution.
//
// ---------------------------------------------------------------------



// check PETScWrappers::Vector::l1_norm()

#include "../tests.h"
#include <deal.II/lac/petsc_vector.h>
#include <fstream>
#include <iostream>
#include <vector>


void test (PETScWrappers::Vector &v)
{
  // set some elements of the vector
  double norm = 0;
  for (unsigned int k=0; k<v.size(); k+=1+k)
    {
      const PetscScalar  s(1.*k,2.*k);
      v(k) = s;
#if DEAL_II_PETSC_VERSION_LT(3,7,0)
      norm += std::fabs (1.*k)+std::fabs(2.*k);
#else
      norm += std::abs (s);
#endif
    }
  v.compress (VectorOperation::insert);

  // then check the norm
  AssertThrow (v.l1_norm() == norm, ExcInternalError());

  deallog << "OK" << std::endl;
}


int main (int argc,char **argv)
{
  std::ofstream logfile("output");
  deallog.attach(logfile);
{'fraction_non_alphanumeric': 0.230990990990991, 'fraction_numerical': 0.014414414414414415, 'mean_word_length': 2.19815668202765, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 11, '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': '88720', 'n_tokens_mistral': 887, 'n_tokens_neox': 847, 'n_words': 297}