Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
xerus
xerus
Commits
c3777c6e
Commit
c3777c6e
authored
Apr 14, 2020
by
Philipp Trunschke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add version of uq_ra_adf that takes initial values
parent
3596678d
Pipeline
#1948
failed with stages
in 11 minutes and 57 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
6 deletions
+33
-6
include/xerus/applications/uqAdf.h
include/xerus/applications/uqAdf.h
+12
-3
src/xerus/applications/uqAdf.cpp
src/xerus/applications/uqAdf.cpp
+16
-3
src/xerus/python/recovery.cpp
src/xerus/python/recovery.cpp
+5
-0
No files found.
include/xerus/applications/uqAdf.h
View file @
c3777c6e
...
...
@@ -50,7 +50,17 @@ namespace xerus { namespace uq {
*/
TTTensor
uq_ra_adf
(
const
std
::
vector
<
std
::
vector
<
Tensor
>>&
_positions
,
const
std
::
vector
<
Tensor
>&
_solutions
,
const
std
::
vector
<
size_t
>&
_dimensions
,
const
double
_targetEps
=
1e-8
,
const
size_t
_maxItr
=
0
);
/**
* @brief Rank adaptive ADF to calculate the UQ solution for given measurements.
* @param _x Initial value.
* @param _positions The positions of the measurements.
* @param _solutions The measured solutions corresponding to the @a _positions.
* @param _dimensions The dimensions of the final solution tensor.
* @param _targetEps TODO describe effect
* @param _maxItr Maximal number of iterations to perform.
*/
TTTensor
uq_ra_adf
(
const
TTTensor
&
_x
,
const
std
::
vector
<
std
::
vector
<
Tensor
>>&
_positions
,
const
std
::
vector
<
Tensor
>&
_solutions
,
const
std
::
vector
<
size_t
>&
_dimensions
,
const
double
_targetEps
=
1e-8
,
const
size_t
_maxItr
=
0
);
/**
* @brief Rank adaptive ADF to calculate the UQ solution for given weighted measurements.
* @param _positions The positions of the measurements.
...
...
@@ -63,6 +73,5 @@ namespace xerus { namespace uq {
TTTensor
uq_ra_adf
(
const
std
::
vector
<
std
::
vector
<
Tensor
>>&
_positions
,
const
std
::
vector
<
Tensor
>&
_solutions
,
const
std
::
vector
<
double
>&
_weights
,
const
std
::
vector
<
size_t
>&
_dimensions
,
const
double
_targetEps
=
1e-8
,
const
size_t
_maxItr
=
0
);
// TODO How is this different to the inplace variant? Also very confusing that it changes _x inplace AND returns it.
TTTensor
uq_ra_adf_iv
(
TTTensor
&
_x
,
const
UQMeasurementSet
&
_measurements
,
const
PolynomBasis
_basisType
,
const
double
_targetEps
=
1e-8
,
const
size_t
_maxItr
=
0
);
TTTensor
uq_ra_adf
(
const
TTTensor
&
_x
,
const
UQMeasurementSet
&
_measurements
,
const
PolynomBasis
_basisType
,
const
double
_targetEps
=
1e-8
,
const
size_t
_maxItr
=
0
);
}}
src/xerus/applications/uqAdf.cpp
View file @
c3777c6e
...
...
@@ -673,6 +673,17 @@ namespace xerus { namespace uq { namespace impl_uqRaAdf {
solver
.
solve
();
return
x
;
}
TTTensor
uq_ra_adf
(
const
TTTensor
&
_x
,
const
std
::
vector
<
std
::
vector
<
Tensor
>>&
_positions
,
const
std
::
vector
<
Tensor
>&
_solutions
,
const
std
::
vector
<
size_t
>&
_dimensions
,
const
double
_targetEps
,
const
size_t
_maxItr
)
{
REQUIRE
(
_positions
.
size
()
==
_solutions
.
size
(),
"Invalid measurments"
);
REQUIRE
(
_dimensions
.
front
()
==
_solutions
.
front
().
size
,
"Inconsitent spacial dimension"
);
TTTensor
x
(
_x
);
x
.
canonicalize_left
();
impl_uqRaAdf
::
InternalSolver
<
2
>
solver
(
x
,
_positions
,
_solutions
,
_maxItr
,
_targetEps
,
1e-1
);
solver
.
solve
();
return
x
;
}
TTTensor
uq_ra_adf
(
const
std
::
vector
<
std
::
vector
<
Tensor
>>&
_positions
,
const
std
::
vector
<
Tensor
>&
_solutions
,
const
std
::
vector
<
double
>&
_weights
,
const
std
::
vector
<
size_t
>&
_dimensions
,
const
double
_targetEps
,
const
size_t
_maxItr
)
{
...
...
@@ -699,7 +710,7 @@ namespace xerus { namespace uq { namespace impl_uqRaAdf {
}
TTTensor
uq_ra_adf
(
TTTensor
&
_x
,
const
UQMeasurementSet
&
_measurments
,
const
PolynomBasis
_basisType
,
const
double
_targetEps
,
const
size_t
_maxItr
)
{
TTTensor
uq_ra_adf
(
const
TTTensor
&
_x
,
const
UQMeasurementSet
&
_measurments
,
const
PolynomBasis
_basisType
,
const
double
_targetEps
,
const
size_t
_maxItr
)
{
REQUIRE
(
_measurments
.
parameterVectors
.
size
()
==
_measurments
.
solutions
.
size
(),
"Invalid measurments"
);
REQUIRE
(
_x
.
dimensions
.
front
()
==
_measurments
.
solutions
.
front
().
size
,
"Inconsitent spacial dimension"
);
...
...
@@ -712,9 +723,11 @@ namespace xerus { namespace uq { namespace impl_uqRaAdf {
}
}
}
impl_uqRaAdf
::
InternalSolver
<
2
>
solver
(
_x
,
_measurments
,
_basisType
,
_maxItr
,
_targetEps
,
1e-1
);
TTTensor
x
(
_x
);
impl_uqRaAdf
::
InternalSolver
<
2
>
solver
(
x
,
_measurments
,
_basisType
,
_maxItr
,
_targetEps
,
1e-1
);
solver
.
solve
();
return
_
x
;
return
x
;
}
}}
// namespace uq | xerus
src/xerus/python/recovery.cpp
View file @
c3777c6e
...
...
@@ -130,6 +130,11 @@ void expose_recoveryAlgorithms(module& m) {
},
arg
(
"positions"
),
arg
(
"solutions"
),
arg
(
"dimensions"
),
arg
(
"targeteps"
),
arg
(
"maxitr"
)
);
m
.
def
(
"uq_ra_adf"
,
+
[](
const
TTTensor
&
_x
,
const
std
::
vector
<
std
::
vector
<
Tensor
>>&
_positions
,
const
std
::
vector
<
Tensor
>&
_solutions
,
const
std
::
vector
<
size_t
>&
_dimensions
,
const
double
_targetEps
,
const
size_t
_maxItr
){
return
uq
::
uq_ra_adf
(
_x
,
_positions
,
_solutions
,
_dimensions
,
_targetEps
,
_maxItr
);
},
arg
(
"x"
),
arg
(
"positions"
),
arg
(
"solutions"
),
arg
(
"dimensions"
),
arg
(
"targeteps"
),
arg
(
"maxitr"
)
);
m
.
def
(
"uq_ra_adf"
,
+
[](
const
std
::
vector
<
std
::
vector
<
Tensor
>>&
_positions
,
const
std
::
vector
<
Tensor
>&
_solutions
,
const
std
::
vector
<
double
>&
_weights
,
const
std
::
vector
<
size_t
>&
_dimensions
,
const
double
_targetEps
,
const
size_t
_maxItr
){
return
uq
::
uq_ra_adf
(
_positions
,
_solutions
,
_weights
,
_dimensions
,
_targetEps
,
_maxItr
);
},
arg
(
"positions"
),
arg
(
"solutions"
),
arg
(
"weights"
),
arg
(
"dimensions"
),
arg
(
"targeteps"
),
arg
(
"maxitr"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment