Contents

class

SushiBLAS::LogicOps

Records comparisons, boolean combinations and truth tests of tensors.

Declared in
include/SushiBLAS/engine/logic/logic.hpp

Note

Every operand must have storage and dense strides, and the operands of one call must share one shape: the library does not broadcast.

Public member functions

explicit LogicOps(TaskRecorder &recorder) noexcept

Builds a view that records through recorder, which must outlive the view.

explicit LogicOps(Engine &engine) noexcept

Builds a view that records on engine's own graph.

LogicOps(const LogicOps &)=default
LogicOps & operator=(const LogicOps &)=delete
LogicOps(LogicOps &&)=default
LogicOps & operator=(LogicOps &&)=delete
~LogicOps()=default
TaskHandle equal(const Tensor &A, const Tensor &B, Tensor &result)

Element-wise equality comparison: A == B.

Parameters

A

First input tensor.

B

Second input tensor.

result

Output tensor (1 if true, 0 if false).

Returns

The handle of the recorded task.

TaskHandle not_equal(const Tensor &A, const Tensor &B, Tensor &result)

Element-wise inequality comparison: A != B.

Parameters

A

First input tensor.

B

Second input tensor.

result

Output tensor (1 if true, 0 if false).

Returns

The handle of the recorded task.

TaskHandle greater(const Tensor &A, const Tensor &B, Tensor &result)

Element-wise comparison: A > B.

Parameters

A

First input tensor.

B

Second input tensor.

result

Output tensor (1 if true, 0 if false).

Returns

The handle of the recorded task.

TaskHandle less(const Tensor &A, const Tensor &B, Tensor &result)

Element-wise comparison: A < B.

Parameters

A

First input tensor.

B

Second input tensor.

result

Output tensor (1 if true, 0 if false).

Returns

The handle of the recorded task.

TaskHandle greater_equal(const Tensor &A, const Tensor &B, Tensor &result)

Element-wise comparison: A >= B.

Parameters

A

First input tensor.

B

Second input tensor.

result

Output tensor (1 if true, 0 if false).

Returns

The handle of the recorded task.

TaskHandle less_equal(const Tensor &A, const Tensor &B, Tensor &result)

Element-wise comparison: A <= B.

Parameters

A

First input tensor.

B

Second input tensor.

result

Output tensor (1 if true, 0 if false).

Returns

The handle of the recorded task.

TaskHandle where(const Tensor &condition, const Tensor &A, const Tensor &B, Tensor &out)

Selects A where condition is non-zero and B elsewhere, like numpy.where.

TaskHandle logical_and(const Tensor &A, const Tensor &B, Tensor &out)

Element-wise logical AND of two tensors.

Parameters

A

Input tensor A.

B

Input tensor B.

out

Output tensor (1 if both non-zero, else 0).

Returns

The handle of the recorded task.

TaskHandle logical_or(const Tensor &A, const Tensor &B, Tensor &out)

Element-wise logical OR of two tensors.

Parameters

A

Input tensor A.

B

Input tensor B.

out

Output tensor (1 if either non-zero, else 0).

Returns

The handle of the recorded task.

TaskHandle logical_xor(const Tensor &A, const Tensor &B, Tensor &out)

Element-wise logical XOR of two tensors.

Parameters

A

Input tensor A.

B

Input tensor B.

out

Output tensor (1 if exactly one is non-zero, else 0).

Returns

The handle of the recorded task.

TaskHandle logical_not(const Tensor &A, Tensor &out)

Element-wise logical NOT of a tensor.

Parameters

A

Input tensor.

out

Output tensor (1 if zero, 0 if non-zero).

Returns

The handle of the recorded task.

TaskHandle all(const Tensor &t, Tensor &result)

Check if all elements are non-zero (Logical ALL reduction).

Parameters

t

Input tensor.

result

Scalar output (1 if all true, else 0).

Returns

The handle of the recorded task.

TaskHandle any(const Tensor &t, Tensor &result)

Check if any element is non-zero (Logical ANY reduction).

Parameters

t

Input tensor.

result

Scalar output (1 if any true, else 0).

Returns

The handle of the recorded task.