Skip to main content

faer/operator/operator_impl/
csc_matref.rs

1use super::*;
2impl<T: ComplexField, I: Index, ViewT: Conjugate<Canonical = T>> LinOp<T>
3	for SparseColMatRef<'_, I, 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: ParShape) -> 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_sp::matmul::sparse_dense_matmul(
32			out,
33			Accum::Replace,
34			*self,
35			rhs,
36			one(),
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_sp::matmul::sparse_dense_matmul(
53			out,
54			Accum::Replace,
55			this,
56			rhs,
57			one(),
58			par,
59		);
60	}
61}
62impl<T: ComplexField, I: Index, ViewT: Conjugate<Canonical = T>> BiLinOp<T>
63	for SparseColMatRef<'_, I, ViewT>
64{
65	#[inline]
66	fn transpose_apply_scratch(&self, rhs_ncols: usize, par: ParShape) -> StackReq {
67		_ = (rhs_ncols, par);
68		StackReq::EMPTY
69	}
70
71	#[inline]
72	#[track_caller]
73	fn transpose_apply(
74		&self,
75		out: MatMut<'_, T>,
76		rhs: MatRef<'_, T>,
77		par: Par,
78		stack: &mut MemStack,
79	) {
80		_ = stack;
81		let this = self.transpose();
82		linalg_sp::matmul::dense_sparse_matmul(
83			out.transpose_mut(),
84			Accum::Replace,
85			rhs.transpose(),
86			this.transpose(),
87			one(),
88			par,
89		);
90	}
91
92	#[inline]
93	#[track_caller]
94	fn adjoint_apply(
95		&self,
96		out: MatMut<'_, T>,
97		rhs: MatRef<'_, T>,
98		par: Par,
99		stack: &mut MemStack,
100	) {
101		_ = stack;
102		let this = self.adjoint();
103		linalg_sp::matmul::dense_sparse_matmul(
104			out.transpose_mut(),
105			Accum::Replace,
106			rhs.transpose(),
107			this.transpose(),
108			one(),
109			par,
110		);
111	}
112}
113impl<T: ComplexField, I: Index, ViewT: Conjugate<Canonical = T>> Precond<T>
114	for SparseColMatRef<'_, I, ViewT>
115{
116}
117impl<T: ComplexField, I: Index, ViewT: Conjugate<Canonical = T>> BiPrecond<T>
118	for SparseColMatRef<'_, I, ViewT>
119{
120}