faer/operator/operator_impl/
matref.rs1use super::*;
2
3impl<T: ComplexField, ViewT: Conjugate<Canonical = T>> LinOp<T> for MatRef<'_, ViewT> {
4 #[inline]
5 fn nrows(&self) -> usize {
6 (*self).nrows()
7 }
8
9 #[inline]
10 fn ncols(&self) -> usize {
11 (*self).ncols()
12 }
13
14 #[inline]
15 fn apply_scratch(&self, rhs_ncols: usize, par: Par) -> StackReq {
16 _ = (rhs_ncols, par);
17 StackReq::EMPTY
18 }
19
20 #[inline]
21 #[track_caller]
22 fn apply(&self, out: MatMut<'_, T>, rhs: MatRef<'_, T>, par: Par, stack: &mut MemStack) {
23 _ = stack;
24 linalg::matmul::matmul(out, Accum::Replace, *self, rhs, one::<T>(), par);
25 }
26
27 #[inline]
28 #[track_caller]
29 fn conj_apply(&self, out: MatMut<'_, T>, rhs: MatRef<'_, T>, par: Par, stack: &mut MemStack) {
30 _ = stack;
31 let this = self.conjugate();
32 linalg::matmul::matmul(out, Accum::Replace, this, rhs, one::<T>(), par);
33 }
34}
35
36impl<T: ComplexField, ViewT: Conjugate<Canonical = T>> BiLinOp<T> for MatRef<'_, ViewT> {
37 #[inline]
38 fn transpose_apply_scratch(&self, rhs_ncols: usize, par: Par) -> StackReq {
39 _ = (rhs_ncols, par);
40 StackReq::EMPTY
41 }
42
43 #[inline]
44 #[track_caller]
45 fn transpose_apply(&self, out: MatMut<'_, T>, rhs: MatRef<'_, T>, par: Par, stack: &mut MemStack) {
46 _ = stack;
47 let this = self.transpose();
48 linalg::matmul::matmul(out, Accum::Replace, this, rhs, one::<T>(), par);
49 }
50
51 #[inline]
52 #[track_caller]
53 fn adjoint_apply(&self, out: MatMut<'_, T>, rhs: MatRef<'_, T>, par: Par, stack: &mut MemStack) {
54 _ = stack;
55 let this = self.adjoint();
56 linalg::matmul::matmul(out, Accum::Replace, this, rhs, one::<T>(), par);
57 }
58}
59
60impl<T: ComplexField, ViewT: Conjugate<Canonical = T>> Precond<T> for MatRef<'_, ViewT> {}
61impl<T: ComplexField, ViewT: Conjugate<Canonical = T>> BiPrecond<T> for MatRef<'_, ViewT> {}