17 lines
416 B
Plaintext
17 lines
416 B
Plaintext
#include "data.hpp"
|
|
|
|
/**
|
|
* @brief Product of every elements in a given shape after a given offset.
|
|
*
|
|
* @param shape Shape to product over
|
|
* @param offset Skip offset
|
|
* @return Scalar product
|
|
*/
|
|
__host__ __device__
|
|
size_t np::prod(const np::Shape& shape, const size_t& offset) noexcept {
|
|
size_t result = shape[offset];
|
|
for(size_t i = 1 + offset; i < shape.length; ++i)
|
|
result *= shape[i];
|
|
return result;
|
|
}
|