cpp : Added documentation

This commit is contained in:
saundersp
2024-04-28 22:11:33 +02:00
parent f7ac38b93a
commit c71b04f00d
16 changed files with 797 additions and 295 deletions

16
cpp/data_device.cu Normal file
View 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;
}