LibreOffice Module sc (master) 1
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
ScMatrix Class Referencefinal

Matrix data type that can store values of mixed types. More...

#include <scmatrix.hxx>

Classes

struct  IterateResult
 Iterator for executing one operation with the matrix data. More...
 
struct  IterateResultMultiple
 When adding all numerical matrix elements for a scalar result such as summation, the interpreter wants to separate the first non-zero value with the rest of the summed values. More...
 

Public Types

typedef std::function< void(size_t, size_t, double)> DoubleOpFunction
 
typedef std::function< void(size_t, size_t, bool)> BoolOpFunction
 
typedef std::function< void(size_t, size_t, svl::SharedString)> StringOpFunction
 
typedef std::function< void(size_t, size_t)> EmptyOpFunction
 
typedef std::function< double(double, double)> CalculateOpFunction
 
typedef IterateResultMultiple< KahanSumKahanIterateResultMultiple
 
typedef IterateResultMultiple< double > DoubleIterateResultMultiple
 
typedef IterateResult< KahanSumKahanIterateResult
 
typedef IterateResult< double > DoubleIterateResult
 

Public Member Functions

 ScMatrix (SCSIZE nC, SCSIZE nR)
 
 ScMatrix (SCSIZE nC, SCSIZE nR, double fInitVal)
 
 ScMatrix (size_t nC, size_t nR, const std::vector< double > &rInitVals)
 
 ~ScMatrix ()
 
ScMatrixClone () const
 Clone the matrix. More...
 
ScMatrixCloneIfConst ()
 Clone the matrix if mbCloneIfConst (immutable) is set, otherwise return this matrix, to be assigned to a ScMatrixRef. More...
 
void SetMutable ()
 Set the matrix to mutable for CloneIfConst(), only the interpreter should do this and know the consequences. More...
 
void SetImmutable () const
 Set the matrix to immutable for CloneIfConst(), only the interpreter should do this and know the consequences. More...
 
void Resize (SCSIZE nC, SCSIZE nR)
 Resize the matrix to specified new dimension. More...
 
void Resize (SCSIZE nC, SCSIZE nR, double fVal)
 
ScMatrixCloneAndExtend (SCSIZE nNewCols, SCSIZE nNewRows) const
 Clone the matrix and extend it to the new size. More...
 
void IncRef () const
 
void DecRef () const
 
void SetErrorInterpreter (ScInterpreter *p)
 
void GetDimensions (SCSIZE &rC, SCSIZE &rR) const
 
SCSIZE GetElementCount () const
 
bool ValidColRow (SCSIZE nC, SCSIZE nR) const
 
bool ValidColRowReplicated (SCSIZE &rC, SCSIZE &rR) const
 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. More...
 
bool ValidColRowOrReplicated (SCSIZE &rC, SCSIZE &rR) const
 Checks if the matrix position is within the matrix. More...
 
void PutDouble (double fVal, SCSIZE nC, SCSIZE nR)
 
void PutDouble (double fVal, SCSIZE nIndex)
 
void PutDouble (const double *pArray, size_t nLen, SCSIZE nC, SCSIZE nR)
 
void PutString (const svl::SharedString &rStr, SCSIZE nC, SCSIZE nR)
 
void PutString (const svl::SharedString &rStr, SCSIZE nIndex)
 
void PutString (const svl::SharedString *pArray, size_t nLen, SCSIZE nC, SCSIZE nR)
 
void PutEmpty (SCSIZE nC, SCSIZE nR)
 
void PutEmptyPath (SCSIZE nC, SCSIZE nR)
 Jump sal_False without path. More...
 
void PutError (FormulaError nErrorCode, SCSIZE nC, SCSIZE nR)
 
void PutBoolean (bool bVal, SCSIZE nC, SCSIZE nR)
 
void FillDouble (double fVal, SCSIZE nC1, SCSIZE nR1, SCSIZE nC2, SCSIZE nR2)
 
void PutDoubleVector (const ::std::vector< double > &rVec, SCSIZE nC, SCSIZE nR)
 Put a column vector of doubles, starting at row nR, must fit into dimensions. More...
 
void PutStringVector (const ::std::vector< svl::SharedString > &rVec, SCSIZE nC, SCSIZE nR)
 Put a column vector of strings, starting at row nR, must fit into dimensions. More...
 
void PutEmptyVector (SCSIZE nCount, SCSIZE nC, SCSIZE nR)
 Put a column vector of empties, starting at row nR, must fit into dimensions. More...
 
void PutEmptyResultVector (SCSIZE nCount, SCSIZE nC, SCSIZE nR)
 Put a column vector of empty results, starting at row nR, must fit into dimensions. More...
 
void PutEmptyPathVector (SCSIZE nCount, SCSIZE nC, SCSIZE nR)
 Put a column vector of empty paths, starting at row nR, must fit into dimensions. More...
 
FormulaError GetError (SCSIZE nC, SCSIZE nR) const
 May be used before obtaining the double value of an element to avoid passing its NAN around. More...
 
