Commit 7c219487 authored by Dmitry I. Lyakh's avatar Dmitry I. Lyakh

Updated TensorNetworkOptimizer interface.

parent 307d4060
/** ExaTN:: Optimizer of a closed tensor expansion functional
REVISION: 2020/01/24
/** ExaTN:: Variational optimizer of a closed symmetric tensor network expansion functional
REVISION: 2020/01/26
Copyright (C) 2018-2020 Dmitry I. Lyakh (Liakh)
Copyright (C) 2018-2020 Oak Ridge National Laboratory (UT-Battelle) **/
......@@ -10,26 +10,23 @@ Copyright (C) 2018-2020 Oak Ridge National Laboratory (UT-Battelle) **/
namespace exatn{
TensorNetworkOptimizer::TensorNetworkOptimizer(std::shared_ptr<TensorExpansion> expansion,
TensorNetworkOptimizer::TensorNetworkOptimizer(std::shared_ptr<TensorOperator> tensor_operator,
std::shared_ptr<TensorExpansion> vector_expansion,
double tolerance):
expansion_(expansion), tolerance_(tolerance), accuracy_(-1.0)
tensor_operator_(tensor_operator), vector_expansion_(vector_expansion), tolerance_(tolerance)
{
}
std::shared_ptr<TensorExpansion> TensorNetworkOptimizer::getSolution(double * accuracy)
std::shared_ptr<TensorExpansion> TensorNetworkOptimizer::getSolution()
{
if(accuracy_ < 0.0) return std::shared_ptr<TensorExpansion>(nullptr);
if(accuracy != nullptr) *accuracy = accuracy_;
return expansion_;
return vector_expansion_;
}
bool TensorNetworkOptimizer::optimize(double * accuracy)
bool TensorNetworkOptimizer::optimize()
{
assert(accuracy != nullptr);
//`Finish
*accuracy = accuracy_;
return true;
}
......
/** ExaTN:: Optimizer of a closed tensor network expansion functional
REVISION: 2020/01/24
/** ExaTN:: Variational optimizer of a closed symmetric tensor network expansion functional
REVISION: 2020/01/26
Copyright (C) 2018-2020 Dmitry I. Lyakh (Liakh)
Copyright (C) 2018-2020 Oak Ridge National Laboratory (UT-Battelle) **/
/** Rationale:
(A) Given a closed tensor network expansion functional, the tensor network
expansion optimizer optimizes tensor factors to achieve an extremum of
that functional.
(A) Given a closed symmetric tensor network expansion functional, composed
of some tensor operator closed from both sides by the bra and ket
vectors formed by the same tensor network expansion, this tensor network
variational optimizer will optimize the tensor factors constituting the
bra/ket tensor network vectors to arrive at an extremum of that functional.
**/
#ifndef EXATN_OPTIMIZER_HPP_
......@@ -23,8 +25,9 @@ class TensorNetworkOptimizer{
public:
TensorNetworkOptimizer(std::shared_ptr<TensorExpansion> expansion, //inout: closed tensor network expansion functional to optimize
double tolerance); //in: desired numerical convergence tolerance
TensorNetworkOptimizer(std::shared_ptr<TensorOperator> tensor_operator, //in: hermitian tensor network operator
std::shared_ptr<TensorExpansion> vector_expansion, //inout: tensor network expansion forming the bra/ket vectors
double tolerance); //in: desired numerical convergence tolerance
TensorNetworkOptimizer(const TensorNetworkOptimizer &) = default;
TensorNetworkOptimizer & operator=(const TensorNetworkOptimizer &) = default;
......@@ -32,18 +35,17 @@ public:
TensorNetworkOptimizer & operator=(TensorNetworkOptimizer &&) noexcept = default;
~TensorNetworkOptimizer() = default;
/** Optimizes the given closed tensor network expansion functional.
Upon success, returns the achieved accuracy of the optimization. **/
bool optimize(double * accuracy);
/** Optimizes the given closed symmetric tensor network expansion functional. **/
bool optimize();
/** Returns the optimized tensor network expansion functional. **/
std::shared_ptr<TensorExpansion> getSolution(double * accuracy = nullptr);
/** Returns the optimized tensor network expansion forming the optimal bra/ket vectors. **/
std::shared_ptr<TensorExpansion> getSolution();
private:
std::shared_ptr<TensorExpansion> expansion_; //closed tensor network expansion functional to optimize
double tolerance_; //numerical optimization convergence tolerance
double accuracy_; //actually achieved optimization accuracy
std::shared_ptr<TensorOperator> tensor_operator_; //tensor operator
std::shared_ptr<TensorExpansion> vector_expansion_; //tensor network expansion to optimize (bra/ket vector)
double tolerance_; //desired numerical optimization convergence tolerance
};
} //namespace exatn
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment