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
31
#include "
NumCpp/Core/Internal/StaticAsserts.hpp
"
32
#include "
NumCpp/Core/Shape.hpp
"
33
#include "
NumCpp/Core/Types.hpp
"
34
#include "
NumCpp/Functions/full.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
{
52
STATIC_ASSERT_ARITHMETIC_OR_COMPLEX
(dtype);
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
{
71
STATIC_ASSERT_ARITHMETIC_OR_COMPLEX
(dtype);
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
{
90
STATIC_ASSERT_ARITHMETIC_OR_COMPLEX
(dtype);
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
include
NumCpp
Functions
ones.hpp
Generated by
1.8.17