Thu, 26 Feb 2026 12:55:38 -0500
Oops, a τ had dropped in forward_pdps.
| 0 | 1 | /*! This module implements the convolution operators $𝒟$. |
| 2 | ||
| 3 | The principal data type of the module is [`ConvolutionOp`] and the main abstraction | |
| 4 | the trait [`DiscreteMeasureOp`]. | |
| 5 | */ | |
| 6 | ||
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
7 | use crate::measures::{DeltaMeasure, DiscreteMeasure, Radon, SpikeIter, RNDM}; |
|
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
8 | use alg_tools::bisection_tree::*; |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
9 | use alg_tools::bounds::Bounded; |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
10 | use alg_tools::error::DynResult; |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
11 | use alg_tools::instance::Instance; |
|
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
12 | use alg_tools::iter::{FilterMapX, Mappable}; |
|
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
13 | use alg_tools::linops::{BoundedLinear, Linear, Mapping}; |
| 0 | 14 | use alg_tools::loc::Loc; |
| 15 | use alg_tools::mapping::RealMapping; | |
| 16 | use alg_tools::nalgebra_support::ToNalgebraRealField; | |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
17 | use alg_tools::norms::{Linfinity, Norm, NormExponent}; |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
18 | use alg_tools::sets::Cube; |
|
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
19 | use alg_tools::types::*; |
|
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
20 | use itertools::Itertools; |
| 0 | 21 | use nalgebra::DMatrix; |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
22 | use std::iter::Zip; |
| 0 | 23 | use std::marker::PhantomData; |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
24 | use std::ops::RangeFrom; |
| 0 | 25 | |
| 26 | /// Abstraction for operators $𝒟 ∈ 𝕃(𝒵(Ω); C_c(Ω))$. | |
| 27 | /// | |
| 28 | /// Here $𝒵(Ω) ⊂ ℳ(Ω)$ is the space of sums of delta measures, presented by [`DiscreteMeasure`]. | |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
29 | pub trait DiscreteMeasureOp<Domain, F>: |
|
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
30 | BoundedLinear<DiscreteMeasure<Domain, F>, Radon, Linfinity, F> |
| 35 | 31 | where |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
32 | F: Float + ToNalgebraRealField, |
|
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
33 | Domain: 'static + Clone + PartialEq, |
| 35 | 34 | { |
| 0 | 35 | /// The output type of [`Self::preapply`]. |
| 36 | type PreCodomain; | |
| 37 | ||
| 38 | /// Creates a finite-dimensional presentatin of the operator restricted to a fixed support. | |
| 39 | /// | |
| 40 | /// <p> | |
| 41 | /// This returns the matrix $C_*𝒟C$, where $C ∈ 𝕃(ℝ^n; 𝒵(Ω))$, $Ca = ∑_{i=1}^n α_i δ_{x_i}$ | |
| 42 | /// for a $x_1, …, x_n$ the coordinates given by the iterator `I`, and $a=(α_1,…,α_n)$. | |
| 43 | /// Here $C_* ∈ 𝕃(C_c(Ω); ℝ^n) $ stands for the preadjoint. | |
| 44 | /// </p> | |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
45 | fn findim_matrix<'a, I>(&self, points: I) -> DMatrix<F::MixedType> |
|
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
46 | where |
|
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
47 | I: ExactSizeIterator<Item = &'a Domain> + Clone; |
| 0 | 48 | |
| 35 | 49 | /// [`Mapping`] that typically returns an uninitialised [`PreBTFN`] |
| 0 | 50 | /// instead of a full [`BTFN`]. |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
51 | fn preapply(&self, μ: DiscreteMeasure<Domain, F>) -> Self::PreCodomain; |
| 0 | 52 | } |
| 53 | ||
| 54 | // Blanket implementation of a measure as a linear functional over a predual | |
| 55 | // (that by assumption is a linear functional over a measure). | |
| 56 | /*impl<F, Domain, Predual> Linear<Predual> | |
| 57 | for DiscreteMeasure<Domain, F> | |
| 58 | where F : Float + ToNalgebraRealField, | |
| 59 | Predual : Linear<DiscreteMeasure<Domain, F>, Codomain=F> { | |
| 60 | type Codomain = F; | |
| 61 | ||
| 62 | #[inline] | |
| 63 | fn apply(&self, ω : &Predual) -> F { | |
| 64 | ω.apply(self) | |
| 65 | } | |
| 66 | }*/ | |
| 67 | ||
| 68 | // | |
| 69 | // Convolutions for discrete measures | |
| 70 | // | |
| 71 | ||
| 72 | /// A trait alias for simple convolution kernels. | |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
73 | pub trait SimpleConvolutionKernel<const N: usize, F: Float = f64>: |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
74 | RealMapping<N, F> + Support<N, F> + Bounded<F> + Clone + 'static |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
75 | { |
|
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
76 | } |
| 0 | 77 | |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
78 | impl<T, F: Float, const N: usize> SimpleConvolutionKernel<N, F> for T where |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
79 | T: RealMapping<N, F> + Support<N, F> + Bounded<F> + Clone + 'static |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
80 | { |
|
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
81 | } |
| 0 | 82 | |
| 83 | /// [`SupportGenerator`] for [`ConvolutionOp`]. | |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
84 | #[derive(Clone, Debug)] |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
85 | pub struct ConvolutionSupportGenerator<K, const N: usize, F: Float = f64> |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
86 | where |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
87 | K: SimpleConvolutionKernel<N, F>, |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
88 | { |
|
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
89 | kernel: K, |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
90 | centres: RNDM<N, F>, |
| 0 | 91 | } |
| 92 | ||
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
93 | impl<F: Float, K, const N: usize> ConvolutionSupportGenerator<K, N, F> |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
94 | where |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
95 | K: SimpleConvolutionKernel<N, F>, |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
96 | { |
| 0 | 97 | /// Construct the convolution kernel corresponding to `δ`, i.e., one centered at `δ.x` and |
| 98 | /// weighted by `δ.α`. | |
| 99 | #[inline] | |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
100 | fn construct_kernel<'a>( |
|
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
101 | &'a self, |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
102 | δ: &'a DeltaMeasure<Loc<N, F>, F>, |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
103 | ) -> Weighted<Shift<K, N, F>, F> { |
| 0 | 104 | self.kernel.clone().shift(δ.x).weigh(δ.α) |
| 105 | } | |
| 106 | ||
| 107 | /// This is a helper method for the implementation of [`ConvolutionSupportGenerator::all_data`]. | |
| 108 | /// It filters out `δ` with zero weight, and otherwise returns the corresponding convolution | |
| 109 | /// kernel. The `id` is passed through as-is. | |
| 110 | #[inline] | |
| 111 | fn construct_kernel_and_id_filtered<'a>( | |
| 112 | &'a self, | |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
113 | (id, δ): (usize, &'a DeltaMeasure<Loc<N, F>, F>), |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
114 | ) -> Option<(usize, Weighted<Shift<K, N, F>, F>)> { |
| 0 | 115 | (δ.α != F::ZERO).then(|| (id.into(), self.construct_kernel(δ))) |
| 116 | } | |
| 117 | } | |
| 118 | ||
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
119 | impl<F: Float, K, const N: usize> SupportGenerator<N, F> for ConvolutionSupportGenerator<K, N, F> |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
120 | where |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
121 | K: SimpleConvolutionKernel<N, F>, |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
122 | { |
| 0 | 123 | type Id = usize; |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
124 | type SupportType = Weighted<Shift<K, N, F>, F>; |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
125 | type AllDataIter<'a> = FilterMapX< |
|
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
126 | 'a, |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
127 | Zip<RangeFrom<usize>, SpikeIter<'a, Loc<N, F>, F>>, |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
128 | Self, |
|
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
129 | (Self::Id, Self::SupportType), |
|
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
130 | >; |
| 0 | 131 | |
| 132 | #[inline] | |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
133 | fn support_for(&self, d: Self::Id) -> Self::SupportType { |
| 0 | 134 | self.construct_kernel(&self.centres[d]) |
| 135 | } | |
| 136 | ||
| 137 | #[inline] | |
| 138 | fn support_count(&self) -> usize { | |
| 139 | self.centres.len() | |
| 140 | } | |
| 141 | ||
| 142 | #[inline] | |
| 143 | fn all_data(&self) -> Self::AllDataIter<'_> { | |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
144 | (0..) |
|
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
145 | .zip(self.centres.iter_spikes()) |
|
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
146 | .filter_mapX(self, Self::construct_kernel_and_id_filtered) |
| 0 | 147 | } |
| 148 | } | |
| 149 | ||
| 150 | /// Representation of a convolution operator $𝒟$. | |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
151 | #[derive(Clone, Debug)] |
|
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
152 | pub struct ConvolutionOp<F, K, BT, const N: usize> |
|
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
153 | where |
|
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
154 | F: Float + ToNalgebraRealField, |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
155 | BT: BTImpl<N, F, Data = usize>, |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
156 | K: SimpleConvolutionKernel<N, F>, |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
157 | { |
| 35 | 158 | /// Depth of the [`BT`] bisection tree for the outputs [`Mapping::apply`]. |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
159 | depth: BT::Depth, |
| 35 | 160 | /// Domain of the [`BT`] bisection tree for the outputs [`Mapping::apply`]. |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
161 | domain: Cube<N, F>, |
| 0 | 162 | /// The convolution kernel |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
163 | kernel: K, |
|
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
164 | _phantoms: PhantomData<(F, BT)>, |
| 0 | 165 | } |
| 166 | ||
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
167 | impl<F, K, BT, const N: usize> ConvolutionOp<F, K, BT, N> |
|
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
168 | where |
|
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
169 | F: Float + ToNalgebraRealField, |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
170 | BT: BTImpl<N, F, Data = usize>, |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
171 | K: SimpleConvolutionKernel<N, F>, |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
172 | { |
| 0 | 173 | /// Creates a new convolution operator $𝒟$ with `kernel` on `domain`. |
| 174 | /// | |
| 35 | 175 | /// The output of [`Mapping::apply`] is a [`BT`] of given `depth`. |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
176 | pub fn new(depth: BT::Depth, domain: Cube<N, F>, kernel: K) -> Self { |
| 0 | 177 | ConvolutionOp { |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
178 | depth: depth, |
|
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
179 | domain: domain, |
|
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
180 | kernel: kernel, |
|
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
181 | _phantoms: PhantomData, |
| 0 | 182 | } |
| 183 | } | |
| 184 | ||
| 185 | /// Returns the support generator for this convolution operator. | |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
186 | fn support_generator(&self, μ: RNDM<N, F>) -> ConvolutionSupportGenerator<K, N, F> { |
| 0 | 187 | // TODO: can we avoid cloning μ? |
| 188 | ConvolutionSupportGenerator { | |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
189 | kernel: self.kernel.clone(), |
|
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
190 | centres: μ, |
| 0 | 191 | } |
| 192 | } | |
| 193 | ||
| 194 | /// Returns a reference to the kernel of this convolution operator. | |
| 195 | pub fn kernel(&self) -> &K { | |
| 196 | &self.kernel | |
| 197 | } | |
| 198 | } | |
| 199 | ||
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
200 | impl<F, K, BT, const N: usize> Mapping<RNDM<N, F>> for ConvolutionOp<F, K, BT, N> |
| 35 | 201 | where |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
202 | F: Float + ToNalgebraRealField, |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
203 | BT: BTImpl<N, F, Data = usize>, |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
204 | K: SimpleConvolutionKernel<N, F>, |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
205 | Weighted<Shift<K, N, F>, F>: LocalAnalysis<F, BT::Agg, N>, |
| 35 | 206 | { |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
207 | type Codomain = BTFN<F, ConvolutionSupportGenerator<K, N, F>, BT, N>; |
| 0 | 208 | |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
209 | fn apply<I>(&self, μ: I) -> Self::Codomain |
|
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
210 | where |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
211 | I: Instance<RNDM<N, F>>, |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
212 | { |
| 35 | 213 | let g = self.support_generator(μ.own()); |
| 0 | 214 | BTFN::construct(self.domain.clone(), self.depth, g) |
| 215 | } | |
| 216 | } | |
| 217 | ||
| 35 | 218 | /// [`ConvolutionOp`]s as linear operators over [`DiscreteMeasure`]s. |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
219 | impl<F, K, BT, const N: usize> Linear<RNDM<N, F>> for ConvolutionOp<F, K, BT, N> |
| 35 | 220 | where |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
221 | F: Float + ToNalgebraRealField, |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
222 | BT: BTImpl<N, F, Data = usize>, |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
223 | K: SimpleConvolutionKernel<N, F>, |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
224 | Weighted<Shift<K, N, F>, F>: LocalAnalysis<F, BT::Agg, N>, |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
225 | { |
|
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
226 | } |
| 35 | 227 | |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
228 | impl<F, K, BT, const N: usize> BoundedLinear<RNDM<N, F>, Radon, Linfinity, F> |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
229 | for ConvolutionOp<F, K, BT, N> |
|
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
230 | where |
|
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
231 | F: Float + ToNalgebraRealField, |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
232 | BT: BTImpl<N, F, Data = usize>, |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
233 | K: SimpleConvolutionKernel<N, F>, |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
234 | Weighted<Shift<K, N, F>, F>: LocalAnalysis<F, BT::Agg, N>, |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
235 | { |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
236 | fn opnorm_bound(&self, _: Radon, _: Linfinity) -> DynResult<F> { |
| 0 | 237 | // With μ = ∑_i α_i δ_{x_i}, we have |
| 238 | // |𝒟μ|_∞ | |
| 239 | // = sup_z |∑_i α_i φ(z - x_i)| | |
| 240 | // ≤ sup_z ∑_i |α_i| |φ(z - x_i)| | |
| 241 | // ≤ ∑_i |α_i| |φ|_∞ | |
| 242 | // = |μ|_ℳ |φ|_∞ | |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
243 | Ok(self.kernel.bounds().uniform()) |
| 0 | 244 | } |
| 245 | } | |
| 246 | ||
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
247 | impl<'a, F, K, BT, const N: usize> NormExponent for &'a ConvolutionOp<F, K, BT, N> |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
248 | where |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
249 | F: Float + ToNalgebraRealField, |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
250 | BT: BTImpl<N, F, Data = usize>, |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
251 | K: SimpleConvolutionKernel<N, F>, |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
252 | Weighted<Shift<K, N, F>, F>: LocalAnalysis<F, BT::Agg, N>, |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
253 | { |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
254 | } |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
255 | |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
256 | impl<'a, F, K, BT, const N: usize> Norm<&'a ConvolutionOp<F, K, BT, N>, F> for RNDM<N, F> |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
257 | where |
|
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
258 | F: Float + ToNalgebraRealField, |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
259 | BT: BTImpl<N, F, Data = usize>, |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
260 | K: SimpleConvolutionKernel<N, F>, |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
261 | Weighted<Shift<K, N, F>, F>: LocalAnalysis<F, BT::Agg, N>, |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
262 | { |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
263 | fn norm(&self, op𝒟: &'a ConvolutionOp<F, K, BT, N>) -> F { |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
264 | self.apply(op𝒟.apply(self)).sqrt() |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
265 | } |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
266 | } |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
267 | |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
268 | impl<F, K, BT, const N: usize> DiscreteMeasureOp<Loc<N, F>, F> for ConvolutionOp<F, K, BT, N> |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
269 | where |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
270 | F: Float + ToNalgebraRealField, |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
271 | BT: BTImpl<N, F, Data = usize>, |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
272 | K: SimpleConvolutionKernel<N, F>, |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
273 | Weighted<Shift<K, N, F>, F>: LocalAnalysis<F, BT::Agg, N>, |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
274 | { |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
275 | type PreCodomain = PreBTFN<F, ConvolutionSupportGenerator<K, N, F>, N>; |
| 0 | 276 | |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
277 | fn findim_matrix<'a, I>(&self, points: I) -> DMatrix<F::MixedType> |
|
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
278 | where |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
279 | I: ExactSizeIterator<Item = &'a Loc<N, F>> + Clone, |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
280 | { |
| 0 | 281 | // TODO: Preliminary implementation. It be best to use sparse matrices or |
| 282 | // possibly explicit operators without matrices | |
| 283 | let n = points.len(); | |
| 284 | let points_clone = points.clone(); | |
| 285 | let pairs = points.cartesian_product(points_clone); | |
| 286 | let kernel = &self.kernel; | |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
287 | let values = pairs.map(|(x, y)| kernel.apply(y - x).to_nalgebra_mixed()); |
| 0 | 288 | DMatrix::from_iterator(n, n, values) |
| 289 | } | |
| 290 | ||
| 35 | 291 | /// A version of [`Mapping::apply`] that does not instantiate the [`BTFN`] codomain with |
| 0 | 292 | /// a bisection tree, instead returning a [`PreBTFN`]. This can improve performance when |
| 293 | /// the output is to be added as the right-hand-side operand to a proper BTFN. | |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
294 | fn preapply(&self, μ: RNDM<N, F>) -> Self::PreCodomain { |
| 0 | 295 | BTFN::new_pre(self.support_generator(μ)) |
| 296 | } | |
| 297 | } | |
| 298 | ||
| 299 | /// Generates an scalar operation (e.g. [`std::ops::Mul`], [`std::ops::Div`]) | |
| 300 | /// for [`ConvolutionSupportGenerator`]. | |
| 301 | macro_rules! make_convolutionsupportgenerator_scalarop_rhs { | |
| 302 | ($trait:ident, $fn:ident, $trait_assign:ident, $fn_assign:ident) => { | |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
303 | impl<F: Float, K: SimpleConvolutionKernel<N, F>, const N: usize> std::ops::$trait_assign<F> |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
304 | for ConvolutionSupportGenerator<K, N, F> |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
305 | { |
|
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
306 | fn $fn_assign(&mut self, t: F) { |
| 0 | 307 | self.centres.$fn_assign(t); |
| 308 | } | |
| 309 | } | |
| 310 | ||
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
311 | impl<F: Float, K: SimpleConvolutionKernel<N, F>, const N: usize> std::ops::$trait<F> |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
312 | for ConvolutionSupportGenerator<K, N, F> |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
313 | { |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
314 | type Output = ConvolutionSupportGenerator<K, N, F>; |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
315 | fn $fn(mut self, t: F) -> Self::Output { |
| 0 | 316 | std::ops::$trait_assign::$fn_assign(&mut self.centres, t); |
| 317 | self | |
| 318 | } | |
| 319 | } | |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
320 | impl<'a, F: Float, K: SimpleConvolutionKernel<N, F>, const N: usize> std::ops::$trait<F> |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
321 | for &'a ConvolutionSupportGenerator<K, N, F> |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
322 | { |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
323 | type Output = ConvolutionSupportGenerator<K, N, F>; |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
324 | fn $fn(self, t: F) -> Self::Output { |
|
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
325 | ConvolutionSupportGenerator { |
|
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
326 | kernel: self.kernel.clone(), |
|
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
327 | centres: (&self.centres).$fn(t), |
| 0 | 328 | } |
| 329 | } | |
| 330 | } | |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
331 | }; |
| 0 | 332 | } |
| 333 | ||
| 334 | make_convolutionsupportgenerator_scalarop_rhs!(Mul, mul, MulAssign, mul_assign); | |
| 335 | make_convolutionsupportgenerator_scalarop_rhs!(Div, div, DivAssign, div_assign); | |
| 336 | ||
| 337 | /// Generates an unary operation (e.g. [`std::ops::Neg`]) for [`ConvolutionSupportGenerator`]. | |
| 338 | macro_rules! make_convolutionsupportgenerator_unaryop { | |
| 339 | ($trait:ident, $fn:ident) => { | |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
340 | impl<F: Float, K: SimpleConvolutionKernel<N, F>, const N: usize> std::ops::$trait |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
341 | for ConvolutionSupportGenerator<K, N, F> |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
342 | { |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
343 | type Output = ConvolutionSupportGenerator<K, N, F>; |
| 0 | 344 | fn $fn(mut self) -> Self::Output { |
| 345 | self.centres = self.centres.$fn(); | |
| 346 | self | |
| 347 | } | |
| 348 | } | |
| 349 | ||
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
350 | impl<'a, F: Float, K: SimpleConvolutionKernel<N, F>, const N: usize> std::ops::$trait |
|
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
351 | for &'a ConvolutionSupportGenerator<K, N, F> |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
352 | { |
|
61
4f468d35fa29
General forward operators, separation of measures into own crate, and other architecture improvements to support the pointsource_pde crate.
Tuomo Valkonen <tuomov@iki.fi>
parents:
54
diff
changeset
|
353 | type Output = ConvolutionSupportGenerator<K, N, F>; |
| 0 | 354 | fn $fn(self) -> Self::Output { |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
355 | ConvolutionSupportGenerator { |
|
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
356 | kernel: self.kernel.clone(), |
|
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
357 | centres: (&self.centres).$fn(), |
| 0 | 358 | } |
| 359 | } | |
| 360 | } | |
|
54
b3312eee105c
Make some math in documentation render
Tuomo Valkonen <tuomov@iki.fi>
parents:
35
diff
changeset
|
361 | }; |
| 0 | 362 | } |
| 363 | ||
| 364 | make_convolutionsupportgenerator_unaryop!(Neg, neg); |