// ---------------------------------------------------------------------
//
// Copyright (C) 1998 - 2018 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.md at
// the top level directory of deal.II.
//
// ---------------------------------------------------------------------



// real instantiations

for (S : REAL_SCALARS)
  {
    template class ChunkSparseMatrix<S>;
  }



for (S1, S2 : REAL_SCALARS)
  {
    template ChunkSparseMatrix<S1> &ChunkSparseMatrix<S1>::copy_from<S2>(
      const ChunkSparseMatrix<S2> &);

    template void ChunkSparseMatrix<S1>::copy_from<S2>(const FullMatrix<S2> &);

    template void ChunkSparseMatrix<S1>::add<S2>(const S1,
                                                 const ChunkSparseMatrix<S2> &);
  }


for (S1, S2 : REAL_SCALARS)
  {
    template S2 ChunkSparseMatrix<S1>::matrix_norm_square<S2>(
      const Vector<S2> &) const;

    template S2 ChunkSparseMatrix<S1>::matrix_scalar_product<S2>(
      const Vector<S2> &, const Vector<S2> &) const;

    template S2 ChunkSparseMatrix<S1>::residual<S2>(Vector<S2> &,
                                                    const Vector<S2> &,
                                                    const Vector<S2> &) const;

    template void ChunkSparseMatrix<S1>::precondition_SSOR<S2>(
      Vector<S2> &, const Vector<S2> &, const S1) const;

    template void ChunkSparseMatrix<S1>::precondition_SOR<S2>(
      Vector<S2> &, const Vector<S2> &, const S1) const;

    template void ChunkSparseMatrix<S1>::precondition_TSOR<S2>(
      Vector<S2> &, const Vector<S2> &, const S1) const;

    template void ChunkSparseMatrix<S1>::precondition_Jacobi<S2>(
      Vector<S2> &, const Vector<S2> &, const S1) const;

    template void ChunkSparseMatrix<S1>::SOR<S2>(Vector<S2> &, const S1) const;
    template void ChunkSparseMatrix<S1>::TSOR<S2>(Vector<S2> &, const S1) const;
    template void ChunkSparseMatrix<S1>::SSOR<S2>(Vector<S2> &, const S1) const;
    template void ChunkSparseMatrix<S1>::PSOR<S2>(
      Vector<S2> &,
      const std::vector<types::global_dof_index> &,
      const std::vector<types::global_dof_index> &,
      const S1) const;
    template void ChunkSparseMatrix<S1>::TPSOR<S2>(
      Vector<S2> &,
      const std::vector<types::global_dof_index> &,
      const std::vector<types::global_dof_index> &,
      const S1) const;
    template void ChunkSparseMatrix<S1>::SOR_step<S2>(Vector<S2> &,
                                                      const Vector<S2> &,
                                                      const S1) const;
    template void ChunkSparseMatrix<S1>::TSOR_step<S2>(Vector<S2> &,
                                                       const Vector<S2> &,
                                                       const S1) const;
    template void ChunkSparseMatrix<S1>::SSOR_step<S2>(Vector<S2> &,
                                                       const Vector<S2> &,
                                                       const S1) const;
  }


for (S1, S2, S3 : REAL_SCALARS; V1, V2 : DEAL_II_VEC_TEMPLATES)
  {
    template void ChunkSparseMatrix<S1>::vmult(V1<S2> &, const V2<S3> &) const;
    template void ChunkSparseMatrix<S1>::Tvmult(V1<S2> &, const V2<S3> &) const;
    template void ChunkSparseMatrix<S1>::vmult_add(V1<S2> &, const V2<S3> &)
      const;
    template void ChunkSparseMatrix<S1>::Tvmult_add(V1<S2> &, const V2<S3> &)
      const;
  }



// complex instantiations

// for (S : COMPLEX_SCALARS)
//   {
//     template class ChunkSparseMatrix<S>;
//   }



