1#ifndef RIVET_MATH_MATRIXDIAG
2#define RIVET_MATH_MATRIXDIAG
4#include "Rivet/Math/MathConstants.hh"
5#include "Rivet/Math/MatrixN.hh"
17EigenSystem<N> diagonalize(
const Matrix<N>& m);
24 friend EigenSystem<M> diagonalize(
const Matrix<M>&);
28 typedef pair<double, Vector<N> > EigenPair;
29 typedef vector<EigenPair> EigenPairs;
31 Vector<N> getDiagVector()
const {
32 assert(_eigenPairs.size() == N);
34 for (
size_t i = 0; i < N; ++i) {
35 ret.set(i, _eigenPairs[i].first);
40 Matrix<N> getDiagMatrix()
const {
41 return Matrix<N>::mkDiag(getDiagVector());
44 EigenPairs getEigenPairs()
const {
48 vector<double> getEigenValues()
const {
49 assert(_eigenPairs.size() == N);
51 for (
size_t i = 0; i < N; ++i) {
52 ret.push_back(_eigenPairs[i].first);
57 vector<Vector<N> > getEigenVectors()
const {
58 assert(_eigenPairs.size() == N);
59 vector<Vector<N> > ret;
60 for (
size_t i = 0; i < N; ++i) {
61 ret.push_back(_eigenPairs[i].second);
68 EigenPairs _eigenPairs;
76 public std::binary_function<const typename EigenSystem<N>::EigenPair&,
77 const typename EigenSystem<N>::EigenPair&, bool> {
78 bool operator()(
const typename EigenSystem<N>::EigenPair& a,
79 const typename EigenSystem<N>::EigenPair& b) {
80 return a.first < b.first;
132inline const string toString(
const typename EigenSystem<N>::EigenPair& e) {
135 ss << e->first <<
" -> " << e->second;
142inline ostream&
operator<<(std::ostream& out,
const typename EigenSystem<N>::EigenPair& e) {
Definition MC_CENT_PPB_Projections.hh:10
std::ostream & operator<<(std::ostream &os, const AnalysisInfo &ai)
Stream an AnalysisInfo as a text description.
Definition AnalysisInfo.hh:362
std::string toString(const AnalysisInfo &ai)
String representation.