BloombergVector BloombergVector::operator+(double a) const{ Q_D(const BloombergVector); BloombergVector ResultVector(*this); for (int i = 0; i<d->m_VectVal.size(); i++) { ResultVector.d_func()->m_VectVal[i] += a; } ResultVector.RepackVector(); return ResultVector; }
SampleStatisticsEngine::ResultVector SampleStatisticsEngine::runOnBatch(const Bundle& bundle) { auto& input = bundle["inputActivations"].get<matrix::MatrixVector>().front(); util::log("SampleStatisticsEngine") << "Computing sample statistics over " << input.size().product() << " elements...\n"; for(auto element : input) { _samples += 1.0; double delta = element - _mean; _mean = _mean + delta / _samples; _sumOfSquaresOfDifferences += delta * (element - _mean); } util::log("SampleStatisticsEngine") << " mean " << _mean << ", sum of squares of differences " << _sumOfSquaresOfDifferences << ", samples " << _samples << "\n"; return ResultVector(); }
vector<double> zeros( unsigned int n ) { vector<double> ResultVector(n,0); //printf("Success, VECTOR of size %d created with zeroes.\n",n); return ResultVector; }