From 4964934a460f393318d024b79458035ff600fcec Mon Sep 17 00:00:00 2001 From: Emilie Marchandise <emilie.marchandise@uclouvain.be> Date: Thu, 6 May 2010 12:10:49 +0000 Subject: [PATCH] --- Solver/function.cpp | 18 ++++++++++++++++++ Solver/function.h | 1 + 2 files changed, 19 insertions(+) diff --git a/Solver/function.cpp b/Solver/function.cpp index 6143b8d781..4c2aebbb9a 100644 --- a/Solver/function.cpp +++ b/Solver/function.cpp @@ -174,7 +174,25 @@ function *functionSumNew(const function *f0, const function *f1) { } +class functionScale : public function { + public: + fullMatrix<double> _f0; + double _s; + void call(dataCacheMap *m, fullMatrix<double> &val) { + for(int i=0;i<val.size1();i++) + for(int j=0;j<val.size2();j++){ + val(i,j)= _f0(i,j)*_s; + } + } + functionScale(const function *f0, const double s):function(f0->getNbCol()){ + setArgument (_f0, f0); + _s = s; + } +}; +function *functionScaleNew(const function *f0, const double s) { + return new functionScale (f0, s); +} // get XYZ coordinates class functionCoordinates : public function { diff --git a/Solver/function.h b/Solver/function.h index 737c4f9071..8233c422fb 100644 --- a/Solver/function.h +++ b/Solver/function.h @@ -248,6 +248,7 @@ class functionReplaceCache { functionConstant *functionConstantNew(const std::vector<double>&); functionConstant *functionConstantNew(double); function *functionSumNew (const function *f0, const function *f1); +function *functionScaleNew (const function *f0, const double s); class functionSolution : public function { static functionSolution *_instance; -- GitLab