NumCpp  2.5.1
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:
47  template<typename dtype>
48  NdArray<dtype> full(uint32 inSquareSize, dtype inFillValue)
49  {
50  NdArray<dtype> returnArray(inSquareSize, inSquareSize);
51  returnArray.fill(inFillValue);
52  return returnArray;
53  }
54 
55  //============================================================================
56  // Method Description:
67  template<typename dtype>
68  NdArray<dtype> full(uint32 inNumRows, uint32 inNumCols, dtype inFillValue)
69  {
70  NdArray<dtype> returnArray(inNumRows, inNumCols);
71  returnArray.fill(inFillValue);
72  return returnArray;
73  }
74 
75  //============================================================================
76  // Method Description:
86  template<typename dtype>
87  NdArray<dtype> full(const Shape& inShape, dtype inFillValue)
88  {
89  return full(inShape.rows, inShape.cols, inFillValue);
90  }
91 } // 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:2878
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:48
std::uint32_t uint32
Definition: Types.hpp:40