argmin-math 0.5.1

argmin math abstractions
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use crate::ArgminConj;
use faer::{mat::AsMatRef, reborrow::ReborrowMut, unzip, Mat, MatMut, MatRef};
use faer_traits::ComplexField;
use num_complex::ComplexFloat;

impl<E: ComplexField + num_complex::ComplexFloat> ArgminConj for Mat<E> {
    #[inline]
    fn conj(&self) -> Self {
        //@note(geo-ant): we can't directly use the `conjugate()' function
        // on the MatRef struct since it's not guaranteed to return a
        // matrix of the same type. Thus, we implement the conjugation
        // using the num-complex trait manually.
        faer::zip!(self).map(|unzip!(this)| this.conj())
    }
}