// tsncom21.cc // Nick Macks (macks@fnal.gov), Summer 2002 // CLHEP: HepSymMatrix inversion #include "CLHEP/Matrix/SymMatrix.h" using namespace std; // Function declarations void Identification(); void GetDimension(int&); void Describe(const int&); void BuildMatrix(HepSymMatrix&, const int&); void Show(const HepSymMatrix&); void GetMethod(char&); void GetCalcs(int&); void GetRuns(int&); void Calculate(HepSymMatrix&, const int&, const char&, const int&, const int&); // Package ID void Identification() { cout << "Using CLHEP\n"; } // Ask for the desired dimension void GetDimension(int& dimension) { cout << "Enter the desired dimension(1-6): "; cin >> dimension; while ( (dimension < 1) || (dimension > 6) ) { cout << "Enter an integer between 1 and 6: "; cin >> dimension; } } // Describe how the matrix was defined void Describe(const int& dimension) { cout << "Matrix was defined 'HepSymMatrix (" << dimension << ")'\n"; } // Build the matrix void BuildMatrix(HepSymMatrix& matrix, const int& dimension) { for (int i=0; i> method; while ( (method != 's') && (method != 'S') && (method != 't') && (method != 'T') ) { cout << "Enter s or t: "; cin >> method; } } // Get the number of calculations void GetCalcs(int& N) { cout << "How many inversions? "; cin >> N; } // Get the number of runs void GetRuns(int& run) { cout << "How many runs? "; cin >> run; cout << "\n"; } // Invert the matrix void Calculate(HepSymMatrix& matrix, const int& dimension, const char& imethod, const int& N, const int& runs) { // Define a counter int counter = 0; // Define a matrix to hold the result HepSymMatrix inverse (dimension); // Do we have an SPD matrix? int ifail = 0; if ( (imethod == 's') || (imethod == 'S') ) { // Loop "run" times for (int r=0; r