FormulaError GetErrorIfNotString (SCSIZE nC, SCSIZE nR) const
 Use in ScInterpreter to obtain the error code, if any. More...
 
double GetDouble (SCSIZE nC, SCSIZE nR) const
 
double GetDouble (SCSIZE nIndex) const
 
double GetDoubleWithStringConversion (SCSIZE nC, SCSIZE nR) const
 
svl::SharedString GetString (SCSIZE nC, SCSIZE nR) const
 
svl::SharedString GetString (SCSIZE nIndex) const
 
svl::SharedString GetString (SvNumberFormatter &rFormatter, SCSIZE nC, SCSIZE nR) const
 
ScMatrixValue Get (SCSIZE nC, SCSIZE nR) const
 @ATTENTION: If bString the ScMatrixValue->pS may still be NULL to indicate an empty string! More...
 
bool IsStringOrEmpty (SCSIZE nIndex) const
 
bool IsStringOrEmpty (SCSIZE nC, SCSIZE nR) const
 
bool IsEmpty (SCSIZE nC, SCSIZE nR) const
 
bool IsEmptyCell (SCSIZE nC, SCSIZE nR) const
 
bool IsEmptyResult (SCSIZE nC, SCSIZE nR) const
 
bool IsEmptyPath (SCSIZE nC, SCSIZE nR) const
 
bool IsValue (SCSIZE nIndex) const
 
bool IsValue (SCSIZE nC, SCSIZE nR) const
 
bool IsValueOrEmpty (SCSIZE nC, SCSIZE nR) const
 
bool IsBoolean (SCSIZE nC, SCSIZE nR) const
 
bool IsNumeric () const
 
void MatTrans (const ScMatrix &mRes) const
 
void MatCopy (const ScMatrix &mRes) const
 
void CompareEqual ()
 
void CompareNotEqual ()
 
void CompareLess ()
 
void CompareGreater ()
 
void CompareLessEqual ()
 
void CompareGreaterEqual ()
 
double And () const
 
double Or () const
 
double Xor () const
 
KahanIterateResult Sum (bool bTextAsZero, bool bIgnoreErrorValues=false) const
 
KahanIterateResult SumSquare (bool bTextAsZero, bool bIgnoreErrorValues=false) const
 
DoubleIterateResult Product (bool bTextAsZero, bool bIgnoreErrorValues=false) const
 
size_t Count (bool bCountStrings, bool bCountErrors, bool bIgnoreEmptyStrings=false) 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
 
double GetMaxValue (bool bTextAsZero, bool bIgnoreErrorValues=false) const
 
double GetMinValue (bool bTextAsZero, bool bIgnoreErrorValues=false) const
 
double GetGcd () const
 
double GetLcm () const
 
ScMatrixRef CompareMatrix (sc::Compare &rComp, size_t nMatPos, sc::CompareOptions *pOptions) const
 
void GetDoubleArray (std::vector< double > &rArray, bool bEmptyAsZero=true) const
 Convert the content of matrix into a linear array of numeric values. More...
 
void MergeDoubleArrayMultiply (std::vector< double > &rArray) const
 
void NotOp (const ScMatrix &rMat)
 
void NegOp (const ScMatrix &rMat)
 
void AddOp (double fVal, const ScMatrix &rMat)
 
void SubOp (bool bFlag, double fVal, const ScMatrix &rMat)
 
void MulOp (double fVal, const ScMatrix &rMat)
 
void DivOp (bool bFlag, double fVal, const ScMatrix &rMat)
 
void PowOp (bool bFlag, double fVal, const ScMatrix &rMat)
 
KahanIterateResultMultiple CollectKahan (const std::vector< sc::op::kOp > &aOp)
 
void ExecuteOperation (const std::pair< size_t, size_t > &rStartPos, const std::pair< size_t, size_t > &rEndPos, DoubleOpFunction aDoubleFunc, BoolOpFunction aBoolFunc, StringOpFunction aStringFunc, EmptyOpFunction aEmptyFunc) const
 
void MatConcat (SCSIZE nMaxCol, SCSIZE nMaxRow, const ScMatrixRef &xMat1, const ScMatrixRef &xMat2, SvNumberFormatter &rFormatter, svl::SharedStringPool &rPool)
 
void ExecuteBinaryOp (SCSIZE nMaxCol, SCSIZE nMaxRow, const ScMatrix &rInputMat1, const ScMatrix &rInputMat2, ScInterpreter *pInterpreter, CalculateOpFunction op)
 Apply binary operation to values from two input matrices, storing result into this matrix. More...
 

Static Public Member Functions

static bool IsSizeAllocatable (SCSIZE nC, SCSIZE nR)
 Checks nC or nR for zero and uses GetElementsMax() whether a matrix of the size of nC*nR could be allocated. More...
 
static bool IsValueType (ScMatValType nType)
 Value or boolean. More...
 
static bool IsBooleanType (ScMatValType nType)
 Boolean. More...
 
