Linopt
Linear optics circuit calculator
cost_functor.h
1 /* Copyright © 2018, 2019, Quantum Optical Technologies Laboratories
2  * <https://www.qotlabs.org/en/>
3  * Contributed by: Struchalin Gleb <struchalin.gleb@physics.msu.ru>
4  * Dyakonov Ivan <iv.dyakonov@physics.msu.ru>
5  *
6  * This file is part of Linopt.
7  *
8  * Linopt is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * Linopt is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with Linopt. If not, see <https://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef COST_FUNCTOR_H
23 #define COST_FUNCTOR_H
24 
25 #include <vector>
26 #include "circuit.h"
27 
28 namespace linopt
29 {
30 
32 {
33 public:
34  CostFunctor(const Basis &fullBasis,
35  const Basis &ancillaBasis,
36  const Fock &inputState,
37  const std::vector<State> &targetStates);
38  Real operator()(const Point &x);
39 
40 protected:
41  std::vector<State> targetStates;
42  Basis ancillaBasis;
43  Circuit C;
44 };
45 
47 {
48 public:
49  using CostFunctor::CostFunctor;
50  Real operator()(const Point &x);
51 };
52 
53 class LogFunctor: public CostFunctor
54 {
55 public:
56  using CostFunctor::CostFunctor;
57  Real operator()(const Point &x);
58 };
59 
60 } // Namespace linopt
61 
62 #endif // COST_FUNCTOR_H
Definition: cost_functor.h:31
Definition: cost_functor.h:46
The main namespace containing all library classes, functions, etc.
Definition: circuit.h:28
Definition: circuit.h:31
Definition: cost_functor.h:53
The class representing a Fock state.
Definition: states.h:56
The class representing a collection of Fock states.
Definition: states.h:181