Kernel Quantum Probability Library
The KQP library aims at providing tools for working with quantums probabilities
collapse.hpp
1 /*
2  This file is part of the Kernel Quantum Probability library (KQP).
3 
4  KQP is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  KQP is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with KQP. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef __KQP_CLEANING_COLLAPSE_H__
19 #define __KQP_CLEANING_COLLAPSE_H__
20 
21 #include <kqp/kqp.hpp>
22 #include <kqp/feature_matrix.hpp>
23 #include <kqp/cleanup.hpp>
24 
25 
26 namespace kqp {
27 
28  template<typename Scalar>
29  class CleanerCollapse: public Cleaner<Scalar> {
30  virtual void cleanup(Decomposition<Scalar> &d) const {
32  d.mX = d.fs->linearCombination(d.mX, d.mY);
33  d.mY = typename kqp::AltDense<Scalar>::IdentityType(d.mX->size(), d.mX->size());
34  }
35  };
36  };
37 
38 }
39 
40 #endif