static bool IsNonValueType (ScMatValType nType)
 String, empty or empty path, but not value nor boolean. More...
 
static bool IsRealStringType (ScMatValType nType)
 String, but not empty or empty path or any other type. More...
 
static bool IsEmptyType (ScMatValType nType)
 Empty, but not empty path or any other type. More...
 
static bool IsEmptyPathType (ScMatValType nType)
 Empty path, but not empty or any other type. More...
 

Private Member Functions

 ScMatrix (const ScMatrix &)=delete
 
ScMatrixoperator= (const ScMatrix &)=delete
 

Private Attributes

size_t nRefCnt
 
bool mbCloneIfConst
 
std::unique_ptr< ScMatrixImplpImpl
 

Friends

class ScMatrixImpl
 

Detailed Description

Matrix data type that can store values of mixed types.

Each element can be one of the following types: numeric, string, boolean, empty, and empty path.

Definition at line 100 of file scmatrix.hxx.

Member Typedef Documentation

◆ BoolOpFunction

typedef std::function<void(size_t, size_t, bool)> ScMatrix::BoolOpFunction

Definition at line 118 of file scmatrix.hxx.

◆ CalculateOpFunction

typedef std::function<double(double, double)> ScMatrix::CalculateOpFunction

Definition at line 121 of file scmatrix.hxx.

◆ DoubleIterateResult

Definition at line 157 of file scmatrix.hxx.

◆ DoubleIterateResultMultiple

Definition at line 142 of file scmatrix.hxx.

◆ DoubleOpFunction

typedef std::function<void(size_t, size_t, double)> ScMatrix::DoubleOpFunction

Definition at line 117 of file scmatrix.hxx.

◆ EmptyOpFunction

typedef std::function<void(size_t, size_t)> ScMatrix::EmptyOpFunction

Definition at line 120 of file scmatrix.hxx.

◆ KahanIterateResult

Definition at line 156 of file scmatrix.hxx.

◆ KahanIterateResultMultiple

Definition at line 141 of file scmatrix.hxx.

◆ StringOpFunction

typedef std::function<void(size_t, size_t, svl::SharedString)> ScMatrix::StringOpFunction

Definition at line 119 of file scmatrix.hxx.

Constructor & Destructor Documentation

◆ ScMatrix() [1/4]

ScMatrix::ScMatrix ( const ScMatrix )
privatedelete

Referenced by Clone(), and CloneAndExtend().

◆ ScMatrix() [2/4]

ScMatrix::ScMatrix ( SCSIZE  nC,
SCSIZE  nR 
)

Definition at line 3061 of file scmatrix.cxx.

References CreateDoubleError(), IsSizeAllocatable(), pImpl, and ScMatrixImpl.

◆ ScMatrix() [3/4]

ScMatrix::ScMatrix ( SCSIZE  nC,
SCSIZE  nR,
double  fInitVal 
)

Definition at line 3071 of file scmatrix.cxx.

References CreateDoubleError(), IsSizeAllocatable(), pImpl, and ScMatrixImpl.

◆ ScMatrix() [4/4]

ScMatrix::ScMatrix ( size_t  nC,
size_t  nR,
const std::vector< double > &  rInitVals 
)

Definition at line 3081 of file scmatrix.cxx.

References CreateDoubleError(), IsSizeAllocatable(), pImpl, and ScMatrixImpl.

◆ ~ScMatrix()

ScMatrix::~ScMatrix ( )

Definition at line 3091 of file scmatrix.cxx.

Member Function Documentation

◆ AddOp()

void ScMatrix::AddOp ( double  fVal,
const ScMatrix rMat 
)

Definition at line 3546 of file scmatrix.cxx.

References a, and pImpl.

◆ And()

double ScMatrix::And ( ) const

Definition at line 3383 of file scmatrix.cxx.

References pImpl.

◆ Clone()

ScMatrix * ScMatrix::Clone ( ) const

Clone the matrix.

Definition at line 3095 of file scmatrix.cxx.

References MatCopy(), pImpl, ScMatrix(), and SetErrorInterpreter().

Referenced by CloneIfConst().

◆ CloneAndExtend()

ScMatrix * ScMatrix::CloneAndExtend ( SCSIZE  nNewCols,
SCSIZE  nNewRows 
) const

Clone the matrix and extend it to the new size.

nNewCols and nNewRows MUST be at least of the size of the original matrix.

Definition at line 3130 of file scmatrix.cxx.

References MatCopy(), pImpl, ScMatrix(), and SetErrorInterpreter().

◆ CloneIfConst()

ScMatrix * ScMatrix::CloneIfConst ( )

Clone the matrix if mbCloneIfConst (immutable) is set, otherwise return this matrix, to be assigned to a ScMatrixRef.

Definition at line 3105 of file scmatrix.cxx.

References Clone(), and mbCloneIfConst.

◆ CollectKahan()

