Is there a compact way to scale a matrix by a constant in repa-3.2.3.3?
No, there isn't. After all, map
gives you a way to apply any function element-wise. However, keep in mind that you should probably inline your function (source):
Advice for writing fast code:
[...]
2. Add INLINE
pragmas to all leaf-functions in your code, expecially ones that compute numeric results. Non-inlined lazy function calls can cost upwards of 50 cycles each, while each numeric operator only costs one (or less). Inlining leaf functions also ensures they are specialised at the appropriate numeric types.