NumCpp
2.1.0
A C++ implementation of the Python Numpy library
ones_like.hpp
Go to the documentation of this file.
1
#pragma once
30
31
#include "
NumCpp/Core/Internal/StaticAsserts.hpp
"
32
#include "
NumCpp/NdArray.hpp
"
33
34
namespace
nc
35
{
36
//============================================================================
37
// Method Description:
47
template
<
typename
dtypeOut,
typename
dtype>
48
NdArray<dtypeOut>
ones_like
(
const
NdArray<dtype>
& inArray)
49
{
50
STATIC_ASSERT_ARITHMETIC_OR_COMPLEX
(dtype);
51
52
NdArray<dtypeOut>
returnArray(inArray.
shape
());
53
returnArray.
ones
();
54
return
returnArray;
55
}
56
}
// namespace nc
StaticAsserts.hpp
nc::NdArray::shape
Shape shape() const noexcept
Definition:
NdArrayCore.hpp:4312
STATIC_ASSERT_ARITHMETIC_OR_COMPLEX
#define STATIC_ASSERT_ARITHMETIC_OR_COMPLEX(dtype)
Definition:
StaticAsserts.hpp:51
nc::NdArray
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition:
NdArrayCore.hpp:75
nc::ones_like
NdArray< dtypeOut > ones_like(const NdArray< dtype > &inArray)
Definition:
ones_like.hpp:48
NdArray.hpp
nc::NdArray::ones
NdArray< dtype > & ones() noexcept
Definition:
NdArrayCore.hpp:3454
nc
Definition:
Coordinate.hpp:45
include
NumCpp
Functions
ones_like.hpp
Generated by
1.8.17