NumCpp  2.14.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
diagflat.hpp
Go to the documentation of this file.
1
28#pragma once
29
30#include <cmath>
31
33#include "NumCpp/Core/Types.hpp"
34#include "NumCpp/NdArray.hpp"
35
36namespace nc
37{
38 //============================================================================
39 // Method Description:
50 template<typename dtype>
52 {
54
55 const auto absK = static_cast<uint32>(std::abs(k));
57
58 const uint32 rowOffset = k < 0 ? absK : 0;
59 const uint32 colOffset = k > 0 ? absK : 0;
60
61 returnArray.zeros();
62 for (uint32 i = 0; i < inArray.size(); ++i)
63 {
65 }
66
67 return returnArray;
68 }
69} // namespace nc
#define STATIC_ASSERT_ARITHMETIC_OR_COMPLEX(dtype)
Definition StaticAsserts.hpp:56
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition NdArrayCore.hpp:139
Definition Cartesian.hpp:40
NdArray< dtype > arange(dtype inStart, dtype inStop, dtype inStep=1)
Definition arange.hpp:59
NdArray< dtype > diagflat(const NdArray< dtype > &inArray, int32 k=0)
Definition diagflat.hpp:51
std::int32_t int32
Definition Types.hpp:36
std::uint32_t uint32
Definition Types.hpp:40