LCOV - code coverage report
Current view: top level - src/operator - OperatorAtom.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 9 13 69.2 %
Date: 2025-05-02 21:49:55 Functions: 4 6 66.7 %

          Line data    Source code
       1             : // SPDX-FileCopyrightText: 2024 Pairinteraction Developers
       2             : // SPDX-License-Identifier: LGPL-3.0-or-later
       3             : 
       4             : #include "pairinteraction/operator/OperatorAtom.hpp"
       5             : 
       6             : #include "pairinteraction/basis/BasisAtom.hpp"
       7             : #include "pairinteraction/database/Database.hpp"
       8             : #include "pairinteraction/enums/OperatorType.hpp"
       9             : 
      10             : #include <limits>
      11             : 
      12             : namespace pairinteraction {
      13             : template <typename Scalar>
      14         121 : OperatorAtom<Scalar>::OperatorAtom(std::shared_ptr<const basis_t> basis)
      15         121 :     : Operator<OperatorAtom<Scalar>>(std::move(basis)) {}
      16             : 
      17             : template <typename Scalar>
      18         794 : OperatorAtom<Scalar>::OperatorAtom(std::shared_ptr<const basis_t> basis, OperatorType type, int q)
      19         794 :     : Operator<OperatorAtom<Scalar>>(std::move(basis)) {
      20         794 :     if (type == OperatorType::ENERGY) {
      21         167 :         this->initialize_as_energy_operator();
      22             :     } else {
      23         627 :         this->initialize_from_matrix(
      24         627 :             this->basis->get_database().get_matrix_elements(this->basis, this->basis, type, q));
      25             :     }
      26         794 : }
      27             : 
      28             : template <typename Scalar>
      29           0 : OperatorAtom<Scalar>::OperatorAtom(std::shared_ptr<const basis_t> basis,
      30             :                                    Eigen::SparseMatrix<Scalar, Eigen::RowMajor> &&matrix)
      31           0 :     : Operator<OperatorAtom<Scalar>>(std::move(basis)) {
      32           0 :     this->matrix = std::move(matrix);
      33           0 : }
      34             : 
      35             : // Explicit instantiations
      36             : template class OperatorAtom<double>;
      37             : template class OperatorAtom<std::complex<double>>;
      38             : } // namespace pairinteraction

Generated by: LCOV version 1.16