LanguageTool: don't crash if REST protocol isn't set
[LibreOffice.git] / sc / inc / matrixoperators.hxx
blob7d994bc6067cad70e202a1cab71006a252975298
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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 */
10 #pragma once
13 #include <functional>
14 #include <vector>
15 #include "math.hxx"
17 namespace sc::op {
20 template<typename T, typename tRes>
21 struct Op_
23 const double mInitVal;
24 const T maOp;
25 Op_(double InitVal, T aOp):
26 mInitVal(InitVal), maOp(aOp)
29 void operator()(tRes& rAccum, double fVal) const
31 maOp(rAccum, fVal);
35 using Op = Op_<std::function<void(double&, double)>, double>;
36 using kOp = Op_<std::function<void(KahanSum&, double)>, KahanSum>;
38 void fkOpSum(KahanSum& rAccum, double fVal);
39 void fkOpSumSquare(KahanSum& rAccum, double fVal);
41 extern kOp kOpSum;
42 extern kOp kOpSumSquare;
43 extern std::vector<kOp> kOpSumAndSumSquare;
45 struct Sum
47 static const double InitVal;
48 void operator()(KahanSum& rAccum, double fVal) const;
51 struct SumSquare
53 static const double InitVal;
54 void operator()(KahanSum& rAccum, double fVal) const;
57 struct Product
59 static const double InitVal;
60 void operator()(double& rAccum, double fVal) const;
67 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */