X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=libctsupport%2Fplotfile.cpp;h=b9e8ac641b5a80a3b5e905600634bf4f41605473;hp=5a160cdbe4bbf31a1f18291b1f887e0962bc8c81;hb=f7d2b7144f32a7bd157b7689022e62944b82fcc1;hpb=fd1d136a94a6d20013f38d6a997bdfefad0f5e98 diff --git a/libctsupport/plotfile.cpp b/libctsupport/plotfile.cpp index 5a160cd..b9e8ac6 100644 --- a/libctsupport/plotfile.cpp +++ b/libctsupport/plotfile.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: plotfile.cpp,v 1.3 2000/12/20 20:08:48 kevin Exp $ +** $Id: plotfile.cpp,v 1.4 2000/12/21 03:40:58 kevin Exp $ ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License (version 2) as @@ -153,15 +153,17 @@ PlotFile::statistics (int iStartingCol, double& min, double& max, double& mean, int iOffset = iStartingCol * m_iNumRecords; int iNPoints = (m_iNumColumns - iStartingCol) * m_iNumRecords; - std::vector vec (iNPoints); + std::vector vec; + vec.resize (iNPoints); + int iVec = 0; for (int iCol = iStartingCol; iCol < m_iNumColumns; iCol++) { int iOffset = iCol * m_iNumRecords; for (int iRec = 0; iRec < m_iNumRecords; iRec++) - vec.push_back( m_vecCurves[ iRec + iOffset ] ); + vec[iVec++] = m_vecCurves[ iRec + iOffset ]; } - vectorNumericStatistics (vec, min, max, mean, mode, median, stddev); + vectorNumericStatistics (vec, iNPoints, min, max, mean, mode, median, stddev); return true; }