Kaydet (Commit) 8e148863 authored tarafından Jan Holesovsky's avatar Jan Holesovsky

sc: Implement ScVectorRefMatrix.

This is a ScMatrix implementation that operates directly on
formula::DoubleVectorRefToken, saving tremendous amount of copying data back
and forth.

Change-Id: I027e6cb668ef40eb474773a0ce8d0eeefc1ab71c
üst 02226081
...@@ -40,6 +40,8 @@ class ScInterpreter; ...@@ -40,6 +40,8 @@ class ScInterpreter;
class SvNumberFormatter; class SvNumberFormatter;
class ScMatrixImpl; class ScMatrixImpl;
namespace formula { class DoubleVectorRefToken; }
namespace sc { namespace sc {
struct Compare; struct Compare;
...@@ -106,7 +108,7 @@ struct ScMatrixValue ...@@ -106,7 +108,7 @@ struct ScMatrixValue
} }
}; };
/// Abstract base class for ScFullMatrix and ScSubMatrix implementations. /// Abstract base class for ScFullMatrix and ScVectorRefMatrix implementations.
class SC_DLLPUBLIC ScMatrix class SC_DLLPUBLIC ScMatrix
{ {
mutable size_t nRefCnt; // reference count mutable size_t nRefCnt; // reference count
...@@ -604,6 +606,202 @@ public: ...@@ -604,6 +606,202 @@ public:
#endif #endif
}; };
class SC_DLLPUBLIC ScVectorRefMatrix : public ScMatrix
{
const formula::DoubleVectorRefToken* mpToken;
ScInterpreter* mpErrorInterpreter;
SCSIZE mnRowStart;
SCSIZE mnRowSize;
// only delete via Delete()
virtual ~ScVectorRefMatrix();
ScVectorRefMatrix( const ScVectorRefMatrix& ) = delete;
ScVectorRefMatrix& operator=( const ScVectorRefMatrix&) = delete;
public:
ScVectorRefMatrix(const formula::DoubleVectorRefToken* pToken, SCSIZE nRowStart, SCSIZE nRowSize);
/** Clone the matrix. */
virtual ScMatrix* Clone() const override;
/**
* Resize the matrix to specified new dimension.
*/
virtual void Resize(SCSIZE nC, SCSIZE nR) override;
virtual void Resize(SCSIZE nC, SCSIZE nR, double fVal) override;
/** Clone the matrix and extend it to the new size. nNewCols and nNewRows
MUST be at least of the size of the original matrix. */
virtual ScMatrix* CloneAndExtend(SCSIZE nNewCols, SCSIZE nNewRows) const override;
virtual void SetErrorInterpreter(ScInterpreter* p) override;
virtual void GetDimensions(SCSIZE& rC, SCSIZE& rR) const override;
virtual SCSIZE GetElementCount() const override;
virtual bool ValidColRow( SCSIZE nC, SCSIZE nR) const override;
/** For a row vector or column vector, if the position does not point into
the vector but is a valid column or row offset it is adapted such that
it points to an element to be replicated, same column row 0 for a row
vector, same row column 0 for a column vector. Else, for a 2D matrix,
returns false.
*/
virtual bool ValidColRowReplicated(SCSIZE & rC, SCSIZE & rR) const override;
/** Checks if the matrix position is within the matrix. If it is not, for a
row vector or column vector the position is adapted such that it points
to an element to be replicated, same column row 0 for a row vector,
same row column 0 for a column vector. Else, for a 2D matrix and
position not within matrix, returns false.
*/
virtual bool ValidColRowOrReplicated(SCSIZE & rC, SCSIZE & rR) const override;
virtual void PutDouble(double fVal, SCSIZE nC, SCSIZE nR) override;
virtual void PutDouble(double fVal, SCSIZE nIndex) override;
virtual void PutDouble(const double* pArray, size_t nLen, SCSIZE nC, SCSIZE nR) override;
virtual void PutString(const svl::SharedString& rStr, SCSIZE nC, SCSIZE nR) override;
virtual void PutString(const svl::SharedString& rStr, SCSIZE nIndex) override;
virtual void PutString(const svl::SharedString* pArray, size_t nLen, SCSIZE nC, SCSIZE nR) override;
virtual void PutEmpty(SCSIZE nC, SCSIZE nR) override;
/// Jump sal_False without path
virtual void PutEmptyPath(SCSIZE nC, SCSIZE nR) override;
virtual void PutError(sal_uInt16 nErrorCode, SCSIZE nC, SCSIZE nR ) override;
virtual void PutBoolean(bool bVal, SCSIZE nC, SCSIZE nR) override;
virtual void FillDouble(double fVal, SCSIZE nC1, SCSIZE nR1, SCSIZE nC2, SCSIZE nR2) override;
/** Put a column vector of doubles, starting at row nR, must fit into dimensions. */
virtual void PutDoubleVector(const ::std::vector< double > & rVec, SCSIZE nC, SCSIZE nR) override;
/** Put a column vector of strings, starting at row nR, must fit into dimensions. */
virtual void PutStringVector(const ::std::vector< svl::SharedString > & rVec, SCSIZE nC, SCSIZE nR) override;
/** Put a column vector of empties, starting at row nR, must fit into dimensions. */
virtual void PutEmptyVector(SCSIZE nCount, SCSIZE nC, SCSIZE nR) override;
/** Put a column vector of empty results, starting at row nR, must fit into dimensions. */
virtual void PutEmptyResultVector(SCSIZE nCount, SCSIZE nC, SCSIZE nR) override;
/** Put a column vector of empty paths, starting at row nR, must fit into dimensions. */
virtual void PutEmptyPathVector(SCSIZE nCount, SCSIZE nC, SCSIZE nR) override;
/** May be used before obtaining the double value of an element to avoid
passing its NAN around.
@ATTENTION: MUST NOT be used if the element is a string!
Use GetErrorIfNotString() instead if not sure.
@returns 0 if no error, else one of err... constants */
virtual sal_uInt16 GetError(SCSIZE nC, SCSIZE nR) const override;
/// @return 0.0 if empty or empty path, else value or DoubleError.
virtual double GetDouble(SCSIZE nC, SCSIZE nR) const override;
/// @return 0.0 if empty or empty path, else value or DoubleError.
virtual double GetDouble(SCSIZE nIndex) const override;
/// @return empty string if empty or empty path, else string content.
virtual svl::SharedString GetString(SCSIZE nC, SCSIZE nR) const override;
/// @return empty string if empty or empty path, else string content.
virtual svl::SharedString GetString(SCSIZE nIndex) const override;
/** @returns the matrix element's string if one is present, otherwise the
numerical value formatted as string, or in case of an error the error
string is returned; an empty string for empty, a "FALSE" string for
empty path. */
virtual svl::SharedString GetString(SvNumberFormatter& rFormatter, SCSIZE nC, SCSIZE nR) const override;
/// @ATTENTION: If bString the ScMatrixValue->pS may still be NULL to indicate
/// an empty string!
virtual ScMatrixValue Get(SCSIZE nC, SCSIZE nR) const override;
/// @return <TRUE/> if string or empty or empty path, in fact non-value.
virtual bool IsString(SCSIZE nIndex) const override;
/// @return <TRUE/> if string or empty or empty path, in fact non-value.
virtual bool IsString(SCSIZE nC, SCSIZE nR) const override;
/// @return <TRUE/> if empty or empty cell or empty result, not empty path.
virtual bool IsEmpty(SCSIZE nC, SCSIZE nR) const override;
/// @return <TRUE/> if empty cell, not empty or empty result or empty path.
virtual bool IsEmptyCell(SCSIZE nC, SCSIZE nR) const override;
/// @return <TRUE/> if empty result, not empty or empty cell or empty path.
virtual bool IsEmptyResult(SCSIZE nC, SCSIZE nR) const override;
/// @return <TRUE/> if empty path, not empty or empty cell or empty result.
virtual bool IsEmptyPath(SCSIZE nC, SCSIZE nR) const override;
/// @return <TRUE/> if value or boolean.
virtual bool IsValue(SCSIZE nIndex) const override;
/// @return <TRUE/> if value or boolean.
virtual bool IsValue(SCSIZE nC, SCSIZE nR) const override;
/// @return <TRUE/> if value or boolean or empty or empty path.
virtual bool IsValueOrEmpty(SCSIZE nC, SCSIZE nR) const override;
/// @return <TRUE/> if boolean.
virtual bool IsBoolean(SCSIZE nC, SCSIZE nR) const override;
/// @return <TRUE/> if entire matrix is numeric, including booleans, with no strings or empties
virtual bool IsNumeric() const override;
virtual void MatTrans(ScMatrix& mRes) const override;
virtual void MatCopy (ScMatrix& mRes) const override;
// Convert ScInterpreter::CompareMat values (-1,0,1) to boolean values
virtual void CompareEqual() override;
virtual void CompareNotEqual() override;
virtual void CompareLess() override;
virtual void CompareGreater() override;
virtual void CompareLessEqual() override;
virtual void CompareGreaterEqual() override;
virtual double And() const override; // logical AND of all matrix values, or NAN
virtual double Or() const override; // logical OR of all matrix values, or NAN
virtual double Xor() const override; // logical XOR of all matrix values, or NAN
virtual IterateResult Sum(bool bTextAsZero) const override;
virtual IterateResult SumSquare(bool bTextAsZero) const override;
virtual IterateResult Product(bool bTextAsZero) const override;
virtual size_t Count(bool bCountStrings) const override;
virtual size_t MatchDoubleInColumns(double fValue, size_t nCol1, size_t nCol2) const override;
virtual size_t MatchStringInColumns(const svl::SharedString& rStr, size_t nCol1, size_t nCol2) const override;
virtual double GetMaxValue(bool bTextAsZero) const override;
virtual double GetMinValue(bool bTextAsZero) const override;
virtual ScMatrixRef CompareMatrix(sc::Compare& rComp, size_t nMatPos, sc::CompareOptions* pOptions = nullptr) const override;
/**
* Convert the content of matrix into a linear array of numeric values.
* String elements are mapped to NaN's and empty elements are mapped to
* either NaN or zero values.
*
* @param bEmptyAsZero if true empty elements are mapped to zero values,
* otherwise they become NaN values.
*/
virtual void GetDoubleArray(std::vector<double>& rVector, bool bEmptyAsZero = true) const override;
virtual void MergeDoubleArray(std::vector<double>& rVector, Op eOp) const override;
virtual void NotOp(ScMatrix& rMat) override;
virtual void NegOp(ScMatrix& rMat) override;
virtual void AddOp(double fVal, ScMatrix& rMat) override;
virtual void SubOp(bool bFlag, double fVal, ScMatrix& rMat) override;
virtual void MulOp(double fVal, ScMatrix& rMat) override;
virtual void DivOp(bool bFlag, double fVal, ScMatrix& rMat) override;
virtual void PowOp(bool bFlag, double fVal, ScMatrix& rMat) override;
virtual std::vector<ScMatrix::IterateResult> Collect(bool bTextAsZero, const std::vector<std::unique_ptr<sc::op::Op>>& aOp) override;
ScVectorRefMatrix& operator+=(const ScVectorRefMatrix& r);
};
inline void intrusive_ptr_add_ref(const ScMatrix* p) inline void intrusive_ptr_add_ref(const ScMatrix* p)
{ {
p->IncRef(); p->IncRef();
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#ifndef INCLUDED_SC_SOURCE_CORE_INC_ARRAYSUMFUNCTOR_HXX #ifndef INCLUDED_SC_SOURCE_CORE_INC_ARRAYSUMFUNCTOR_HXX
#define INCLUDED_SC_SOURCE_CORE_INC_ARRAYSUMFUNCTOR_HXX #define INCLUDED_SC_SOURCE_CORE_INC_ARRAYSUMFUNCTOR_HXX
#include <cstdint>
#include <tools/cpuid.hxx> #include <tools/cpuid.hxx>
#if defined(LO_SSE2_AVAILABLE) #if defined(LO_SSE2_AVAILABLE)
......
...@@ -369,14 +369,23 @@ bool FormulaGroupInterpreterSoftware::interpret(ScDocument& rDoc, const ScAddres ...@@ -369,14 +369,23 @@ bool FormulaGroupInterpreterSoftware::interpret(ScDocument& rDoc, const ScAddres
case formula::svDoubleVectorRef: case formula::svDoubleVectorRef:
{ {
const formula::DoubleVectorRefToken* p2 = static_cast<const formula::DoubleVectorRefToken*>(p); const formula::DoubleVectorRefToken* p2 = static_cast<const formula::DoubleVectorRefToken*>(p);
const std::vector<formula::VectorRefArray>& rArrays = p2->GetArrays();
size_t nColSize = rArrays.size();
size_t nRowStart = p2->IsStartFixed() ? 0 : i; size_t nRowStart = p2->IsStartFixed() ? 0 : i;
size_t nRowEnd = p2->GetRefRowSize() - 1; size_t nRowEnd = p2->GetRefRowSize() - 1;
if (!p2->IsEndFixed()) if (!p2->IsEndFixed())
nRowEnd += i; nRowEnd += i;
ScMatrixRef pMat;
if (getenv("SC_ALLOW_SOFTWARE_INTERPRETER") != nullptr)
{
assert(nRowStart <= nRowEnd);
pMat.reset(new ScVectorRefMatrix(p2, nRowStart, nRowEnd - nRowStart + 1));
}
else
{
const std::vector<formula::VectorRefArray>& rArrays = p2->GetArrays();
size_t nColSize = rArrays.size();
size_t nRowSize = nRowEnd - nRowStart + 1; size_t nRowSize = nRowEnd - nRowStart + 1;
ScMatrixRef pMat(new ScFullMatrix(nColSize, nRowSize)); pMat.reset(new ScFullMatrix(nColSize, nRowSize));
size_t nDataRowEnd = p2->GetArrayLength() - 1; size_t nDataRowEnd = p2->GetArrayLength() - 1;
if (nRowStart > nDataRowEnd) if (nRowStart > nDataRowEnd)
...@@ -416,6 +425,7 @@ bool FormulaGroupInterpreterSoftware::interpret(ScDocument& rDoc, const ScAddres ...@@ -416,6 +425,7 @@ bool FormulaGroupInterpreterSoftware::interpret(ScDocument& rDoc, const ScAddres
fillMatrix(*pMat, nCol, pNums, nRowSize); fillMatrix(*pMat, nCol, pNums, nRowSize);
} }
} }
}
if (p2->IsStartFixed() && p2->IsEndFixed()) if (p2->IsStartFixed() && p2->IsEndFixed())
{ {
......
...@@ -17,10 +17,12 @@ ...@@ -17,10 +17,12 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ */
#include <arraysumfunctor.hxx>
#include "scmatrix.hxx" #include "scmatrix.hxx"
#include "global.hxx" #include "global.hxx"
#include "address.hxx" #include "address.hxx"
#include <formula/errorcodes.hxx> #include <formula/errorcodes.hxx>
#include <formula/vectortoken.hxx>
#include "interpre.hxx" #include "interpre.hxx"
#include "mtvelements.hxx" #include "mtvelements.hxx"
#include "compare.hxx" #include "compare.hxx"
...@@ -279,9 +281,9 @@ public: ...@@ -279,9 +281,9 @@ public:
double Or() const; double Or() const;
double Xor() const; double Xor() const;
ScFullMatrix::IterateResult Sum(bool bTextAsZero) const; ScMatrix::IterateResult Sum(bool bTextAsZero) const;
ScFullMatrix::IterateResult SumSquare(bool bTextAsZero) const; ScMatrix::IterateResult SumSquare(bool bTextAsZero) const;
ScFullMatrix::IterateResult Product(bool bTextAsZero) const; ScMatrix::IterateResult Product(bool bTextAsZero) const;
size_t Count(bool bCountStrings) const; size_t Count(bool bCountStrings) const;
size_t MatchDoubleInColumns(double fValue, size_t nCol1, size_t nCol2) const; size_t MatchDoubleInColumns(double fValue, size_t nCol1, size_t nCol2) const;
size_t MatchStringInColumns(const svl::SharedString& rStr, size_t nCol1, size_t nCol2) const; size_t MatchStringInColumns(const svl::SharedString& rStr, size_t nCol1, size_t nCol2) const;
...@@ -299,7 +301,7 @@ public: ...@@ -299,7 +301,7 @@ public:
void ApplyOperation(T aOp, ScMatrixImpl& rMat); void ApplyOperation(T aOp, ScMatrixImpl& rMat);
template<typename T> template<typename T>
std::vector<ScFullMatrix::IterateResult> ApplyCollectOperation(bool bTextAsZero, const std::vector<std::unique_ptr<T>>& aOp); std::vector<ScMatrix::IterateResult> ApplyCollectOperation(bool bTextAsZero, const std::vector<std::unique_ptr<T>>& aOp);
#if DEBUG_MATRIX #if DEBUG_MATRIX
void Dump() const; void Dump() const;
...@@ -999,13 +1001,13 @@ template<typename _Op> ...@@ -999,13 +1001,13 @@ template<typename _Op>
class WalkElementBlocks class WalkElementBlocks
{ {
_Op maOp; _Op maOp;
ScFullMatrix::IterateResult maRes; ScMatrix::IterateResult maRes;
bool mbFirst:1; bool mbFirst:1;
bool mbTextAsZero:1; bool mbTextAsZero:1;
public: public:
WalkElementBlocks(bool bTextAsZero) : maRes(_Op::InitVal, _Op::InitVal, 0), mbFirst(true), mbTextAsZero(bTextAsZero) {} WalkElementBlocks(bool bTextAsZero) : maRes(_Op::InitVal, _Op::InitVal, 0), mbFirst(true), mbTextAsZero(bTextAsZero) {}
const ScFullMatrix::IterateResult& getResult() const { return maRes; } const ScMatrix::IterateResult& getResult() const { return maRes; }
void operator() (const MatrixImplType::element_block_node_type& node) void operator() (const MatrixImplType::element_block_node_type& node)
{ {
...@@ -1068,7 +1070,7 @@ template<typename _Op> ...@@ -1068,7 +1070,7 @@ template<typename _Op>
class WalkElementBlocksMultipleValues class WalkElementBlocksMultipleValues
{ {
const std::vector<std::unique_ptr<_Op>>& maOp; const std::vector<std::unique_ptr<_Op>>& maOp;
std::vector<ScFullMatrix::IterateResult> maRes; std::vector<ScMatrix::IterateResult> maRes;
bool mbFirst:1; bool mbFirst:1;
bool mbTextAsZero:1; bool mbTextAsZero:1;
public: public:
...@@ -1082,7 +1084,7 @@ public: ...@@ -1082,7 +1084,7 @@ public:
maRes.emplace_back(0.0, 0.0, 0); // count maRes.emplace_back(0.0, 0.0, 0); // count
} }
const std::vector<ScFullMatrix::IterateResult>& getResult() const { return maRes; } const std::vector<ScMatrix::IterateResult>& getResult() const { return maRes; }
void operator() (const MatrixImplType::element_block_node_type& node) void operator() (const MatrixImplType::element_block_node_type& node)
{ {
...@@ -1752,7 +1754,7 @@ public: ...@@ -1752,7 +1754,7 @@ public:
namespace { namespace {
template<typename TOp> template<typename TOp>
ScFullMatrix::IterateResult GetValueWithCount(bool bTextAsZero, const MatrixImplType& maMat) ScMatrix::IterateResult GetValueWithCount(bool bTextAsZero, const MatrixImplType& maMat)
{ {
WalkElementBlocks<TOp> aFunc(bTextAsZero); WalkElementBlocks<TOp> aFunc(bTextAsZero);
maMat.walk(aFunc); maMat.walk(aFunc);
...@@ -1761,17 +1763,17 @@ ScFullMatrix::IterateResult GetValueWithCount(bool bTextAsZero, const MatrixImpl ...@@ -1761,17 +1763,17 @@ ScFullMatrix::IterateResult GetValueWithCount(bool bTextAsZero, const MatrixImpl
} }
ScFullMatrix::IterateResult ScMatrixImpl::Sum(bool bTextAsZero) const ScMatrix::IterateResult ScMatrixImpl::Sum(bool bTextAsZero) const
{ {
return GetValueWithCount<sc::op::Sum>(bTextAsZero, maMat); return GetValueWithCount<sc::op::Sum>(bTextAsZero, maMat);
} }
ScFullMatrix::IterateResult ScMatrixImpl::SumSquare(bool bTextAsZero) const ScMatrix::IterateResult ScMatrixImpl::SumSquare(bool bTextAsZero) const
{ {
return GetValueWithCount<sc::op::SumSquare>(bTextAsZero, maMat); return GetValueWithCount<sc::op::SumSquare>(bTextAsZero, maMat);
} }
ScFullMatrix::IterateResult ScMatrixImpl::Product(bool bTextAsZero) const ScMatrix::IterateResult ScMatrixImpl::Product(bool bTextAsZero) const
{ {
return GetValueWithCount<sc::op::Product>(bTextAsZero, maMat); return GetValueWithCount<sc::op::Product>(bTextAsZero, maMat);
} }
...@@ -2160,7 +2162,7 @@ void ScMatrixImpl::ApplyOperation(T aOp, ScMatrixImpl& rMat) ...@@ -2160,7 +2162,7 @@ void ScMatrixImpl::ApplyOperation(T aOp, ScMatrixImpl& rMat)
} }
template<typename T> template<typename T>
std::vector<ScFullMatrix::IterateResult> ScMatrixImpl::ApplyCollectOperation(bool bTextAsZero, const std::vector<std::unique_ptr<T>>& aOp) std::vector<ScMatrix::IterateResult> ScMatrixImpl::ApplyCollectOperation(bool bTextAsZero, const std::vector<std::unique_ptr<T>>& aOp)
{ {
WalkElementBlocksMultipleValues<T> aFunc(bTextAsZero, aOp); WalkElementBlocksMultipleValues<T> aFunc(bTextAsZero, aOp);
maMat.walk(aFunc); maMat.walk(aFunc);
...@@ -2550,17 +2552,17 @@ double ScFullMatrix::Xor() const ...@@ -2550,17 +2552,17 @@ double ScFullMatrix::Xor() const
return pImpl->Xor(); return pImpl->Xor();
} }
ScFullMatrix::IterateResult ScFullMatrix::Sum(bool bTextAsZero) const ScMatrix::IterateResult ScFullMatrix::Sum(bool bTextAsZero) const
{ {
return pImpl->Sum(bTextAsZero); return pImpl->Sum(bTextAsZero);
} }
ScFullMatrix::IterateResult ScFullMatrix::SumSquare(bool bTextAsZero) const ScMatrix::IterateResult ScFullMatrix::SumSquare(bool bTextAsZero) const
{ {
return pImpl->SumSquare(bTextAsZero); return pImpl->SumSquare(bTextAsZero);
} }
ScFullMatrix::IterateResult ScFullMatrix::Product(bool bTextAsZero) const ScMatrix::IterateResult ScFullMatrix::Product(bool bTextAsZero) const
{ {
return pImpl->Product(bTextAsZero); return pImpl->Product(bTextAsZero);
} }
...@@ -2815,7 +2817,7 @@ void ScFullMatrix::PowOp( bool bFlag, double fVal, ScMatrix& rMat) ...@@ -2815,7 +2817,7 @@ void ScFullMatrix::PowOp( bool bFlag, double fVal, ScMatrix& rMat)
} }
} }
std::vector<ScFullMatrix::IterateResult> ScFullMatrix::Collect(bool bTextAsZero, const std::vector<std::unique_ptr<sc::op::Op>>& aOp) std::vector<ScMatrix::IterateResult> ScFullMatrix::Collect(bool bTextAsZero, const std::vector<std::unique_ptr<sc::op::Op>>& aOp)
{ {
return pImpl->ApplyCollectOperation(bTextAsZero, aOp); return pImpl->ApplyCollectOperation(bTextAsZero, aOp);
} }
...@@ -2833,4 +2835,436 @@ void ScFullMatrix::Dump() const ...@@ -2833,4 +2835,436 @@ void ScFullMatrix::Dump() const
} }
#endif #endif
ScVectorRefMatrix::ScVectorRefMatrix(const formula::DoubleVectorRefToken* pToken, SCSIZE nRowStart, SCSIZE nRowSize)
: ScMatrix()
, mpToken(pToken)
, mnRowStart(nRowStart)
, mnRowSize(nRowSize)
{
}
ScVectorRefMatrix::~ScVectorRefMatrix()
{
}
ScMatrix* ScVectorRefMatrix::Clone() const
{
throw std::runtime_error("ScVectorRefMatrix::Clone() called");
}
void ScVectorRefMatrix::Resize(SCSIZE nC, SCSIZE nR)
{
throw std::runtime_error("ScVectorRefMatrix::Resize called");
}
void ScVectorRefMatrix::Resize(SCSIZE nC, SCSIZE nR, double fVal)
{
throw std::runtime_error("ScVectorRefMatrix::Resize called");
}
ScMatrix* ScVectorRefMatrix::CloneAndExtend(SCSIZE nNewCols, SCSIZE nNewRows) const
{
throw std::runtime_error("ScVectorRefMatrix::CloneAndExtend called");
}
void ScVectorRefMatrix::SetErrorInterpreter(ScInterpreter* p)
{
mpErrorInterpreter = p;
}
void ScVectorRefMatrix::GetDimensions(SCSIZE& rC, SCSIZE& rR) const
{
rC = mpToken->GetArrays().size();
rR = mnRowSize;
}
SCSIZE ScVectorRefMatrix::GetElementCount() const
{
throw std::runtime_error("ScVectorRefMatrix::GetElementCount called");
}
bool ScVectorRefMatrix::ValidColRow(SCSIZE nC, SCSIZE nR) const
{
throw std::runtime_error("ScVectorRefMatrix::ValidColRow called");
}
bool ScVectorRefMatrix::ValidColRowReplicated(SCSIZE & rC, SCSIZE & rR) const
{
throw std::runtime_error("ScVectorRefMatrix::ValidColRowReplicated called");
}
bool ScVectorRefMatrix::ValidColRowOrReplicated(SCSIZE & rC, SCSIZE & rR) const
{
throw std::runtime_error("ScVectorRefMatrix::ValidColRowOrReplicated called");
}
void ScVectorRefMatrix::PutDouble(double fVal, SCSIZE nC, SCSIZE nR)
{
throw std::runtime_error("ScVectorRefMatrix::PutDouble called");
}
void ScVectorRefMatrix::PutDouble(double fVal, SCSIZE nIndex)
{
throw std::runtime_error("ScVectorRefMatrix::PutDouble called");
}
void ScVectorRefMatrix::PutDouble(const double* pArray, size_t nLen, SCSIZE nC, SCSIZE nR)
{
throw std::runtime_error("ScVectorRefMatrix::PutDouble called");
}
void ScVectorRefMatrix::PutString(const svl::SharedString& rStr, SCSIZE nC, SCSIZE nR)
{
throw std::runtime_error("ScVectorRefMatrix::PutString called");
}
void ScVectorRefMatrix::PutString(const svl::SharedString& rStr, SCSIZE nIndex)
{
throw std::runtime_error("ScVectorRefMatrix::PutString called");
}
void ScVectorRefMatrix::PutString(const svl::SharedString* pArray, size_t nLen, SCSIZE nC, SCSIZE nR)
{
throw std::runtime_error("ScVectorRefMatrix::PutString called");
}
void ScVectorRefMatrix::PutEmpty(SCSIZE nC, SCSIZE nR)
{
throw std::runtime_error("ScVectorRefMatrix::PutEmpty called");
}
void ScVectorRefMatrix::PutEmptyPath(SCSIZE nC, SCSIZE nR)
{
throw std::runtime_error("ScVectorRefMatrix::PutEmptyPath called");
}
void ScVectorRefMatrix::PutError(sal_uInt16 nErrorCode, SCSIZE nC, SCSIZE nR)
{
throw std::runtime_error("ScVectorRefMatrix::PutError called");
}
void ScVectorRefMatrix::PutBoolean(bool bVal, SCSIZE nC, SCSIZE nR)
{
throw std::runtime_error("ScVectorRefMatrix::PutBoolean called");
}
void ScVectorRefMatrix::FillDouble(double fVal, SCSIZE nC1, SCSIZE nR1, SCSIZE nC2, SCSIZE nR2)
{
throw std::runtime_error("ScVectorRefMatrix::FillDouble called");
}
void ScVectorRefMatrix::PutDoubleVector(const ::std::vector< double > & rVec, SCSIZE nC, SCSIZE nR)
{
throw std::runtime_error("ScVectorRefMatrix::PutDoubleVector called");
}
void ScVectorRefMatrix::PutStringVector(const ::std::vector< svl::SharedString > & rVec, SCSIZE nC, SCSIZE nR)
{
throw std::runtime_error("ScVectorRefMatrix::PutStringVector called");
}
void ScVectorRefMatrix::PutEmptyVector(SCSIZE nCount, SCSIZE nC, SCSIZE nR)
{
throw std::runtime_error("ScVectorRefMatrix::PutEmptyVector called");
}
void ScVectorRefMatrix::PutEmptyResultVector(SCSIZE nCount, SCSIZE nC, SCSIZE nR)
{
throw std::runtime_error("ScVectorRefMatrix::PutEmptyResultVector called");
}
void ScVectorRefMatrix::PutEmptyPathVector(SCSIZE nCount, SCSIZE nC, SCSIZE nR)
{
throw std::runtime_error("ScVectorRefMatrix::PutEmptyPathVector called");
}
sal_uInt16 ScVectorRefMatrix::GetError(SCSIZE nC, SCSIZE nR) const
{
throw std::runtime_error("ScVectorRefMatrix::GetError called");
}
double ScVectorRefMatrix::GetDouble(SCSIZE nC, SCSIZE nR) const
{
throw std::runtime_error("ScVectorRefMatrix::GetDouble called");
}
double ScVectorRefMatrix::GetDouble(SCSIZE nIndex) const
{
throw std::runtime_error("ScVectorRefMatrix::GetDouble called");
}
svl::SharedString ScVectorRefMatrix::GetString(SCSIZE nC, SCSIZE nR) const
{
throw std::runtime_error("ScVectorRefMatrix::GetString called");
}
svl::SharedString ScVectorRefMatrix::GetString(SCSIZE nIndex) const
{
throw std::runtime_error("ScVectorRefMatrix::GetString called");
}
svl::SharedString ScVectorRefMatrix::GetString(SvNumberFormatter& rFormatter, SCSIZE nC, SCSIZE nR) const
{
throw std::runtime_error("ScVectorRefMatrix::GetString called");
}
ScMatrixValue ScVectorRefMatrix::Get(SCSIZE nC, SCSIZE nR) const
{
throw std::runtime_error("ScVectorRefMatrix::Get called");
}
bool ScVectorRefMatrix::IsString(SCSIZE nIndex) const
{
throw std::runtime_error("ScVectorRefMatrix::IsString called");
}
bool ScVectorRefMatrix::IsString(SCSIZE nC, SCSIZE nR) const
{
throw std::runtime_error("ScVectorRefMatrix::IsString called");
}
bool ScVectorRefMatrix::IsEmpty(SCSIZE nC, SCSIZE nR) const
{
throw std::runtime_error("ScVectorRefMatrix::IsEmpty called");
}
bool ScVectorRefMatrix::IsEmptyCell(SCSIZE nC, SCSIZE nR) const
{
throw std::runtime_error("ScVectorRefMatrix::IsEmptyCell called");
}
bool ScVectorRefMatrix::IsEmptyResult(SCSIZE nC, SCSIZE nR) const
{
throw std::runtime_error("ScVectorRefMatrix::IsEmptyResult called");
}
bool ScVectorRefMatrix::IsEmptyPath(SCSIZE nC, SCSIZE nR) const
{
throw std::runtime_error("ScVectorRefMatrix::IsEmptyPath called");
}
bool ScVectorRefMatrix::IsValue(SCSIZE nIndex) const
{
throw std::runtime_error("ScVectorRefMatrix::IsValue called");
}
bool ScVectorRefMatrix::IsValue(SCSIZE nC, SCSIZE nR) const
{
throw std::runtime_error("ScVectorRefMatrix::IsValue called");
}
bool ScVectorRefMatrix::IsValueOrEmpty(SCSIZE nC, SCSIZE nR) const
{
throw std::runtime_error("ScVectorRefMatrix::IsValueOrEmpty called");
}
bool ScVectorRefMatrix::IsBoolean(SCSIZE nC, SCSIZE nR) const
{
throw std::runtime_error("ScVectorRefMatrix::IsBoolean called");
}
bool ScVectorRefMatrix::IsNumeric() const
{
throw std::runtime_error("ScVectorRefMatrix::IsNumeric called");
}
void ScVectorRefMatrix::MatTrans(ScMatrix& mRes) const
{
throw std::runtime_error("ScVectorRefMatrix::MatTrans called");
}
void ScVectorRefMatrix::MatCopy(ScMatrix& mRes) const
{
throw std::runtime_error("ScVectorRefMatrix::MatCopy called");
}
void ScVectorRefMatrix::CompareEqual()
{
throw std::runtime_error("ScVectorRefMatrix::CompareEqual called");
}
void ScVectorRefMatrix::CompareNotEqual()
{
throw std::runtime_error("ScVectorRefMatrix::CompareNotEqual called");
}
void ScVectorRefMatrix::CompareLess()
{
throw std::runtime_error("ScVectorRefMatrix::CompareLess called");
}
void ScVectorRefMatrix::CompareGreater()
{
throw std::runtime_error("ScVectorRefMatrix::CompareGreater called");
}
void ScVectorRefMatrix::CompareLessEqual()
{
throw std::runtime_error("ScVectorRefMatrix::CompareLessEqual called");
}
void ScVectorRefMatrix::CompareGreaterEqual()
{
throw std::runtime_error("ScVectorRefMatrix::CompareGreaterEqual called");
}
double ScVectorRefMatrix::And() const
{
throw std::runtime_error("ScVectorRefMatrix::And called");
}
double ScVectorRefMatrix::Or() const
{
throw std::runtime_error("ScVectorRefMatrix::Or called");
}
double ScVectorRefMatrix::Xor() const
{
throw std::runtime_error("ScVectorRefMatrix::Xor called");
}
ScMatrix::IterateResult ScVectorRefMatrix::Sum(bool bTextAsZero) const
{
const std::vector<formula::VectorRefArray>& rArrays = mpToken->GetArrays();
size_t nDataSize = mnRowSize;
if (mnRowStart >= mpToken->GetRefRowSize())
{
return ScMatrix::IterateResult(0.0, 0.0, 0);
}
else if (nDataSize > mpToken->GetRefRowSize() + mnRowStart)
{
nDataSize = mpToken->GetRefRowSize() - mnRowStart;
}
double mfFirst = 0.0;
double mfRest = 0.0;
for (const formula::VectorRefArray& rArray : rArrays)
{
if (rArray.mpStringArray)
{
// TODO FIXME
throw std::runtime_error("ScVectorRefMatrix::Sum - string array");
}
else if (rArray.mpNumericArray)
{
// Numeric cells only.
const double* p = rArray.mpNumericArray + mnRowStart;
size_t i = 0;
// Store the first non-zero value in mfFirst (for some reason).
if (!mfFirst)
{
for (i = 0; i < nDataSize; ++i)
{
if (!mfFirst)
mfFirst = p[i];
else
break;
}
}
p += i;
nDataSize -= i;
if (nDataSize == 0)
continue;
sc::ArraySumFunctor functor(p, nDataSize);
mfRest += functor();
}
}
return ScMatrix::IterateResult(mfFirst, mfRest, mpToken->GetArrays().size()*nDataSize);
}
ScMatrix::IterateResult ScVectorRefMatrix::SumSquare(bool bTextAsZero) const
{
throw std::runtime_error("ScVectorRefMatrix::SumSquare called");
}
ScMatrix::IterateResult ScVectorRefMatrix::Product(bool bTextAsZero) const
{
throw std::runtime_error("ScVectorRefMatrix::Product called");
}
size_t ScVectorRefMatrix::Count(bool bCountStrings) const
{
throw std::runtime_error("ScVectorRefMatrix::Count called");
}
size_t ScVectorRefMatrix::MatchDoubleInColumns(double fValue, size_t nCol1, size_t nCol2) const
{
throw std::runtime_error("ScVectorRefMatrix::MatchDoubleInColumns called");
}
size_t ScVectorRefMatrix::MatchStringInColumns(const svl::SharedString& rStr, size_t nCol1, size_t nCol2) const
{
throw std::runtime_error("ScVectorRefMatrix::MatchStringInColumns called");
}
double ScVectorRefMatrix::GetMaxValue(bool bTextAsZero) const
{
throw std::runtime_error("ScVectorRefMatrix::GetMaxValue called");
}
double ScVectorRefMatrix::GetMinValue(bool bTextAsZero) const
{
throw std::runtime_error("ScVectorRefMatrix::GetMinValue called");
}
ScMatrixRef ScVectorRefMatrix::CompareMatrix(sc::Compare& rComp, size_t nMatPos, sc::CompareOptions* pOptions) const
{
throw std::runtime_error("ScVectorRefMatrix::CompareMatrix called");
}
void ScVectorRefMatrix::GetDoubleArray(std::vector<double>& rVector, bool bEmptyAsZero) const
{
throw std::runtime_error("ScVectorRefMatrix::GetDoubleArray called");
}
void ScVectorRefMatrix::MergeDoubleArray(std::vector<double>& rVector, Op eOp) const
{
throw std::runtime_error("ScVectorRefMatrix::MergeDoubleArray called");
}
void ScVectorRefMatrix::NotOp(ScMatrix& rMat)
{
throw std::runtime_error("ScVectorRefMatrix::NotOp called");
}
void ScVectorRefMatrix::NegOp(ScMatrix& rMat)
{
throw std::runtime_error("ScVectorRefMatrix::NegOp called");
}
void ScVectorRefMatrix::AddOp(double fVal, ScMatrix& rMat)
{
throw std::runtime_error("ScVectorRefMatrix::AddOp called");
}
void ScVectorRefMatrix::SubOp(bool bFlag, double fVal, ScMatrix& rMat)
{
throw std::runtime_error("ScVectorRefMatrix::SubOp called");
}
void ScVectorRefMatrix::MulOp(double fVal, ScMatrix& rMat)
{
throw std::runtime_error("ScVectorRefMatrix::MulOp called");
}
void ScVectorRefMatrix::DivOp(bool bFlag, double fVal, ScMatrix& rMat)
{
throw std::runtime_error("ScVectorRefMatrix::DivOp called");
}
void ScVectorRefMatrix::PowOp(bool bFlag, double fVal, ScMatrix& rMat)
{
throw std::runtime_error("ScVectorRefMatrix::PowOp called");
}
std::vector<ScMatrix::IterateResult> ScVectorRefMatrix::Collect(bool bTextAsZero, const std::vector<std::unique_ptr<sc::op::Op>>& aOp)
{
throw std::runtime_error("ScVectorRefMatrix::Collect called");
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment