sisi4s
Loading...
Searching...
No Matches
RegularizedAlternatingLeastSquares.hpp
Go to the documentation of this file.
1#ifndef REGULARIZED_ALTERNATING_LEAST_SQUARES_DEFINED
2#define REGULARIZED_ALTERNATING_LEAST_SQUARES_DEFINED
3
4#include <math/Complex.hpp>
5#include <DryTensor.hpp>
6#include <util/Log.hpp>
7#include <util/Tensor.hpp>
8
9namespace sisi4s {
11public:
13 : swampingThreshold(0.0) {}
15 double regularizationFriction_,
16 double initialLambda_)
17 : swampingThreshold(swampingThreshold_)
18 , regularizationFriction(regularizationFriction_)
19 , lambda(initialLambda_) {}
22 virtual double getLambda() { return lambda; }
23 virtual void update(double const swampingFactor) {
24 double s(swampingFactor / swampingThreshold);
25 double estimatedLambda(lambda * s * s);
26 lambda = (1 - regularizationFriction) * estimatedLambda
28 }
29
30protected:
32 double lambda;
33};
34
37public:
39 virtual double getLambda() { return 0.0; }
40 virtual void update(double const swampingFactor) {}
41};
42
43template <typename F = double>
44void fitAlternatingLeastSquaresFactor(Tensor<F> &T,
45 char const *indicesT,
46 Tensor<F> &B,
47 char const idxB,
48 Tensor<F> &C,
49 char const idxC,
50 Tensor<F> &A,
51 char const idxA);
52
53template <typename F = double>
55 Tensor<F> &T,
56 char const *indicesT,
57 Tensor<F> &B,
58 char const idxB,
59 Tensor<F> &C,
60 char const idxC,
61 Tensor<F> &A,
62 char const idxA,
63 AlternatingLeastSquaresRegularizationEstimator *regularizationEstimatorA);
64
65template <typename F = double>
67 char const *indicesT,
68 DryTensor<F> &B,
69 char const idxB,
70 DryTensor<F> &C,
71 char const idxC,
72 DryTensor<F> &A,
73 char const idxA);
74} // namespace sisi4s
75
76#endif
Definition RegularizedAlternatingLeastSquares.hpp:10
virtual ~AlternatingLeastSquaresRegularizationEstimator()
Definition RegularizedAlternatingLeastSquares.hpp:20
virtual double getLambda()
Definition RegularizedAlternatingLeastSquares.hpp:22
double lambda
Definition RegularizedAlternatingLeastSquares.hpp:32
virtual void update(double const swampingFactor)
Definition RegularizedAlternatingLeastSquares.hpp:23
AlternatingLeastSquaresRegularizationEstimator(double swampingThreshold_, double regularizationFriction_, double initialLambda_)
Definition RegularizedAlternatingLeastSquares.hpp:14
double regularizationFriction
Definition RegularizedAlternatingLeastSquares.hpp:31
AlternatingLeastSquaresRegularizationEstimator()
Definition RegularizedAlternatingLeastSquares.hpp:12
double swampingThreshold
Definition RegularizedAlternatingLeastSquares.hpp:31
double getSwampingThreshold()
Definition RegularizedAlternatingLeastSquares.hpp:21
Definition RegularizedAlternatingLeastSquares.hpp:36
virtual double getLambda()
Definition RegularizedAlternatingLeastSquares.hpp:39
virtual ~NoRegularizationEstimator()
Definition RegularizedAlternatingLeastSquares.hpp:38
virtual void update(double const swampingFactor)
Definition RegularizedAlternatingLeastSquares.hpp:40
Definition Algorithm.hpp:10
void fitAlternatingLeastSquaresFactor(Tensor< F > &T, char const *indicesT, Tensor< F > &B, char const idxB, Tensor< F > &C, char const idxC, Tensor< F > &A, char const idxA)
Definition RegularizedAlternatingLeastSquares.cxx:14
void dryFitRegularizedAlternatingLeastSquaresFactor(DryTensor< F > &T, char const *indicesT, DryTensor< F > &B, char const idxB, DryTensor< F > &C, char const idxC, DryTensor< F > &A, char const idxA)
Definition RegularizedAlternatingLeastSquares.cxx:146
void fitRegularizedAlternatingLeastSquaresFactor(Tensor< F > &T, char const *indicesT, Tensor< F > &B, char const idxB, Tensor< F > &C, char const idxC, Tensor< F > &A, char const idxA, AlternatingLeastSquaresRegularizationEstimator *regularizationEstimatorA)
Definition RegularizedAlternatingLeastSquares.cxx:71