Exemplo n.º 1
0
 void apply(vector<ScalarType> & vec) const
 {
   if (viennacl::memory_domain(vec) != viennacl::MAIN_MEMORY)
   {
     viennacl::memory_types old_memory_location = viennacl::memory_domain(vec);
     viennacl::switch_memory_domain(vec, viennacl::MAIN_MEMORY);
     viennacl::linalg::inplace_solve(trans(LLT), vec, lower_tag());
     viennacl::linalg::inplace_solve(LLT, vec, upper_tag());
     viennacl::switch_memory_domain(vec, old_memory_location);
   }
   else //apply ILU0 directly:
   {
     // Note: L is stored in a column-oriented fashion, i.e. transposed w.r.t. the row-oriented layout. Thus, the factorization A = L L^T holds L in the upper triangular part of A.
     viennacl::linalg::inplace_solve(trans(LLT), vec, lower_tag());
     viennacl::linalg::inplace_solve(LLT, vec, upper_tag());
   }
 }
Exemplo n.º 2
0
  void apply(vector<NumericT> & vec) const
  {
    if (viennacl::traits::context(vec).memory_type() != viennacl::MAIN_MEMORY)
    {
      viennacl::context host_ctx(viennacl::MAIN_MEMORY);
      viennacl::context old_ctx = viennacl::traits::context(vec);

      viennacl::switch_memory_context(vec, host_ctx);
      viennacl::linalg::inplace_solve(trans(LLT), vec, lower_tag());
      viennacl::linalg::inplace_solve(      LLT , vec, upper_tag());
      viennacl::switch_memory_context(vec, old_ctx);
    }
    else //apply ILU0 directly:
    {
      // Note: L is stored in a column-oriented fashion, i.e. transposed w.r.t. the row-oriented layout. Thus, the factorization A = L L^T holds L in the upper triangular part of A.
      viennacl::linalg::inplace_solve(trans(LLT), vec, lower_tag());
      viennacl::linalg::inplace_solve(      LLT , vec, upper_tag());
    }
  }
Exemplo n.º 3
0
 void apply(VectorType & vec) const
 {
   unsigned int const * row_buffer = viennacl::linalg::host_based::detail::extract_raw_pointer<unsigned int>(LLT.handle1());
   unsigned int const * col_buffer = viennacl::linalg::host_based::detail::extract_raw_pointer<unsigned int>(LLT.handle2());
   ScalarType   const * elements   = viennacl::linalg::host_based::detail::extract_raw_pointer<ScalarType>(LLT.handle());
   
   // Note: L is stored in a column-oriented fashion, i.e. transposed w.r.t. the row-oriented layout. Thus, the factorization A = L L^T holds L in the upper triangular part of A.
   viennacl::linalg::host_based::detail::csr_trans_inplace_solve<ScalarType>(row_buffer, col_buffer, elements, vec, LLT.size2(), lower_tag());
   viennacl::linalg::host_based::detail::csr_inplace_solve<ScalarType>(row_buffer, col_buffer, elements, vec, LLT.size2(), upper_tag());
 }