// tsncom33.cc // Nick Macks (macks@fnal.gov), Summer 2002 // LinearAlgebra: ColumnVector*RowVector multiplication #include "LinearAlgebra/ColumnVector.h" #include "LinearAlgebra/Matrix.h" using namespace std; // Function declarations void Identification(); void GetDimension(int&); void Describe(const int&); void BuildCVector(ColumnVector&, const int&); void BuildRVector(RowVector&, const int&); void Show(const ColumnVector&, const RowVector&); void GetCalcs(int&); void GetRuns(int&); void Calculate(ColumnVector&, RowVector&, const int&, const int&, const int&); // Package ID void Identification() { cout << "Using LinearAlgebra\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 vectors were defined void Describe(const int& dimension) { cout << "Vectors were defined 'ColumnVector (" << dimension << ")' and\n"; cout << "'RowVector (" << dimension << ")'\n"; } // Build the ColumnVector void BuildCVector(ColumnVector& vector, const int& dimension) { for (int i=0; i> N; } // Get the number of runs void GetRuns(int& run) { cout << "How many runs? "; cin >> run; cout << "\n"; } // Multiply the two vectors void Calculate(ColumnVector& cvector, RowVector& rvector, const int& dimension, const int& N, const int& run) { // Define a counter int counter = 0; // Define a matrix to hold the result Matrix product (dimension, dimension); // Loop "run" times for (int r=0; r