NumCpp  2.1.0
A C++ implementation of the Python Numpy library
ones.hpp
Go to the documentation of this file.
1 #pragma once
30 
32 #include "NumCpp/Core/Shape.hpp"
33 #include "NumCpp/Core/Types.hpp"
35 #include "NumCpp/NdArray.hpp"
36 
37 namespace nc
38 {
39  //============================================================================
40  // Method Description:
49  template<typename dtype>
50  NdArray<dtype> ones(uint32 inSquareSize)
51  {
53 
54  return full(inSquareSize, inSquareSize, dtype{ 1 });
55  }
56 
57  //============================================================================
58  // Method Description:
68  template<typename dtype>
69  NdArray<dtype> ones(uint32 inNumRows, uint32 inNumCols)
70  {
72 
73  return full(inNumRows, inNumCols, dtype{ 1 });
74  }
75 
76  //============================================================================
77  // Method Description:
87  template<typename dtype>
88  NdArray<dtype> ones(const Shape& inShape)
89  {
91 
92  return full(inShape, dtype{ 1 });
93  }
94 } // namespace nc
StaticAsserts.hpp
nc::full
NdArray< dtype > full(uint32 inSquareSize, dtype inFillValue)
Definition: full.hpp:49
STATIC_ASSERT_ARITHMETIC_OR_COMPLEX
#define STATIC_ASSERT_ARITHMETIC_OR_COMPLEX(dtype)
Definition: StaticAsserts.hpp:51
nc::NdArray< dtype >
nc::uint32
std::uint32_t uint32
Definition: Types.hpp:41
NdArray.hpp
nc::Shape
A Shape Class for NdArrays.
Definition: Core/Shape.hpp:41
Shape.hpp
nc
Definition: Coordinate.hpp:45
nc::ones
NdArray< dtype > ones(uint32 inSquareSize)
Definition: ones.hpp:50
Types.hpp
full.hpp