24#ifndef MORPHEUS_UTILS_HPP
25#define MORPHEUS_UTILS_HPP
27#include <Morpheus_Macros.hpp>
34template <
typename Pr
intable,
typename Stream>
35void print_matrix_header(
const Printable& p, Stream& s) {
36 s <<
"<" << p.nrows() <<
", " << p.ncols() <<
"> with " << p.nnnz()
40template <
typename Size1,
typename Size2>
41MORPHEUS_INLINE_FUNCTION Size1 DIVIDE_INTO(Size1 N, Size2 granularity) {
42 return (N + (granularity - 1)) / granularity;
46MORPHEUS_INLINE_FUNCTION T ceil_div(T x, T y) {
47 return (x + y - 1) / y;
51MORPHEUS_INLINE_FUNCTION T min(T x, T y) {
56MORPHEUS_INLINE_FUNCTION T max(T x, T y) {
60template <
typename IndexType>
61MORPHEUS_INLINE_FUNCTION
bool isPow2(
63 typename std::enable_if<std::is_integral<IndexType>::value>::type* =
65 return ((x & (x - 1)) == 0);
68template <
typename IndexType>
69MORPHEUS_INLINE_FUNCTION IndexType
71 typename std::enable_if<std::is_integral<IndexType>::value>::type* =
83#define MORPHEUS_ASSERT(condition, message) \
86 std::cerr << "Assertion `" #condition "` failed in " << __FILE__ \
87 << " line " << __LINE__ << ": " << message << std::endl; \
92#define MORPHEUS_ASSERT(condition, message) \
Generic Morpheus interfaces.
Definition: dummy.cpp:24