NumCpp
2.4.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
ones.hpp
Go to the documentation of this file.
1
#pragma once
29
30
#include "
NumCpp/Core/Internal/StaticAsserts.hpp
"
31
#include "
NumCpp/Core/Shape.hpp
"
32
#include "
NumCpp/Core/Types.hpp
"
33
#include "
NumCpp/Functions/full.hpp
"
34
#include "
NumCpp/NdArray.hpp
"
35
36
namespace
nc
37
{
38
//============================================================================
39
// Method Description:
48
template
<
typename
dtype>
49
NdArray<dtype>
ones
(
uint32
inSquareSize)
50
{
51
STATIC_ASSERT_ARITHMETIC_OR_COMPLEX
(dtype);
52
53
return
full
(inSquareSize, inSquareSize, dtype{ 1 });
54
}
55
56
//============================================================================
57
// Method Description:
67
template
<
typename
dtype>
68
NdArray<dtype>
ones
(
uint32
inNumRows,
uint32
inNumCols)
69
{
70
STATIC_ASSERT_ARITHMETIC_OR_COMPLEX
(dtype);
71
72
return
full
(inNumRows, inNumCols, dtype{ 1 });
73
}
74
75
//============================================================================
76
// Method Description:
86
template
<
typename
dtype>
87
NdArray<dtype>
ones
(
const
Shape
& inShape)
88
{
89
STATIC_ASSERT_ARITHMETIC_OR_COMPLEX
(dtype);
90
91
return
full
(inShape, dtype{ 1 });
92
}
93
}
// namespace nc
StaticAsserts.hpp
nc::full
NdArray< dtype > full(uint32 inSquareSize, dtype inFillValue)
Definition:
full.hpp:48
STATIC_ASSERT_ARITHMETIC_OR_COMPLEX
#define STATIC_ASSERT_ARITHMETIC_OR_COMPLEX(dtype)
Definition:
StaticAsserts.hpp:50
nc::NdArray< dtype >
nc::uint32
std::uint32_t uint32
Definition:
Types.hpp:40
NdArray.hpp
nc::Shape
A Shape Class for NdArrays.
Definition:
Core/Shape.hpp:40
Shape.hpp
nc
Definition:
Coordinate.hpp:44
nc::ones
NdArray< dtype > ones(uint32 inSquareSize)
Definition:
ones.hpp:49
Types.hpp
full.hpp
include
NumCpp
Functions
ones.hpp
Generated by
1.8.17