ScMatrix::KahanIterateResultMultiple ScMatrix::CollectKahan ( const std::vector< sc::op::kOp > &  aOp)

Definition at line 3615 of file scmatrix.cxx.

References pImpl.

◆ CompareEqual()

void ScMatrix::CompareEqual ( )

Definition at line 3353 of file scmatrix.cxx.

References pImpl.

◆ CompareGreater()

void ScMatrix::CompareGreater ( )

Definition at line 3368 of file scmatrix.cxx.

References pImpl.

◆ CompareGreaterEqual()

void ScMatrix::CompareGreaterEqual ( )

Definition at line 3378 of file scmatrix.cxx.

References pImpl.

◆ CompareLess()

void ScMatrix::CompareLess ( )

Definition at line 3363 of file scmatrix.cxx.

References pImpl.

◆ CompareLessEqual()

void ScMatrix::CompareLessEqual ( )

Definition at line 3373 of file scmatrix.cxx.

References pImpl.

◆ CompareMatrix()

ScMatrixRef ScMatrix::CompareMatrix ( sc::Compare rComp,
size_t  nMatPos,
sc::CompareOptions pOptions 
) const

Definition at line 3449 of file scmatrix.cxx.

References pImpl.

Referenced by ScInterpreter::CompareMat().

◆ CompareNotEqual()

void ScMatrix::CompareNotEqual ( )

Definition at line 3358 of file scmatrix.cxx.

References pImpl.

◆ Count()

size_t ScMatrix::Count ( bool  bCountStrings,
bool  bCountErrors,
bool  bIgnoreEmptyStrings = false 
) const

Definition at line 3413 of file scmatrix.cxx.

References pImpl.

◆ DecRef()

void ScMatrix::DecRef ( ) const

Definition at line 3008 of file scmatrix.cxx.

References nRefCnt.

Referenced by XclExpCachedMatrix::~XclExpCachedMatrix().

◆ DivOp()

void ScMatrix::DivOp ( bool  bFlag,
double  fVal,
const ScMatrix rMat 
)

Definition at line 3576 of file scmatrix.cxx.

References a, sc::div(), and pImpl.

◆ ExecuteBinaryOp()

void ScMatrix::ExecuteBinaryOp ( SCSIZE  nMaxCol,
SCSIZE  nMaxRow,
const ScMatrix rInputMat1,
const ScMatrix rInputMat2,
ScInterpreter pInterpreter,
CalculateOpFunction  op 
)

Apply binary operation to values from two input matrices, storing result into this matrix.

Definition at line 3633 of file scmatrix.cxx.

References pImpl.

◆ ExecuteOperation()

void ScMatrix::ExecuteOperation ( const std::pair< size_t, size_t > &  rStartPos,
const std::pair< size_t, size_t > &  rEndPos,
DoubleOpFunction  aDoubleFunc,
BoolOpFunction  aBoolFunc,
StringOpFunction  aStringFunc,
EmptyOpFunction  aEmptyFunc 
) const

Definition at line 3608 of file scmatrix.cxx.

References pImpl.

◆ FillDouble()

void ScMatrix::FillDouble ( double  fVal,
SCSIZE  nC1,
SCSIZE  nR1,
SCSIZE  nC2,
SCSIZE  nR2 
)

Definition at line 3323 of file scmatrix.cxx.

References pImpl.

◆ Get()

ScMatrixValue ScMatrix::Get ( SCSIZE  nC,
SCSIZE  nR 
) const

@ATTENTION: If bString the ScMatrixValue->pS may still be NULL to indicate an empty string!

Definition at line 3253 of file scmatrix.cxx.

References pImpl.

Referenced by ScInterpreter::CalculateMatrixValue(), XclImpExtName::CreateOleData(), XclExpFmlaCompImpl::ProcessMatrix(), XclExpCachedMatrix::Save(), ScInterpreter::ScMatRef(), and ScXMLExportDDELinks::WriteTable().

◆ GetDimensions()

void ScMatrix::GetDimensions ( SCSIZE rC,
SCSIZE rR 
) const

◆ GetDouble() [1/2]

double ScMatrix::GetDouble ( SCSIZE  nC,
SCSIZE  nR 
) const

◆ GetDouble() [2/2]

double ScMatrix::GetDouble ( SCSIZE  nIndex) const
Returns
0.0 if empty or empty path, else value or DoubleError.

Definition at line 3228 of file scmatrix.cxx.

References nIndex, and pImpl.

◆ GetDoubleArray()

void ScMatrix::GetDoubleArray ( std::vector< double > &  rArray,
bool  bEmptyAsZero = true 
) const

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.

Parameters
bEmptyAsZeroif true empty elements are mapped to zero values, otherwise they become NaN values.

Definition at line 3455 of file scmatrix.cxx.

References pImpl.

◆ GetDoubleWithStringConversion()

double ScMatrix::GetDoubleWithStringConversion ( SCSIZE  nC,
SCSIZE  nR 
) const
Returns
value or DoubleError or string converted to value.

