#include <map>
#include <iostream>
#include <vector>
#include <cstdio>
#include <cstddef>
#include <cmath>
#include <TH1D.h>
#include <TF1.h>
#include <TMath.h>
Go to the source code of this file.
Classes | |
struct | beamlinereco::hit_t< T > |
class | beamlinereco::SGSmoothing |
class | beamlinereco::LEHitFinder< T > |
class | float_mat |
two dimensional floating point array More... | |
Namespaces | |
beamlinereco | |
Typedefs | |
using | float_vect = std::vector< double > |
comfortable array of doubles More... | |
using | int_vect = std::vector< int > |
comfortable array of ints; More... | |
Functions | |
std::vector< double > | beamlinereco::sg_smooth (const std::vector< double > &v, const int w, const int deg) |
std::vector< double > | beamlinereco::sg_derivative (const std::vector< double > &v, const int w, const int deg, const double h=1.0) |
void | permute (float_mat &A, int_vect &idx) |
permute() orders the rows of A to match the integers in the index array. More... | |
static int | partial_pivot (float_mat &A, const size_t row, const size_t col, float_vect &scale, int_vect &idx, double tol) |
Implicit partial pivoting. More... | |
static void | lu_backsubst (float_mat &A, float_mat &a, bool diag=false) |
Perform backward substitution. More... | |
static void | lu_forwsubst (float_mat &A, float_mat &a, bool diag=true) |
Perform forward substitution. More... | |
static int | lu_factorize (float_mat &A, int_vect &idx, double tol=TINY_FLOAT) |
Performs LU factorization in place. More... | |
static float_mat | lin_solve (const float_mat &A, const float_mat &a, double tol=TINY_FLOAT) |
Solve a system of linear equations. Solves the inhomogeneous matrix problem with lu-decomposition. Note that inversion may be accomplished by setting a to the identity_matrix. More... | |
static float_mat | invert (const float_mat &A) |
Returns the inverse of a matrix using LU-decomposition. More... | |
static float_mat | transpose (const float_mat &a) |
returns the transposed matrix. More... | |
float_mat | operator* (const float_mat &a, const float_mat &b) |
matrix multiplication. More... | |
static float_vect | sg_coeff (const float_vect &b, const size_t deg) |
calculate savitzky golay coefficients. More... | |
static float_vect | lsqr_fprime (const float_vect &b, const int deg) |
Variables | |
static const double | TINY_FLOAT = 1.0e-300 |
default convergence More... | |
using float_vect = std::vector<double> |
comfortable array of doubles
Definition at line 455 of file LEHitFinderAlg.h.
comfortable array of ints;
Definition at line 457 of file LEHitFinderAlg.h.
Returns the inverse of a matrix using LU-decomposition.
Definition at line 738 of file LEHitFinderAlg.h.
References E, MECModelEnuComparisons::i, lin_solve(), and getGoodRuns4SAM::n.
Referenced by lsqr_fprime(), and sg_coeff().
|
static |
Solve a system of linear equations. Solves the inhomogeneous matrix problem with lu-decomposition. Note that inversion may be accomplished by setting a to the identity_matrix.
Definition at line 715 of file LEHitFinderAlg.h.
References b, compare_h5_caf::idx, calib::j, lu_backsubst(), lu_factorize(), lu_forwsubst(), float_mat::nr_rows(), and permute().
Referenced by invert().
|
static |
least squares fit a polynome of degree 'deg' to data in 'b'. then calculate the first derivative and return it.
Definition at line 899 of file LEHitFinderAlg.h.
References genie::units::A, b, plot_validation_datamc::c, cols, d, beamlinereco::SGSmoothing::Derivative(), make_syst_table_plots::h, MECModelEnuComparisons::i, compare_h5_caf::idx, in, makeTrainCVSamples::int, invert(), calib::j, confusionMatrixTree::out, cet::pow(), fillBadChanDBTables::rows, beamlinereco::sg_derivative(), beamlinereco::sg_smooth(), beamlinereco::SGSmoothing::Smooth(), transpose(), w, and allInOneTrainingPlots::window.
Perform backward substitution.
Solves the system of equations A*b=a, ASSUMING that A is upper triangular. If diag==1, then the diagonal elements are additionally assumed to be 1. Note that the lower triangular elements are never checked, so this function is valid to use after a LU-decomposition in place. A is not modified, and the solution, b, is returned in a.
Definition at line 617 of file LEHitFinderAlg.h.
References plot_validation_datamc::c, float_mat::nr_cols(), float_mat::nr_rows(), and r().
Referenced by lin_solve().
|
static |
Performs LU factorization in place.
This is Crout's algorithm (cf., Num. Rec. in C, Section 2.3). The map of swapped indeces is recorded in idx. The return value is +1 or -1 depending on whether the number of row swaps was even or odd respectively. idx must be preinitialized to a valid set of indices (e.g., {1,2, ... ,A.nr_rows()}).
Definition at line 667 of file LEHitFinderAlg.h.
References plot_validation_datamc::c, stan::math::fabs(), MECModelEnuComparisons::i, makeTrainCVSamples::int, calib::j, float_mat::nr_cols(), float_mat::nr_rows(), partial_pivot(), permute(), r(), scale, and TINY_FLOAT.
Referenced by lin_solve().
Perform forward substitution.
Solves the system of equations A*b=a, ASSUMING that A is lower triangular. If diag==1, then the diagonal elements are additionally assumed to be 1. Note that the upper triangular elements are never checked, so this function is valid to use after a LU-decomposition in place. A is not modified, and the solution, b, is returned in a.
Definition at line 643 of file LEHitFinderAlg.h.
References plot_validation_datamc::c, float_mat::nr_cols(), float_mat::nr_rows(), and r().
Referenced by lin_solve().
matrix multiplication.
Definition at line 767 of file LEHitFinderAlg.h.
References MECModelEnuComparisons::i, calib::j, float_mat::nr_cols(), float_mat::nr_rows(), and sum.
|
static |
Implicit partial pivoting.
The function looks for pivot element only in rows below the current element, A[idx[row]][column], then swaps that row with the current one in the index map. The algorithm is for implicit pivoting (i.e., the pivot is chosen as if the max coefficient in each row is set to 1) based on the scaling information in the vector scale. The map of swapped indices is recorded in swp. The return value is +1 or -1 depending on whether the number of row swaps was even or odd respectively.
Definition at line 571 of file LEHitFinderAlg.h.
References stan::math::fabs(), calib::j, float_mat::nr_rows(), check_grl::row, TINY_FLOAT, and tmp.
Referenced by lu_factorize().
permute() orders the rows of A to match the integers in the index array.
Definition at line 536 of file LEHitFinderAlg.h.
References MECModelEnuComparisons::i, calib::j, float_mat::nr_rows(), and std::swap().
Referenced by lin_solve(), and lu_factorize().
|
static |
calculate savitzky golay coefficients.
Definition at line 791 of file LEHitFinderAlg.h.
References genie::units::A, plot_validation_datamc::c, demo5::c1, demo5::c2, cols, Munits::deg, MECModelEnuComparisons::i, makeTrainCVSamples::int, invert(), calib::j, cet::pow(), fillBadChanDBTables::rows, beamlinereco::sg_smooth(), transpose(), registry_explorer::v, and allInOneTrainingPlots::window.
returns the transposed matrix.
Definition at line 753 of file LEHitFinderAlg.h.
References MECModelEnuComparisons::i, calib::j, float_mat::nr_cols(), and float_mat::nr_rows().
Referenced by lsqr_fprime(), and sg_coeff().
|
static |
default convergence
Definition at line 452 of file LEHitFinderAlg.h.
Referenced by lu_factorize(), and partial_pivot().