argmin-math 0.5.1

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

impl<E: Entity + 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::zipped_rw!(self).map(|unzipped!(this)| ComplexFloat::conj(this.read()))
    }
}