NumCpp  2.8.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
full.hpp
Go to the documentation of this file.
1 #pragma once
29 
30 #include "NumCpp/Core/Shape.hpp"
31 #include "NumCpp/Core/Types.hpp"
32 #include "NumCpp/NdArray.hpp"
33 
34 namespace nc
35 {
36  //============================================================================
37  // Method Description:
46  template<typename dtype>
47  NdArray<dtype> full(uint32 inSquareSize, dtype inFillValue)
48  {
49  NdArray<dtype> returnArray(inSquareSize, inSquareSize);
50  returnArray.fill(inFillValue);
51  return returnArray;
52  }
53 
54  //============================================================================
55  // Method Description:
65  template<typename dtype>
66  NdArray<dtype> full(uint32 inNumRows, uint32 inNumCols, dtype inFillValue)
67  {
68  NdArray<dtype> returnArray(inNumRows, inNumCols);
69  returnArray.fill(inFillValue);
70  return returnArray;
71  }
72 
73  //============================================================================
74  // Method Description:
83  template<typename dtype>
84  NdArray<dtype> full(const Shape& inShape, dtype inFillValue)
85  {
86  return full(inShape.rows, inShape.cols, inFillValue);
87  }
88 } // namespace nc
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition: NdArrayCore.hpp:72
NdArray< dtype > & fill(value_type inFillValue) noexcept
Definition: NdArrayCore.hpp:2712
A Shape Class for NdArrays.
Definition: Core/Shape.hpp:41
uint32 rows
Definition: Core/Shape.hpp:44
uint32 cols
Definition: Core/Shape.hpp:45
Definition: Coordinate.hpp:45
NdArray< dtype > full(uint32 inSquareSize, dtype inFillValue)
Definition: full.hpp:47
std::uint32_t uint32
Definition: Types.hpp:40