NumCpp  2.12.1
A Templatized Header Only C++ Implementation of the Python NumPy Library
ones.hpp
Go to the documentation of this file.
1
28#pragma once
29
31#include "NumCpp/Core/Shape.hpp"
32#include "NumCpp/Core/Types.hpp"
34#include "NumCpp/NdArray.hpp"
35
36namespace nc
37{
38 //============================================================================
39 // Method Description:
47 template<typename dtype>
49 {
51
52 return full(inSquareSize, inSquareSize, dtype{ 1 });
53 }
54
55 //============================================================================
56 // Method Description:
65 template<typename dtype>
66 NdArray<dtype> ones(uint32 inNumRows, uint32 inNumCols)
67 {
69
70 return full(inNumRows, inNumCols, dtype{ 1 });
71 }
72
73 //============================================================================
74 // Method Description:
82 template<typename dtype>
83 NdArray<dtype> ones(const Shape& inShape)
84 {
86
87 return full(inShape, dtype{ 1 });
88 }
89} // 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
A Shape Class for NdArrays.
Definition: Core/Shape.hpp:41
Definition: Cartesian.hpp:40
NdArray< dtype > ones(uint32 inSquareSize)
Definition: ones.hpp:48
NdArray< dtype > full(uint32 inSquareSize, dtype inFillValue)
Definition: full.hpp:47
std::uint32_t uint32
Definition: Types.hpp:40