faer/operator/operator_impl/
matref.rs1use super::*;
2impl<T: ComplexField, ViewT: Conjugate<Canonical = T>> LinOp<T>
3 for MatRef<'_, ViewT>
4{
5 #[inline]
6 fn nrows(&self) -> usize {
7 (*self).nrows()
8 }
9
10 #[inline]
11 fn ncols(&self) -> usize {
12 (*self).ncols()
13 }
14
15 #[inline]
16 fn apply_scratch(&self, rhs_ncols: usize, par: Par) -> StackReq {
17 _ = (rhs_ncols, par);
18 StackReq::EMPTY
19 }
20
21 #[inline]
22 #[track_caller]
23 fn apply(
24 &self,
25 out: MatMut<'_, T>,
26 rhs: MatRef<'_, T>,
27 par: Par,
28 stack: &mut MemStack,
29 ) {
30 _ = stack;
31 linalg::matmul::matmul(
32 out,
33 Accum::Replace,
34 *self,
35 rhs,
36 one::<T>(),
37 par,
38 );
39 }
40
41 #[inline]
42 #[track_caller]
43 fn conj_apply(
44 &self,
45 out: MatMut<'_, T>,
46 rhs: MatRef<'_, T>,
47 par: Par,
48 stack: &mut MemStack,
49 ) {
50 _ = stack;
51 let this = self.conjugate();
52 linalg::matmul::matmul(out, Accum::Replace, this, rhs, one::<T>(), par);
53 }
54}
55impl<T: ComplexField, ViewT: Conjugate<Canonical = T>> BiLinOp<T>
56 for MatRef<'_, ViewT>
57{
58 #[inline]
59 fn transpose_apply_scratch(&self, rhs_ncols: usize, par: Par) -> StackReq {
60 _ = (rhs_ncols, par);
61 StackReq::EMPTY
62 }
63
64 #[inline]
65 #[track_caller]
66 fn transpose_apply(
67 &self,
68 out: MatMut<'_, T>,
69 rhs: MatRef<'_, T>,
70 par: Par,
71 stack: &mut MemStack,
72 ) {
73 _ = stack;
74 let this = self.transpose();
75 linalg::matmul::matmul(out, Accum::Replace, this, rhs, one::<T>(), par);
76 }
77
78 #[inline]
79 #[track_caller]
80 fn adjoint_apply(
81 &self,
82 out: MatMut<'_, T>,
83 rhs: MatRef<'_, T>,
84 par: Par,
85 stack: &mut MemStack,
86 ) {
87 _ = stack;
88 let this = self.adjoint();
89 linalg::matmul::matmul(out, Accum::Replace, this, rhs, one::<T>(), par);
90 }
91}
92impl<T: ComplexField, ViewT: Conjugate<Canonical = T>> Precond<T>
93 for MatRef<'_, ViewT>
94{
95}
96impl<T: ComplexField, ViewT: Conjugate<Canonical = T>> BiPrecond<T>
97 for MatRef<'_, ViewT>
98{
99}