numrs/ops/elementwise/binary/sub.rs
1use crate::array::{Array, DTypeValue};
2use crate::llo::ElementwiseKind;
3use anyhow::Result;
4
5/// Elementwise subtract with automatic type promotion
6///
7/// Returns an Array with the promoted dtype.
8#[inline(always)]
9pub fn sub<T1, T2>(a: &Array<T1>, b: &Array<T2>) -> Result<Array>
10where
11 T1: DTypeValue,
12 T2: DTypeValue,
13{
14 let dyn_result = crate::ops::promotion_wrappers::binary_promoted(a, b, ElementwiseKind::Sub, "sub")?;
15 dyn_result.into_typed()
16}