[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/inc sc/source

Kohei Yoshida kohei.yoshida at gmail.com
Tue Jul 2 09:26:50 PDT 2013


 sc/inc/formulagroup.hxx                  |    2 ++
 sc/source/core/opencl/formulagroupcl.cxx |    7 +++++++
 sc/source/core/tool/formulagroup.cxx     |    5 +++++
 sc/source/core/tool/interpr5.cxx         |   12 ++++++++++++
 4 files changed, 26 insertions(+)

New commits:
commit 3262cac1a8e55d9525b7a0e8192947caa96cd7e8
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Tue Jul 2 12:26:16 2013 -0400

    Add a way to inverse matrix using openCL. It's an no-op for now.
    
    Change-Id: I4659d57505c3dccf872e124b8b569e680b307b71

diff --git a/sc/inc/formulagroup.hxx b/sc/inc/formulagroup.hxx
index e5839e4..1c573c4 100644
--- a/sc/inc/formulagroup.hxx
+++ b/sc/inc/formulagroup.hxx
@@ -43,6 +43,7 @@ class SC_DLLPUBLIC FormulaGroupInterpreter
  public:
     static FormulaGroupInterpreter *getStatic();
 
+    virtual ScMatrixRef inverseMatrix(const ScMatrix& rMat) = 0;
     virtual bool interpret(ScDocument& rDoc, const ScAddress& rTopPos, const ScFormulaCellGroupRef& xGroup, ScTokenArray& rCode) = 0;
 };
 
@@ -54,6 +55,7 @@ public:
         FormulaGroupInterpreter() {}
     virtual ~FormulaGroupInterpreterSoftware() {}
 
+    virtual ScMatrixRef inverseMatrix(const ScMatrix& rMat);
     virtual bool interpret(ScDocument& rDoc, const ScAddress& rTopPos, const ScFormulaCellGroupRef& xGroup, ScTokenArray& rCode);
 };
 
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index 41e439c..9530276 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -51,10 +51,17 @@ public:
     {
         OclCalc::ReleaseOpenclRunEnv();
     }
+
+    virtual ScMatrixRef inverseMatrix(const ScMatrix& rMat);
     virtual bool interpret(ScDocument& rDoc, const ScAddress& rTopPos,
                            const ScFormulaCellGroupRef& xGroup, ScTokenArray& rCode);
 };
 
+ScMatrixRef FormulaGroupInterpreterSoftware::inverseMatrix(const ScMatrix& rMat)
+{
+    return ScMatrixRef();
+}
+
 bool FormulaGroupInterpreterOpenCL::interpret(ScDocument& rDoc, const ScAddress& rTopPos,
                                               const ScFormulaCellGroupRef& xGroup, ScTokenArray& rCode)
 {
diff --git a/sc/source/core/tool/formulagroup.cxx b/sc/source/core/tool/formulagroup.cxx
index 4a04f79..4754bd0 100644
--- a/sc/source/core/tool/formulagroup.cxx
+++ b/sc/source/core/tool/formulagroup.cxx
@@ -20,6 +20,11 @@
 
 namespace sc {
 
+ScMatrixRef FormulaGroupInterpreterSoftware::inverseMatrix(const ScMatrix& /*rMat*/)
+{
+    return ScMatrixRef();
+}
+
 bool FormulaGroupInterpreterSoftware::interpret(ScDocument& rDoc, const ScAddress& rTopPos,
                                                 const ScFormulaCellGroupRef& xGroup,
                                                 ScTokenArray& rCode)
diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx
index 26c2378..d48cfe7 100644
--- a/sc/source/core/tool/interpr5.cxx
+++ b/sc/source/core/tool/interpr5.cxx
@@ -35,6 +35,7 @@
 #include "scmatrix.hxx"
 #include "globstr.hrc"
 #include "cellkeytranslator.hxx"
+#include "formulagroup.hxx"
 
 #include <vector>
 
@@ -850,6 +851,17 @@ void ScInterpreter::ScMatInv()
         }
         SCSIZE nC, nR;
         pMat->GetDimensions(nC, nR);
+
+        if (ScInterpreter::GetGlobalConfig().mbOpenCLEnabled)
+        {
+            ScMatrixRef xResMat = sc::FormulaGroupInterpreter::getStatic()->inverseMatrix(*pMat);
+            if (xResMat)
+            {
+                PushMatrix(xResMat);
+                return;
+            }
+        }
+
         if ( nC != nR || nC == 0 || (sal_uLong) nC * nC > ScMatrix::GetElementsMax() )
             PushIllegalArgument();
         else


More information about the Libreoffice-commits mailing list