Definition at line 3233 of file scmatrix.cxx.

References pImpl.

◆ GetElementCount()

SCSIZE ScMatrix::GetElementCount ( ) const

Definition at line 3148 of file scmatrix.cxx.

References pImpl.

◆ GetError()

FormulaError ScMatrix::GetError ( SCSIZE  nC,
SCSIZE  nR 
) const

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

Definition at line 3218 of file scmatrix.cxx.

References pImpl.

Referenced by ScCompiler::CreateStringFromMatrix().

◆ GetErrorIfNotString()

FormulaError ScMatrix::GetErrorIfNotString ( SCSIZE  nC,
SCSIZE  nR 
) const
inline

Use in ScInterpreter to obtain the error code, if any.

Returns
0 if no error or string element, else one of err... constants

Definition at line 296 of file scmatrix.hxx.

References GetError().

Referenced by ScMatrixImpl::ExecuteBinaryOp().

◆ GetGcd()

double ScMatrix::GetGcd ( ) const

Definition at line 3438 of file scmatrix.cxx.

References pImpl.

◆ GetLcm()

double ScMatrix::GetLcm ( ) const

Definition at line 3443 of file scmatrix.cxx.

References pImpl.

◆ GetMaxValue()

double ScMatrix::GetMaxValue ( bool  bTextAsZero,
bool  bIgnoreErrorValues = false 
) const

Definition at line 3428 of file scmatrix.cxx.

References pImpl.

◆ GetMinValue()

double ScMatrix::GetMinValue ( bool  bTextAsZero,
bool  bIgnoreErrorValues = false 
) const

Definition at line 3433 of file scmatrix.cxx.

References pImpl.

◆ GetString() [1/3]

svl::SharedString ScMatrix::GetString ( SCSIZE  nC,
SCSIZE  nR 
) const

◆ GetString() [2/3]

svl::SharedString ScMatrix::GetString ( SCSIZE  nIndex) const
Returns
empty string if empty or empty path, else string content.

Definition at line 3243 of file scmatrix.cxx.

References nIndex, and pImpl.

◆ GetString() [3/3]

svl::SharedString ScMatrix::GetString ( SvNumberFormatter rFormatter,
SCSIZE  nC,
SCSIZE  nR 
) const
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.

Definition at line 3248 of file scmatrix.cxx.

References pImpl.

◆ IncRef()

void ScMatrix::IncRef ( ) const

Definition at line 3003 of file scmatrix.cxx.

References nRefCnt.

Referenced by TokenPool::StoreMatrix(), and XclExpCachedMatrix::XclExpCachedMatrix().

◆ IsBoolean()

bool ScMatrix::IsBoolean ( SCSIZE  nC,
SCSIZE  nR 
) const
Returns
<TRUE> if boolean.

Definition at line 3303 of file scmatrix.cxx.

References pImpl.

Referenced by ScCompiler::CreateStringFromMatrix(), and ScChart2DataSequence::FillCacheFromExternalRef().

◆ IsBooleanType()

static bool ScMatrix::IsBooleanType ( ScMatValType  nType)
inlinestatic

Boolean.

Definition at line 173 of file scmatrix.hxx.

References Boolean, and nType.

Referenced by XclExpFmlaCompImpl::ProcessMatrix().

◆ IsEmpty()

bool ScMatrix::IsEmpty ( SCSIZE  nC,
SCSIZE  nR 
) const
Returns
<TRUE> if empty or empty cell or empty result, not empty path.

Definition at line 3268 of file scmatrix.cxx.

References pImpl.

Referenced by ScCompiler::CreateStringFromMatrix(), ScDBQueryDataIterator::DataAccessMatrix::getCurrent(), and lcl_storeJumpMatResult().

◆ IsEmptyCell()

bool ScMatrix::IsEmptyCell ( SCSIZE  nC,
SCSIZE  nR 
) const
Returns
<TRUE> if empty cell, not empty or empty result or empty path.

Definition at line 3273 of file scmatrix.cxx.

References pImpl.

◆ IsEmptyPath()

bool ScMatrix::IsEmptyPath ( SCSIZE  nC,
SCSIZE  nR 
) const
Returns
<TRUE> if empty path, not empty or empty cell or empty result.

Definition at line 3283 of file scmatrix.cxx.

References pImpl.

◆ IsEmptyPathType()

static bool ScMatrix::IsEmptyPathType ( ScMatValType  nType)
inlinestatic

Empty path, but not empty or any other type.

Definition at line 199 of file scmatrix.hxx.

References EmptyPath, NonvalueMask, and nType.

Referenced by ScInterpreter::ScMatRef().

◆ IsEmptyResult()

bool ScMatrix::IsEmptyResult ( SCSIZE  nC,
SCSIZE  nR 
) const
Returns
<TRUE> if empty result, not empty or empty cell or empty path.

Definition at line 3278 of file scmatrix.cxx.

References pImpl.

◆ IsEmptyType()

static bool ScMatrix::IsEmptyType ( ScMatValType  nType)
inlinestatic

Empty, but not empty path or any other type.

Definition at line 193 of file scmatrix.hxx.

References Empty, NonvalueMask, and nType.

Referenced by ScInterpreter::ScMatRef(), and ScXMLExportDDELinks::WriteCell().

◆ IsNonValueType()

static bool ScMatrix::IsNonValueType ( ScMatValType  nType)
inlinestatic

◆ IsNumeric()

bool ScMatrix::IsNumeric ( ) const
Returns
<TRUE> if entire matrix is numeric, including booleans, with no strings or empties

Definition at line 3308 of file scmatrix.cxx.

References pImpl.

◆ IsRealStringType()

static bool ScMatrix::IsRealStringType ( ScMatValType  nType)
inlinestatic

String, but not empty or empty path or any other type.

Not named IsStringType to prevent confusion because previously IsNonValueType was named IsStringType.

Definition at line 187 of file scmatrix.hxx.

References NonvalueMask, nType, and String.

Referenced by ScInterpreter::IterateParametersIf(), ScInterpreter::IterateParametersIfs(), ScInterpreter::ScCountIf(), and ScInterpreter::ScHyperLink().

◆ IsSizeAllocatable()

bool ScMatrix::IsSizeAllocatable ( SCSIZE  nC,
SCSIZE  nR 
)
static

Checks nC or nR for zero and uses GetElementsMax() whether a matrix of the size of nC*nR could be allocated.

A zero size (both nC and nR zero) matrix is allowed for later resize.

Definition at line 3015 of file scmatrix.cxx.

References bElementsMaxFetched, GetElementsMax(), nElementsMax, SAL_WARN, and SAL_WARN_IF.

Referenced by ScInterpreter::CreateMatrixFromDoubleRef(), ScMatrixImpl::Resize(), ScInterpreter::ScEMat(), ScInterpreter::ScMatDet(), ScInterpreter::ScMatInv(), and ScMatrix().

◆ IsStringOrEmpty() [1/2]

bool ScMatrix::IsStringOrEmpty ( SCSIZE  nC,
SCSIZE  nR 
) const
Returns
<TRUE> if string or any empty, empty cell, empty result, empty path, in fact non-value.

Definition at line 3263 of file scmatrix.cxx.

References pImpl.

◆ IsStringOrEmpty() [2/2]

bool ScMatrix::IsStringOrEmpty ( SCSIZE  nIndex) const
Returns
<TRUE> if string or any empty, empty cell, empty result, empty path, in fact non-value.

Definition at line 3258 of file scmatrix.cxx.

References nIndex, and pImpl.

Referenced by ScCompiler::CreateStringFromMatrix(), ScMatrixImpl::ExecuteBinaryOp(), ScChart2DataSequence::FillCacheFromExternalRef(), and ScDBQueryDataIterator::DataAccessMatrix::getCurrent().

◆ IsValue() [1/2]

bool ScMatrix::IsValue ( SCSIZE  nC,
SCSIZE  nR 
) const
Returns
<TRUE> if value or boolean.

Definition at line 3293 of file scmatrix.cxx.

References pImpl.

◆ IsValue() [2/2]

bool ScMatrix::IsValue ( SCSIZE  nIndex) const
Returns
<TRUE> if value or boolean.

Definition at line 3288 of file scmatrix.cxx.

References nIndex, and pImpl.

Referenced by ScCompiler::CreateStringFromMatrix(), ScChart2DataSequence::FillCacheFromExternalRef(), and lcl_storeJumpMatResult().

◆ IsValueOrEmpty()

bool ScMatrix::IsValueOrEmpty ( SCSIZE  nC,
SCSIZE  nR 
) const
Returns
<TRUE> if value or boolean or empty or empty path.

Definition at line 3298 of file scmatrix.cxx.

References pImpl.

Referenced by ScMatrixImpl::ExecuteBinaryOp().

◆ IsValueType()

static bool ScMatrix::IsValueType ( ScMatValType  nType)
inlinestatic

◆ MatchDoubleInColumns()

size_t ScMatrix::MatchDoubleInColumns ( double  fValue,
size_t  nCol1,
size_t  nCol2 
) const

Definition at line 3418 of file scmatrix.cxx.

References pImpl.

◆ MatchStringInColumns()

size_t ScMatrix::MatchStringInColumns ( const svl::SharedString rStr,
size_t  nCol1,
size_t  nCol2 
) const

Definition at line 3423 of file scmatrix.cxx.

References pImpl.

◆ MatConcat()

void ScMatrix::MatConcat ( SCSIZE  nMaxCol,
SCSIZE  nMaxRow,
const ScMatrixRef xMat1,
const ScMatrixRef xMat2,
SvNumberFormatter rFormatter,
svl::SharedStringPool rPool 
)

Definition at line 3627 of file scmatrix.cxx.

References pImpl.

◆ MatCopy()

void ScMatrix::MatCopy ( const ScMatrix mRes) const

