nk 1.0.0
C++ Numerical Computing Runtime
Loading...
Searching...
No Matches
compare.hpp
1// toolboxes/builtin/src/lang/operators/backends/compare.hpp
2//
3// Internal contract between binary_ops.cpp's compareImpl and the
4// SIMD/portable Compare backends. Six fast-path entry points — one per
5// MATLAB cmp op — that handle the two common shapes:
6// * a and b are both DOUBLE arrays of identical 2D/3D shape, OR
7// * one operand is a DOUBLE scalar and the other is a DOUBLE array.
8//
9// Returns an Value::isUnset() sentinel when the inputs don't fit the
10// fast path (LOGICAL/integer/complex operand, broadcasting between two
11// non-scalar operands of different shape, etc.) — caller falls back to
12// the generic scalar `compareImpl` loop.
13//
14// Phase P1.5 of project_perf_optimization_plan.md.
15
16#pragma once
17
18#include <memory_resource>
19#include <nk/value/value.hpp>
20
21namespace nk::ops {
22
23Value eqFast(const Value &a, const Value &b);
24Value neFast(const Value &a, const Value &b);
25Value ltFast(const Value &a, const Value &b);
26Value gtFast(const Value &a, const Value &b);
27Value leFast(const Value &a, const Value &b);
28Value geFast(const Value &a, const Value &b);
29
30} // namespace nk::ops