use crate::ArgminMul;
use faer::{
mat::{AsMatMut, AsMatRef},
reborrow::{IntoConst, Reborrow, ReborrowMut},
Mat, MatMut, MatRef,
};
use faer_traits::ComplexField;
use std::ops::Mul;
impl<E> ArgminMul<E, Mat<E>> for MatRef<'_, E>
where
E: ComplexField,
{
#[inline]
fn mul(&self, other: &E) -> Mat<E> {
faer::zip!(self).map(|faer::unzip!(this)| this.mul_by_ref(other))
}
}
impl<'a, E> ArgminMul<MatRef<'a, E>, Mat<E>> for E
where
E: ComplexField,
{
#[inline]
fn mul(&self, other: &MatRef<'a, E>) -> Mat<E> {
<_ as ArgminMul<_, _>>::mul(other, self)
}
}
impl<E> ArgminMul<E, Mat<E>> for Mat<E>
where
E: ComplexField,
{
#[inline]
fn mul(&self, other: &E) -> Mat<E> {
<_ as ArgminMul<_, _>>::mul(&self.as_mat_ref(), other)
}
}
impl<E> ArgminMul<Mat<E>, Mat<E>> for E
where
E: ComplexField,
{
#[inline]
fn mul(&self, other: &Mat<E>) -> Mat<E> {
<_ as ArgminMul<_, _>>::mul(other, self)
}
}
impl<'a, E: ComplexField> ArgminMul<MatRef<'a, E>, Mat<E>> for MatRef<'_, E> {
#[inline]
fn mul(&self, other: &MatRef<'a, E>) -> Mat<E> {
faer::zip!(self, other).map(|faer::unzip!(this, other)| this.mul_by_ref(other))
}
}
impl<E: ComplexField> ArgminMul<Mat<E>, Mat<E>> for MatRef<'_, E> {
#[inline]
fn mul(&self, other: &Mat<E>) -> Mat<E> {
<_ as ArgminMul<_, _>>::mul(self, &other.as_mat_ref())
}
}
impl<'a, E: ComplexField> ArgminMul<MatRef<'a, E>, Mat<E>> for Mat<E> {
#[inline]
fn mul(&self, other: &MatRef<'a, E>) -> Mat<E> {
<_ as ArgminMul<_, _>>::mul(&self.as_mat_ref(), other)
}
}
impl<E: ComplexField> ArgminMul<Mat<E>, Mat<E>> for Mat<E> {
#[inline]
fn mul(&self, other: &Mat<E>) -> Mat<E> {
<_ as ArgminMul<_, _>>::mul(&self.as_mat_ref(), &other.as_mat_ref())
}
}