// for (S1, S2 : COMPLEX_SCALARS)
//   {
//     template ChunkSparseMatrix<S1> &
//       ChunkSparseMatrix<S1>::copy_from<S2> (const ChunkSparseMatrix<S2> &);

//     template
//       void ChunkSparseMatrix<S1>::copy_from<S2> (const FullMatrix<S2> &);

//     template void ChunkSparseMatrix<S1>::add<S2> (const S1,
// 					     const ChunkSparseMatrix<S2> &);
//   }


// for (S1, S2 : COMPLEX_SCALARS)
//   {
//     template S2
//       ChunkSparseMatrix<S1>::
//       matrix_norm_square<S2> (const Vector<S2> &) const;

//     template S2
//       ChunkSparseMatrix<S1>::
//       matrix_scalar_product<S2> (const Vector<S2> &,
// 				 const Vector<S2> &) const;

//     template S2 ChunkSparseMatrix<S1>::
//       residual<S2> (Vector<S2> &,
// 		    const Vector<S2> &,
// 		    const Vector<S2> &) const;

//     template void ChunkSparseMatrix<S1>::
//       precondition_SSOR<S2> (Vector<S2> &,
// 			     const Vector<S2> &,
// 			     const S1) const;

//     template void ChunkSparseMatrix<S1>::
//       precondition_SOR<S2> (Vector<S2> &,
// 			    const Vector<S2> &,
// 			    const S1) const;

//     template void ChunkSparseMatrix<S1>::
//       precondition_TSOR<S2> (Vector<S2> &,
// 			     const Vector<S2> &,
// 			     const S1) const;

//     template void ChunkSparseMatrix<S1>::
//       precondition_Jacobi<S2> (Vector<S2> &,
// 			       const Vector<S2> &,
// 			       const S1) const;

//     template void ChunkSparseMatrix<S1>::
//       SOR<S2> (Vector<S2> &,
// 	       const S1) const;
//     template void ChunkSparseMatrix<S1>::
//       TSOR<S2> (Vector<S2> &,
// 		const S1) const;
//     template void ChunkSparseMatrix<S1>::
//       SSOR<S2> (Vector<S2> &,
// 		const S1) const;
//     template void ChunkSparseMatrix<S1>::
//       PSOR<S2> (Vector<S2> &,
// 		const std::vector<types::global_dof_index>&,
// 		const std::vector<types::global_dof_index>&,
// 		const S1) const;
//     template void ChunkSparseMatrix<S1>::
//       TPSOR<S2> (Vector<S2> &,
// 		 const std::vector<types::global_dof_index>&,
// 		 const std::vector<types::global_dof_index>&,
// 		 const S1) const;
//     template void ChunkSparseMatrix<S1>::
//       SOR_step<S2> (Vector<S2> &,
// 		    const Vector<S2> &,
// 		    const S1) const;
//     template void ChunkSparseMatrix<S1>::
//       TSOR_step<S2> (Vector<S2> &,
// 		     const Vector<S2> &,
// 		     const S1) const;
//     template void ChunkSparseMatrix<S1>::
//       SSOR_step<S2> (Vector<S2> &,
// 		     const Vector<S2> &,
// 		     const S1) const;
//   }


// for (S1, S2, S3 : COMPLEX_SCALARS;
//      V1, V2     : DEAL_II_VEC_TEMPLATES)
//   {
//     template void ChunkSparseMatrix<S1>::
//       vmult (V1<S2> &, const V2<S3> &) const;
//     template void ChunkSparseMatrix<S1>::
//       Tvmult (V1<S2> &, const V2<S3> &) const;
//     template void ChunkSparseMatrix<S1>::
//       vmult_add (V1<S2> &, const V2<S3> &) const;
//     template void ChunkSparseMatrix<S1>::
//       Tvmult_add (V1<S2> &, const V2<S3> &) const;
//   }