Definition at line 3313 of file scmatrix.cxx.

References pImpl.

Referenced by Clone(), CloneAndExtend(), and ScInterpreter::ScDde().

◆ MatTrans()

void ScMatrix::MatTrans ( const ScMatrix mRes) const

Definition at line 3318 of file scmatrix.cxx.

References pImpl.

◆ MergeDoubleArrayMultiply()

void ScMatrix::MergeDoubleArrayMultiply ( std::vector< double > &  rArray) const

Definition at line 3460 of file scmatrix.cxx.

References pImpl.

◆ MulOp()

void ScMatrix::MulOp ( double  fVal,
const ScMatrix rMat 
)

Definition at line 3569 of file scmatrix.cxx.

References a, and pImpl.

◆ NegOp()

void ScMatrix::NegOp ( const ScMatrix rMat)

Definition at line 3539 of file scmatrix.cxx.

References a, and pImpl.

◆ NotOp()

void ScMatrix::NotOp ( const ScMatrix rMat)

Definition at line 3532 of file scmatrix.cxx.

References a, and pImpl.

◆ operator=()

ScMatrix & ScMatrix::operator= ( const ScMatrix )
privatedelete

◆ Or()

double ScMatrix::Or ( ) const

Definition at line 3388 of file scmatrix.cxx.

References pImpl.

◆ PowOp()

void ScMatrix::PowOp ( bool  bFlag,
double  fVal,
const ScMatrix rMat 
)

Definition at line 3592 of file scmatrix.cxx.

References a, pImpl, and sc::power().

◆ Product()

ScMatrix::DoubleIterateResult ScMatrix::Product ( bool  bTextAsZero,
bool  bIgnoreErrorValues = false 
) const

Definition at line 3408 of file scmatrix.cxx.

References pImpl.

◆ PutBoolean()

void ScMatrix::PutBoolean ( bool  bVal,
SCSIZE  nC,
SCSIZE  nR 
)

Definition at line 3213 of file scmatrix.cxx.

References pImpl.

Referenced by ScTokenArray::MergeArray(), and ExcelToSc::ReadExtensionArray().

◆ PutDouble() [1/3]

void ScMatrix::PutDouble ( const double *  pArray,
size_t  nLen,
SCSIZE  nC,
SCSIZE  nR 
)

Definition at line 3178 of file scmatrix.cxx.

References pImpl.

◆ PutDouble() [2/3]

void ScMatrix::PutDouble ( double  fVal,
SCSIZE  nC,
SCSIZE  nR 
)

Definition at line 3168 of file scmatrix.cxx.

References pImpl.

Referenced by lcl_LUP_decompose(), ScTokenArray::MergeArray(), and ExcelToSc::ReadExtensionArray().

◆ PutDouble() [3/3]

void ScMatrix::PutDouble ( double  fVal,
SCSIZE  nIndex 
)

Definition at line 3173 of file scmatrix.cxx.

References nIndex, and pImpl.

◆ PutDoubleVector()

void ScMatrix::PutDoubleVector ( const ::std::vector< double > &  rVec,
SCSIZE  nC,
SCSIZE  nR 
)

Put a column vector of doubles, starting at row nR, must fit into dimensions.

Definition at line 3328 of file scmatrix.cxx.

References pImpl.

◆ PutEmpty()

void ScMatrix::PutEmpty ( SCSIZE  nC,
SCSIZE  nR 
)

Definition at line 3198 of file scmatrix.cxx.

References pImpl.

Referenced by ScTokenArray::MergeArray(), and ExcelToSc::ReadExtensionArray().

◆ PutEmptyPath()

void ScMatrix::PutEmptyPath ( SCSIZE  nC,
SCSIZE  nR 
)

Jump sal_False without path.

Definition at line 3203 of file scmatrix.cxx.

References pImpl.

◆ PutEmptyPathVector()

void ScMatrix::PutEmptyPathVector ( SCSIZE  nCount,
SCSIZE  nC,
SCSIZE  nR 
)

Put a column vector of empty paths, starting at row nR, must fit into dimensions.

Definition at line 3348 of file scmatrix.cxx.

References nCount, and pImpl.

◆ PutEmptyResultVector()

void ScMatrix::PutEmptyResultVector ( SCSIZE  nCount,
SCSIZE  nC,
SCSIZE  nR 
)

Put a column vector of empty results, starting at row nR, must fit into dimensions.

Definition at line 3343 of file scmatrix.cxx.

References nCount, and pImpl.

◆ PutEmptyVector()

void ScMatrix::PutEmptyVector ( SCSIZE  nCount,
SCSIZE  nC,
SCSIZE  nR 
)

Put a column vector of empties, starting at row nR, must fit into dimensions.

Definition at line 3338 of file scmatrix.cxx.

References nCount, and pImpl.

◆ PutError()

void ScMatrix::PutError ( FormulaError  nErrorCode,
SCSIZE  nC,
SCSIZE  nR 
)

Definition at line 3208 of file scmatrix.cxx.

