MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / landweber

Function landweber

src/api/c/deconvolution.cpp:130–153  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128
129template<typename T, typename CT>
130void landweber(Array<T>& currentEstimate, const Array<T>& in,
131 const Array<CT>& P, const Array<CT>& Pc, const unsigned iters,
132 const float relaxFactor, const float normFactor,
133 const dim4 odims) {
134 const dim4& dims = P.dims();
135
136 auto I = fft_r2c<CT, T>(in, BASE_DIM);
137 auto Pn = complexNorm<T, CT>(P);
138 auto ONE = createValueArray(dims, scalar<T>(1.0));
139 auto alpha = createValueArray(dims, scalar<T>(relaxFactor));
140 auto alphaC = cast<CT>(alpha);
141 auto prod = arithOp<T, af_mul_t>(alpha, Pn, dims);
142 auto lhsFac = arithOp<T, af_sub_t>(ONE, prod, dims);
143 auto lhs = cast<CT>(lhsFac);
144 auto rhsFac = arithOp<CT, af_mul_t>(Pc, I, dims);
145 auto rhs = arithOp<CT, af_mul_t>(rhsFac, alphaC, dims);
146 auto iterTemp = I;
147
148 for (unsigned i = 0; i < iters; ++i) {
149 auto mul = arithOp<CT, af_mul_t>(iterTemp, lhs, dims);
150 iterTemp = arithOp<CT, af_add_t>(mul, rhs, dims);
151 }
152 currentEstimate = fft_c2r<CT, T>(iterTemp, normFactor, odims, BASE_DIM);
153}
154
155template<typename InputType, typename RealType = float>
156af_array iterDeconv(const af_array in, const af_array ker, const uint iters,

Callers 1

iterDeconvFunction · 0.85

Calls 2

createValueArrayFunction · 0.50
dimsMethod · 0.45

Tested by

no test coverage detected