Unitary optimization worker. More...
#include <unitary.h>
Public Member Functions | |
UnitaryOptimizer (double Gthr, double Fthr, bool verbose=true, bool real=false) | |
Constructor. | |
virtual | ~UnitaryOptimizer () |
Destructor. | |
void | open_log (const std::string &fname) |
Open log file. | |
void | set_debug (bool dbg) |
Set debug mode. | |
void | set_poly (int deg) |
Set polynomial search options. | |
void | set_fourier (int Nsamples, int Nperiods) |
Set Fourier search options. | |
void | set_thr (double Gtol, double Ftol) |
Set convergence threshold. | |
double | optimize (UnitaryFunction *&f, enum unitmethod met, enum unitacc acc, size_t maxiter) |
Unitary optimization. | |
Protected Member Functions | |
virtual void | print_legend (const UnitaryFunction *f) const |
Print legend. | |
virtual void | print_progress (size_t k, UnitaryFunction *f, const UnitaryFunction *fold) const |
Print progress. | |
virtual void | print_time (const Timer &t) const |
Print time. | |
virtual void | print_step (enum unitmethod &met, double step) const |
Print chosen step length. | |
void | check_unitary (const arma::cx_mat &W) const |
Check that the matrix is unitary. | |
void | check_derivative (const UnitaryFunction *f) |
Check that the programmed cost function and its derivative are OK. | |
void | classify (const arma::cx_mat &W) const |
Classify matrix. | |
void | update_gradient (const arma::cx_mat &W, UnitaryFunction *f) |
Get new gradient direction. | |
void | update_search_direction (int q) |
Compute new search direction (diagonalize H) and max step length. | |
arma::cx_mat | get_rotation (double step) const |
Get rotation matrix with wanted step size. | |
double | step_der (const arma::cx_mat &W, const arma::cx_mat &der) const |
Get derivative wrt step length. | |
void | set_q (int q) |
Set degree. | |
void | armijo_step (UnitaryFunction *&f) |
Armijo step. | |
void | polynomial_step_f (UnitaryFunction *&f) |
Polynomial step (fit function) | |
void | polynomial_step_df (UnitaryFunction *&f) |
Polynomial step (fit only derivative) | |
void | fourier_step_df (UnitaryFunction *&f) |
Fourier step. | |
Protected Attributes | |
bool | verbose |
Verbose operation? | |
bool | real |
Operate with real or complex matrices? | |
double | Gthr |
Convergence threshold wrt norm of Riemannian derivative. | |
double | Fthr |
Convergence threshold wrt relative change in function. | |
int | polynomial_degree |
Degree of polynomial used for fit: a_0 + a_1*mu + ... + a_(d-1)*mu^(d-1) | |
int | fourier_periods |
Amount of quasi-periods for Fourier method (N_T = 1, 2, ...) | |
int | fourier_samples |
Amount of samples per one period (K = 3, 4, or 5) | |
bool | debug |
Debugging mode - print out line search every iteration. | |
FILE * | log |
Log file. | |
Private Attributes | |
arma::cx_mat | G |
Gradient. | |
arma::cx_mat | H |
Search direction. | |
arma::cx_mat | Hvec |
Eigenvectors of search direction. | |
arma::vec | Hval |
Eigenvalues of search direction. | |
double | Tmu |
Maximum step size. | |
Unitary optimization worker.