MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / af_logic

Function af_logic

src/api/c/binary.cpp:552–589  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

550
551template<af_op_t op>
552static af_err af_logic(af_array *out, const af_array lhs, const af_array rhs,
553 const bool batchMode) {
554 try {
555 const af_dtype type = implicit(lhs, rhs);
556
557 const ArrayInfo &linfo = getInfo(lhs);
558 const ArrayInfo &rinfo = getInfo(rhs);
559
560 dim4 odims = getOutDims(linfo.dims(), rinfo.dims(), batchMode);
561
562 if (odims.ndims() == 0) {
563 return af_create_handle(out, 0, nullptr, type);
564 }
565
566 af_array res;
567 switch (type) {
568 case f32: res = logicOp<float, op>(lhs, rhs, odims); break;
569 case f64: res = logicOp<double, op>(lhs, rhs, odims); break;
570 case c32: res = logicOp<cfloat, op>(lhs, rhs, odims); break;
571 case c64: res = logicOp<cdouble, op>(lhs, rhs, odims); break;
572 case s32: res = logicOp<int, op>(lhs, rhs, odims); break;
573 case u32: res = logicOp<uint, op>(lhs, rhs, odims); break;
574 case s8: res = logicOp<schar, op>(lhs, rhs, odims); break;
575 case u8: res = logicOp<uchar, op>(lhs, rhs, odims); break;
576 case b8: res = logicOp<char, op>(lhs, rhs, odims); break;
577 case s64: res = logicOp<intl, op>(lhs, rhs, odims); break;
578 case u64: res = logicOp<uintl, op>(lhs, rhs, odims); break;
579 case s16: res = logicOp<short, op>(lhs, rhs, odims); break;
580 case u16: res = logicOp<ushort, op>(lhs, rhs, odims); break;
581 case f16: res = logicOp<half, op>(lhs, rhs, odims); break;
582 default: TYPE_ERROR(0, type);
583 }
584
585 std::swap(*out, res);
586 }
587 CATCHALL;
588 return AF_SUCCESS;
589}
590
591af_err af_eq(af_array *out, const af_array lhs, const af_array rhs,
592 const bool batchMode) {

Callers

nothing calls this directly

Calls 6

implicitFunction · 0.85
getOutDimsFunction · 0.85
swapFunction · 0.85
af_create_handleFunction · 0.70
dimsMethod · 0.45
ndimsMethod · 0.45

Tested by

no test coverage detected