SpECTRE Documentation Coverage Report
Current view: top level - DataStructures/Tensor - Identity.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 50.0 % 2 1
Test Date: 2026-10-22 17:29:42
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 2.0-1