cpp : Added documentation
This commit is contained in:
16
cpp/data_device.cu
Normal file
16
cpp/data_device.cu
Normal file
@ -0,0 +1,16 @@
|
||||
#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;
|
||||
}
|
Reference in New Issue
Block a user