1- // SPDX-FileCopyrightText: 2017 - 2025 The Ginkgo authors
1+ // SPDX-FileCopyrightText: 2017 - 2026 The Ginkgo authors
22//
33// SPDX-License-Identifier: BSD-3-Clause
44
@@ -434,10 +434,10 @@ GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE(
434434template <typename ValueType, typename IndexType>
435435void initialize_row_ptrs_l_u (
436436 std::shared_ptr<const DefaultExecutor> exec,
437- const matrix::Csr< ValueType, IndexType>* system_matrix,
437+ matrix::view::csr< const ValueType, const IndexType> system_matrix,
438438 IndexType* l_row_ptrs, IndexType* u_row_ptrs)
439439{
440- const size_type num_rows{system_matrix-> get_size () [0 ]};
440+ const size_type num_rows{system_matrix. size [0 ]};
441441
442442 const auto block_size = default_block_size;
443443 const uint32 number_blocks =
@@ -447,10 +447,8 @@ void initialize_row_ptrs_l_u(
447447 if (grid_dim > 0 ) {
448448 kernel::count_nnz_per_l_u_row<<<grid_dim, block_size, 0 ,
449449 exec->get_stream ()>>>(
450- num_rows, system_matrix->get_const_row_ptrs (),
451- system_matrix->get_const_col_idxs (),
452- as_device_type (system_matrix->get_const_values ()), l_row_ptrs,
453- u_row_ptrs);
450+ num_rows, system_matrix.row_ptrs , system_matrix.col_idxs ,
451+ as_device_type (system_matrix.values ), l_row_ptrs, u_row_ptrs);
454452 }
455453
456454 components::prefix_sum_nonnegative (exec, l_row_ptrs, num_rows + 1 );
@@ -462,12 +460,13 @@ GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE(
462460
463461
464462template <typename ValueType, typename IndexType>
465- void initialize_l_u (std::shared_ptr<const DefaultExecutor> exec,
466- const matrix::Csr<ValueType, IndexType>* system_matrix,
467- matrix::Csr<ValueType, IndexType>* csr_l,
468- matrix::Csr<ValueType, IndexType>* csr_u)
463+ void initialize_l_u (
464+ std::shared_ptr<const DefaultExecutor> exec,
465+ matrix::view::csr<const ValueType, const IndexType> system_matrix,
466+ matrix::view::csr<ValueType, IndexType> csr_l,
467+ matrix::view::csr<ValueType, IndexType> csr_u)
469468{
470- const size_type num_rows{system_matrix-> get_size () [0 ]};
469+ const size_type num_rows{system_matrix. size [0 ]};
471470 const auto block_size = helpers::default_block_size;
472471 const auto grid_dim = static_cast <uint32>(
473472 ceildiv (num_rows, static_cast <size_type>(block_size)));
@@ -480,13 +479,11 @@ void initialize_l_u(std::shared_ptr<const DefaultExecutor> exec,
480479 auto u_closure = triangular_mtx_closure (identity{}, identity{});
481480 helpers::
482481 initialize_l_u<<<grid_dim, block_size, 0 , exec->get_stream ()>>>(
483- num_rows, system_matrix->get_const_row_ptrs (),
484- system_matrix->get_const_col_idxs (),
485- as_device_type (system_matrix->get_const_values ()),
486- csr_l->get_const_row_ptrs (), csr_l->get_col_idxs (),
487- as_device_type (csr_l->get_values ()),
488- csr_u->get_const_row_ptrs (), csr_u->get_col_idxs (),
489- as_device_type (csr_u->get_values ()), l_closure, u_closure);
482+ num_rows, system_matrix.row_ptrs , system_matrix.col_idxs ,
483+ as_device_type (system_matrix.values ), csr_l.row_ptrs ,
484+ csr_l.col_idxs , as_device_type (csr_l.get_values ),
485+ csr_u.row_ptrs , csr_u.col_idxs ,
486+ as_device_type (csr_u.get_values ), l_closure, u_closure);
490487 }
491488}
492489
@@ -497,10 +494,10 @@ GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE(
497494template <typename ValueType, typename IndexType>
498495void initialize_row_ptrs_l (
499496 std::shared_ptr<const DefaultExecutor> exec,
500- const matrix::Csr< ValueType, IndexType>* system_matrix,
497+ matrix::view::csr< const ValueType, const IndexType> system_matrix,
501498 IndexType* l_row_ptrs)
502499{
503- const size_type num_rows{system_matrix-> get_size () [0 ]};
500+ const size_type num_rows{system_matrix. size [0 ]};
504501
505502 const auto block_size = default_block_size;
506503 const uint32 number_blocks =
@@ -510,9 +507,8 @@ void initialize_row_ptrs_l(
510507 if (grid_dim > 0 ) {
511508 kernel::count_nnz_per_l_row<<<grid_dim, block_size, 0 ,
512509 exec->get_stream ()>>>(
513- num_rows, system_matrix->get_const_row_ptrs (),
514- system_matrix->get_const_col_idxs (),
515- as_device_type (system_matrix->get_const_values ()), l_row_ptrs);
510+ num_rows, system_matrix.row_ptrs , system_matrix.col_idxs ,
511+ as_device_type (system_matrix.values ), l_row_ptrs);
516512 }
517513
518514 components::prefix_sum_nonnegative (exec, l_row_ptrs, num_rows + 1 );
@@ -523,11 +519,12 @@ GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE(
523519
524520
525521template <typename ValueType, typename IndexType>
526- void initialize_l (std::shared_ptr<const DefaultExecutor> exec,
527- const matrix::Csr<ValueType, IndexType>* system_matrix,
528- matrix::Csr<ValueType, IndexType>* csr_l, bool diag_sqrt)
522+ void initialize_l (
523+ std::shared_ptr<const DefaultExecutor> exec,
524+ matrix::view::csr<const ValueType, const IndexType> system_matrix,
525+ matrix::view::csr<ValueType, IndexType> csr_l, bool diag_sqrt)
529526{
530- const size_type num_rows{system_matrix-> get_size () [0 ]};
527+ const size_type num_rows{system_matrix. size [0 ]};
531528 const auto block_size = helpers::default_block_size;
532529 const auto grid_dim = static_cast <uint32>(
533530 ceildiv (num_rows, static_cast <size_type>(block_size)));
@@ -536,11 +533,9 @@ void initialize_l(std::shared_ptr<const DefaultExecutor> exec,
536533 using namespace gko ::factorization;
537534
538535 helpers::initialize_l<<<grid_dim, block_size, 0 , exec->get_stream ()>>>(
539- num_rows, system_matrix->get_const_row_ptrs (),
540- system_matrix->get_const_col_idxs (),
541- as_device_type (system_matrix->get_const_values ()),
542- csr_l->get_const_row_ptrs (), csr_l->get_col_idxs (),
543- as_device_type (csr_l->get_values ()),
536+ num_rows, system_matrix.row_ptrs , system_matrix.col_idxs ,
537+ as_device_type (system_matrix.values ), csr_l.row_ptrs ,
538+ csr_l.col_idxs , as_device_type (csr_l.values ),
544539 triangular_mtx_closure (
545540 [diag_sqrt] __device__ (auto val) {
546541 if (diag_sqrt) {
@@ -562,18 +557,18 @@ GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE(
562557template <typename ValueType, typename IndexType>
563558void symbolic_validate (
564559 std::shared_ptr<const DefaultExecutor> exec,
565- const matrix::Csr< ValueType, IndexType>* system_matrix,
566- const matrix::Csr< ValueType, IndexType>* factors,
560+ matrix::view::csr< const ValueType, const IndexType> system_matrix,
561+ matrix::view::csr< const ValueType, const IndexType> factors,
567562 const matrix::csr::lookup_data<IndexType>& factors_lookup, bool & valid)
568563{
569- const auto size = system_matrix-> get_size () [0 ];
570- const auto row_ptrs = system_matrix-> get_const_row_ptrs () ;
571- const auto col_idxs = system_matrix-> get_const_col_idxs () ;
572- const auto factor_row_ptrs = factors-> get_const_row_ptrs () ;
573- const auto factor_col_idxs = factors-> get_const_col_idxs () ;
564+ const auto size = system_matrix. size [0 ];
565+ const auto row_ptrs = system_matrix. row_ptrs ;
566+ const auto col_idxs = system_matrix. col_idxs ;
567+ const auto factor_row_ptrs = factors. row_ptrs ;
568+ const auto factor_col_idxs = factors. col_idxs ;
574569 // this stores for each factor nonzero whether it occurred as part of the
575570 // factorization.
576- array<bool > found (exec, factors-> get_num_stored_elements () );
571+ array<bool > found (exec, factors. num_stored_elements );
577572 components::fill_array (exec, found.get_data (), found.get_size (), false );
578573 // this stores for each row whether there were any elements missing
579574 array<bool > missing (exec, size);
0 commit comments