NumCpp
2.4.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
ones_like.hpp
Go to the documentation of this file.
1
#pragma once
29
30
#include "
NumCpp/Core/Internal/StaticAsserts.hpp
"
31
#include "
NumCpp/NdArray.hpp
"
32
33
namespace
nc
34
{
35
//============================================================================
36
// Method Description:
46
template
<
typename
dtypeOut,
typename
dtype>
47
NdArray<dtypeOut>
ones_like
(
const
NdArray<dtype>
& inArray)
48
{
49
STATIC_ASSERT_ARITHMETIC_OR_COMPLEX
(dtype);
50
51
NdArray<dtypeOut>
returnArray(inArray.
shape
());
52
returnArray.
ones
();
53
return
returnArray;
54
}
55
}
// namespace nc
StaticAsserts.hpp
nc::NdArray::shape
Shape shape() const noexcept
Definition:
NdArrayCore.hpp:4356
STATIC_ASSERT_ARITHMETIC_OR_COMPLEX
#define STATIC_ASSERT_ARITHMETIC_OR_COMPLEX(dtype)
Definition:
StaticAsserts.hpp:50
nc::NdArray
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition:
NdArrayCore.hpp:71
nc::ones_like
NdArray< dtypeOut > ones_like(const NdArray< dtype > &inArray)
Definition:
ones_like.hpp:47
NdArray.hpp
nc::NdArray::ones
NdArray< dtype > & ones() noexcept
Definition:
NdArrayCore.hpp:3498
nc
Definition:
Coordinate.hpp:44
include
NumCpp
Functions
ones_like.hpp
Generated by
1.8.17