SpECTRE Documentation Coverage Report
Current view: top level - DataStructures/Tensor - Identity.hpp Hit Total Coverage
Commit: 5f37f3d7c5afe86be8ec8102ab4a768be82d2177 Lines: 1 2 50.0 %
Date: 2024-04-26 23:32:03
Legend: Lines: hit not hit

          Line data    Source code
       1           0 : // Distributed under the MIT License.
       2             : // See LICENSE.txt for details.
       3             : 
       4             : #pragma once
       5             : 
       6             : #include <cstddef>
       7             : 
       8             : #include "DataStructures/Tensor/Tensor.hpp"
       9             : #include "Utilities/MakeWithValue.hpp"
      10             : 
      11             : /// \ingroup TensorGroup
      12             : /// \brief returns the Identity matrix
      13             : template <size_t Dim, typename DataType>
      14           1 : tnsr::Ij<DataType, Dim, Frame::NoFrame> identity(
      15             :     const DataType& used_for_type) {
      16             :   auto identity_matrix{make_with_value<tnsr::Ij<DataType, Dim, Frame::NoFrame>>(
      17             :       used_for_type, 0.0)};
      18             : 
      19             :   for (size_t i = 0; i < Dim; ++i) {
      20             :     identity_matrix.get(i, i) = 1.0;
      21             :   }
      22             :   return identity_matrix;
      23             : }

Generated by: LCOV version 1.14