References pImpl.

Referenced by ExcelToSc::ReadExtensionArray().

◆ PutString() [1/3]

void ScMatrix::PutString ( const svl::SharedString rStr,
SCSIZE  nC,
SCSIZE  nR 
)

Definition at line 3183 of file scmatrix.cxx.

References pImpl.

Referenced by ScTokenArray::MergeArray(), and ExcelToSc::ReadExtensionArray().

◆ PutString() [2/3]

void ScMatrix::PutString ( const svl::SharedString rStr,
SCSIZE  nIndex 
)

Definition at line 3188 of file scmatrix.cxx.

References nIndex, and pImpl.

◆ PutString() [3/3]

void ScMatrix::PutString ( const svl::SharedString pArray,
size_t  nLen,
SCSIZE  nC,
SCSIZE  nR 
)

Definition at line 3193 of file scmatrix.cxx.

References pImpl.

◆ PutStringVector()

void ScMatrix::PutStringVector ( const ::std::vector< svl::SharedString > &  rVec,
SCSIZE  nC,
SCSIZE  nR 
)

Put a column vector of strings, starting at row nR, must fit into dimensions.

Definition at line 3333 of file scmatrix.cxx.

References pImpl.

◆ Resize() [1/2]

void ScMatrix::Resize ( SCSIZE  nC,
SCSIZE  nR 
)

Resize the matrix to specified new dimension.

Definition at line 3120 of file scmatrix.cxx.

References pImpl.

Referenced by ExcelToSc::ReadExtensionArray().

◆ Resize() [2/2]

void ScMatrix::Resize ( SCSIZE  nC,
SCSIZE  nR,
double  fVal 
)

Definition at line 3125 of file scmatrix.cxx.

References pImpl.

◆ SetErrorInterpreter()

void ScMatrix::SetErrorInterpreter ( ScInterpreter p)

Definition at line 3138 of file scmatrix.cxx.

References p, and pImpl.

Referenced by Clone(), CloneAndExtend(), and ScInterpreter::PopMatrix().

◆ SetImmutable()

void ScMatrix::SetImmutable ( ) const

Set the matrix to immutable for CloneIfConst(), only the interpreter should do this and know the consequences.

Definition at line 3115 of file scmatrix.cxx.

References mbCloneIfConst.

◆ SetMutable()

void ScMatrix::SetMutable ( )

Set the matrix to mutable for CloneIfConst(), only the interpreter should do this and know the consequences.

Definition at line 3110 of file scmatrix.cxx.

References mbCloneIfConst.

◆ SubOp()

void ScMatrix::SubOp ( bool  bFlag,
double  fVal,
const ScMatrix rMat 
)

Definition at line 3553 of file scmatrix.cxx.

References a, and pImpl.

◆ Sum()

ScMatrix::KahanIterateResult ScMatrix::Sum ( bool  bTextAsZero,
bool  bIgnoreErrorValues = false 
) const

Definition at line 3398 of file scmatrix.cxx.

References pImpl.

◆ SumSquare()

ScMatrix::KahanIterateResult ScMatrix::SumSquare ( bool  bTextAsZero,
bool  bIgnoreErrorValues = false 
) const

Definition at line 3403 of file scmatrix.cxx.

References pImpl.

◆ ValidColRow()

bool ScMatrix::ValidColRow ( SCSIZE  nC,
SCSIZE  nR 
) const

Definition at line 3153 of file scmatrix.cxx.

References pImpl.

Referenced by ValidColRowOrReplicated().

◆ ValidColRowOrReplicated()

bool ScMatrix::ValidColRowOrReplicated ( SCSIZE rC,
SCSIZE rR 
) const

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.

Definition at line 3163 of file scmatrix.cxx.

References ValidColRow(), and ValidColRowReplicated().

◆ ValidColRowReplicated()

bool ScMatrix::ValidColRowReplicated ( SCSIZE rC,
SCSIZE rR 
) const

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.

Definition at line 3158 of file scmatrix.cxx.

References pImpl.

Referenced by ValidColRowOrReplicated().

◆ Xor()

double ScMatrix::Xor ( ) const

Definition at line 3393 of file scmatrix.cxx.

References pImpl.

Friends And Related Function Documentation

◆ ScMatrixImpl

friend class ScMatrixImpl
friend

Definition at line 102 of file scmatrix.hxx.

Referenced by ScMatrix().

Member Data Documentation

◆ mbCloneIfConst

bool ScMatrix::mbCloneIfConst
mutableprivate

Definition at line 105 of file scmatrix.hxx.

Referenced by CloneIfConst(), SetImmutable(), and SetMutable().

◆ nRefCnt

size_t ScMatrix::nRefCnt
mutableprivate

Definition at line 104 of file scmatrix.hxx.

Referenced by DecRef(), and IncRef().

◆ pImpl

std::unique_ptr<ScMatrixImpl> ScMatrix::pImpl
private

The documentation for this class was generated from the following files: