LibreOffice Module sc (master) 1
matrixoperators.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
9
10#include <matrixoperators.hxx>
11
12namespace sc::op
13{
14/* Simple operators */
15
16void Sum::operator()(KahanSum& rAccum, double fVal) const { rAccum += fVal; }
17
18const double Sum::InitVal = 0.0;
19
20void SumSquare::operator()(KahanSum& rAccum, double fVal) const { rAccum += fVal * fVal; }
21
22const double SumSquare::InitVal = 0.0;
23
24void Product::operator()(double& rAccum, double fVal) const { rAccum *= fVal; }
25
26const double Product::InitVal = 1.0;
27
28/* Op operators */
29
30void fkOpSum(KahanSum& rAccum, double fVal) { rAccum += fVal; }
31
32kOp kOpSum(0.0, fkOpSum);
33
34void fkOpSumSquare(KahanSum& rAccum, double fVal) { rAccum += fVal * fVal; }
35
37
38std::vector<kOp> kOpSumAndSumSquare = { kOpSum, kOpSumSquare };
39}
40
41/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This class provides LO with Kahan summation algorithm About this algorithm: https://en....
Definition: kahan.hxx:26
kOp kOpSum(0.0, fkOpSum)
kOp kOpSumSquare(0.0, fkOpSumSquare)
Op_< std::function< void(KahanSum &, double)>, KahanSum > kOp
std::vector< kOp > kOpSumAndSumSquare
void fkOpSumSquare(KahanSum &rAccum, double fVal)
void fkOpSum(KahanSum &rAccum, double fVal)
static const double InitVal
void operator()(double &rAccum, double fVal) const
void operator()(KahanSum &rAccum, double fVal) const
static const double InitVal
void operator()(KahanSum &rAccum, double fVal) const
static const double InitVal