Matrix r5059
Loading...
Searching...
No Matches
validity.c File Reference
#include "Mdefines.h"

Go to the source code of this file.

Macros

#define MK(_FORMAT_)
 
#define MS(_FORMAT_, ...)
 
#define RMK(_FORMAT_)
 
#define RMS(_FORMAT_, ...)
 
#define RMKMS(_FORMAT_, ...)
 
#define FRMK(_FORMAT_)
 
#define FRMS(_FORMAT_, ...)
 
#define FRMKMS(_FORMAT_, ...)
 
#define KINDMATRIX_VALIDATE(_PREFIX_, _SEXPTYPE_)
 
#define KINDVECTOR_VALIDATE(_PREFIX_, _SEXPTYPE_)
 
#define IS_VALID(_CLASS_)
 
#define IS_VALID_SPARSE(_C_)
 

Functions

static char * Dim_validate (SEXP dim)
 
SEXP R_Dim_validate (SEXP dim)
 
static char * DimNames_validate (SEXP dimnames, int *pdim)
 
SEXP R_DimNames_validate (SEXP dimnames, SEXP dim)
 
SEXP R_DimNames_fixup (SEXP dimnames)
 
SEXP Matrix_validate (SEXP obj)
 
SEXP generalMatrix_validate (SEXP obj)
 
SEXP symmetricMatrix_validate (SEXP obj)
 
SEXP triangularMatrix_validate (SEXP obj)
 
SEXP unpackedMatrix_validate (SEXP obj)
 
SEXP packedMatrix_validate (SEXP obj)
 
SEXP CsparseMatrix_validate (SEXP obj)
 
SEXP RsparseMatrix_validate (SEXP obj)
 
SEXP TsparseMatrix_validate (SEXP obj)
 
SEXP diagonalMatrix_validate (SEXP obj)
 
SEXP indMatrix_validate (SEXP obj)
 
SEXP pMatrix_validate (SEXP obj)
 
SEXP sCMatrix_validate (SEXP obj)
 
SEXP tCMatrix_validate (SEXP obj)
 
SEXP sRMatrix_validate (SEXP obj)
 
SEXP tRMatrix_validate (SEXP obj)
 
SEXP sTMatrix_validate (SEXP obj)
 
SEXP tTMatrix_validate (SEXP obj)
 
SEXP xgCMatrix_validate (SEXP obj)
 
SEXP xsCMatrix_validate (SEXP obj)
 
SEXP xtCMatrix_validate (SEXP obj)
 
SEXP xgRMatrix_validate (SEXP obj)
 
SEXP xsRMatrix_validate (SEXP obj)
 
SEXP xtRMatrix_validate (SEXP obj)
 
SEXP xgTMatrix_validate (SEXP obj)
 
SEXP xsTMatrix_validate (SEXP obj)
 
SEXP xtTMatrix_validate (SEXP obj)
 
SEXP xpoMatrix_validate (SEXP obj)
 
SEXP xppMatrix_validate (SEXP obj)
 
SEXP xpCMatrix_validate (SEXP obj)
 
SEXP xpRMatrix_validate (SEXP obj)
 
SEXP xpTMatrix_validate (SEXP obj)
 
SEXP corMatrix_validate (SEXP obj)
 
SEXP copMatrix_validate (SEXP obj)
 
SEXP sparseVector_validate (SEXP obj)
 
SEXP MatrixFactorization_validate (SEXP obj)
 
SEXP denseSchur_validate (SEXP obj)
 
SEXP denseQR_validate (SEXP obj)
 
SEXP denseLU_validate (SEXP obj)
 
SEXP denseBunchKaufman_validate (SEXP obj)
 
SEXP denseCholesky_validate (SEXP obj)
 
SEXP sparseQR_validate (SEXP obj)
 
SEXP sparseLU_validate (SEXP obj)
 
SEXP sparseCholesky_validate (SEXP obj)
 
SEXP simplicialCholesky_validate (SEXP obj)
 
SEXP supernodalCholesky_validate (SEXP obj)
 
void validObject (SEXP obj, const char *cl)
 

Macro Definition Documentation

◆ FRMK

#define FRMK ( _FORMAT_)
Value:
do { \
Matrix_Free(work, lwork); \
RMK (_FORMAT_ ); \
} while (0)

Definition at line 13 of file validity.c.

Referenced by xpTMatrix_validate().

◆ FRMKMS

#define FRMKMS ( _FORMAT_,
... )
Value:
do { \
Matrix_Free(work, lwork); \
RMKMS(_FORMAT_, __VA_ARGS__); \
} while (0)

Definition at line 23 of file validity.c.

Referenced by denseCholesky_validate(), denseQR_validate(), pMatrix_validate(), sparseCholesky_validate(), sparseLU_validate(), and sparseQR_validate().

◆ FRMS

#define FRMS ( _FORMAT_,
... )
Value:
do { \
Matrix_Free(work, lwork); \
RMS (_FORMAT_, __VA_ARGS__); \
} while (0)

Definition at line 18 of file validity.c.

◆ IS_VALID

#define IS_VALID ( _CLASS_)
Value:
do { \
status = _CLASS_ ## _validate(obj); \
if (TYPEOF(status) == STRSXP) \
Rf_error(_("invalid class \"%s\" object: %s"), \
cl, CHAR(STRING_ELT(status, 0))); \
} while (0)
#define _(String)
Definition Mdefines.h:66
#define TYPEOF(s)
Definition Mdefines.h:123
cholmod_common cl
Definition cholmod-etc.c:6

Referenced by validObject().

◆ IS_VALID_SPARSE

#define IS_VALID_SPARSE ( _C_)
Value:
do { \
IS_VALID(_C_ ## sparseMatrix); \
if (cl[0] == 'n') { \
if (cl[1] == 's') \
IS_VALID(s ## _C_ ## Matrix); \
else if (cl[1] == 't') \
IS_VALID(t ## _C_ ## Matrix); \
} else { \
if (cl[1] == 'g') \
IS_VALID(xg ## _C_ ## Matrix); \
else if (cl[1] == 's' || cl[1] == 'p') \
IS_VALID(xs ## _C_ ## Matrix); \
else if (cl[1] == 't') \
IS_VALID(xt ## _C_ ## Matrix); \
if (cl[1] == 'p') \
IS_VALID(xp ## _C_ ## Matrix); \
} \
} while (0)

Referenced by validObject().

◆ KINDMATRIX_VALIDATE

#define KINDMATRIX_VALIDATE ( _PREFIX_,
_SEXPTYPE_ )
Value:
SEXP _PREFIX_ ## Matrix_validate(SEXP obj) \
{ \
SEXP x = GET_SLOT(obj, Matrix_xSym); \
if (TYPEOF(x) != _SEXPTYPE_) \
RMKMS(_("'%s' slot is not of type \"%s\""), \
"x", Rf_type2char(_SEXPTYPE_)); \
return Rf_ScalarLogical(1); \
}
#define GET_SLOT(x, name)
Definition Mdefines.h:72
SEXP Matrix_xSym
Definition init.c:635
SEXP Matrix_validate(SEXP obj)
Definition validity.c:136

Definition at line 149 of file validity.c.

◆ KINDVECTOR_VALIDATE

#define KINDVECTOR_VALIDATE ( _PREFIX_,
_SEXPTYPE_ )
Value:
SEXP _PREFIX_ ## sparseVector_validate(SEXP obj) \
{ \
SEXP x = PROTECT(GET_SLOT(obj, Matrix_xSym)), \
i = PROTECT(GET_SLOT(obj, Matrix_iSym)); \
UNPROTECT(2); /* i, x */ \
if (TYPEOF(x) != _SEXPTYPE_) \
RMKMS(_("'%s' slot is not of type \"%s\""), \
"x", Rf_type2char(_SEXPTYPE_)); \
if (XLENGTH(x) != XLENGTH(i)) \
RMKMS(_("'%s' and '%s' slots do not have equal length"), \
"i", "x"); \
return Rf_ScalarLogical(1); \
}
SEXP Matrix_iSym
Definition init.c:607
SEXP sparseVector_validate(SEXP obj)
Definition validity.c:1089

Definition at line 1153 of file validity.c.

◆ MK

#define MK ( _FORMAT_)
Value:
Rf_mkString(_FORMAT_ )

Definition at line 3 of file validity.c.

◆ MS

#define MS ( _FORMAT_,
... )
Value:
Matrix_sprintf(_FORMAT_, __VA_ARGS__)
char * Matrix_sprintf(const char *,...)
Definition utils.c:18

Definition at line 4 of file validity.c.

◆ RMK

◆ RMKMS

◆ RMS

#define RMS ( _FORMAT_,
... )
Value:
return MS(_FORMAT_, __VA_ARGS__)

Definition at line 8 of file validity.c.

Referenced by Dim_validate(), and DimNames_validate().

Function Documentation

◆ copMatrix_validate()

SEXP copMatrix_validate ( SEXP obj)

Definition at line 1059 of file validity.c.

References _, DIM, GET_SLOT, Matrix_sdSym, Matrix_xSym, RMK, RMKMS, TYPEOF, and UPLO.

◆ corMatrix_validate()

SEXP corMatrix_validate ( SEXP obj)

Definition at line 1035 of file validity.c.

References _, DIM, GET_SLOT, Matrix_sdSym, Matrix_xSym, RMK, RMKMS, and TYPEOF.

◆ CsparseMatrix_validate()

SEXP CsparseMatrix_validate ( SEXP obj)

Definition at line 299 of file validity.c.

References _, DIM, GET_SLOT, Matrix_iSym, Matrix_pSym, RMKMS, and TYPEOF.

◆ denseBunchKaufman_validate()

SEXP denseBunchKaufman_validate ( SEXP obj)

Definition at line 1288 of file validity.c.

References _, DIM, GET_SLOT, HAS_SLOT, Matrix_permSym, Matrix_transSym, Matrix_uploSym, Matrix_xSym, RMKMS, and TYPEOF.

◆ denseCholesky_validate()

SEXP denseCholesky_validate ( SEXP obj)

◆ denseLU_validate()

SEXP denseLU_validate ( SEXP obj)

Definition at line 1259 of file validity.c.

References _, DIM, GET_SLOT, Matrix_permSym, Matrix_xSym, RMKMS, and TYPEOF.

◆ denseQR_validate()

SEXP denseQR_validate ( SEXP obj)

◆ denseSchur_validate()

SEXP denseSchur_validate ( SEXP obj)

Definition at line 1178 of file validity.c.

References _, DIM, GET_SLOT, Matrix_valuesSym, Matrix_vectorsSym, Matrix_xSym, RMKMS, and TYPEOF.

◆ diagonalMatrix_validate()

SEXP diagonalMatrix_validate ( SEXP obj)

Definition at line 437 of file validity.c.

References _, DIM, GET_SLOT, Matrix_diagSym, Matrix_xSym, RMKMS, and TYPEOF.

◆ Dim_validate()

static char * Dim_validate ( SEXP dim)
static

Definition at line 35 of file validity.c.

References _, RMS, and TYPEOF.

Referenced by Matrix_validate(), and R_Dim_validate().

◆ DimNames_validate()

static char * DimNames_validate ( SEXP dimnames,
int * pdim )
static

Definition at line 57 of file validity.c.

References _, RMS, and TYPEOF.

Referenced by Matrix_validate(), and R_DimNames_validate().

◆ generalMatrix_validate()

SEXP generalMatrix_validate ( SEXP obj)

Definition at line 165 of file validity.c.

References _, GET_SLOT, Matrix_factorsSym, RMKMS, and TYPEOF.

Referenced by symmetricMatrix_validate().

◆ indMatrix_validate()

SEXP indMatrix_validate ( SEXP obj)

Definition at line 461 of file validity.c.

References _, DIM, GET_SLOT, Matrix_marginSym, Matrix_permSym, RMKMS, and TYPEOF.

◆ Matrix_validate()

SEXP Matrix_validate ( SEXP obj)

◆ MatrixFactorization_validate()

SEXP MatrixFactorization_validate ( SEXP obj)

Definition at line 1173 of file validity.c.

References Matrix_validate().

◆ packedMatrix_validate()

SEXP packedMatrix_validate ( SEXP obj)

Definition at line 290 of file validity.c.

References _, DIM, GET_SLOT, Matrix_xSym, and RMKMS.

◆ pMatrix_validate()

SEXP pMatrix_validate ( SEXP obj)

Definition at line 496 of file validity.c.

References _, DIM, FRMKMS, GET_SLOT, Matrix_Calloc, Matrix_Free, Matrix_permSym, and RMKMS.

◆ R_Dim_validate()

SEXP R_Dim_validate ( SEXP dim)

Definition at line 50 of file validity.c.

References Dim_validate().

◆ R_DimNames_fixup()

SEXP R_DimNames_fixup ( SEXP dimnames)

Definition at line 95 of file validity.c.

References TYPEOF.

◆ R_DimNames_validate()

SEXP R_DimNames_validate ( SEXP dimnames,
SEXP dim )

Definition at line 89 of file validity.c.

References DimNames_validate().

◆ RsparseMatrix_validate()

SEXP RsparseMatrix_validate ( SEXP obj)

Definition at line 349 of file validity.c.

References _, DIM, GET_SLOT, Matrix_jSym, Matrix_pSym, RMKMS, and TYPEOF.

◆ sCMatrix_validate()

SEXP sCMatrix_validate ( SEXP obj)

Definition at line 519 of file validity.c.

References _, GET_SLOT, Matrix_iSym, Matrix_pSym, RMKMS, and UPLO.

Referenced by tCMatrix_validate(), and xsCMatrix_validate().

◆ simplicialCholesky_validate()

SEXP simplicialCholesky_validate ( SEXP obj)

◆ sparseCholesky_validate()

SEXP sparseCholesky_validate ( SEXP obj)

◆ sparseLU_validate()

SEXP sparseLU_validate ( SEXP obj)

◆ sparseQR_validate()

SEXP sparseQR_validate ( SEXP obj)

◆ sparseVector_validate()

SEXP sparseVector_validate ( SEXP obj)

Definition at line 1089 of file validity.c.

References _, GET_SLOT, Matrix_iSym, Matrix_lengthSym, RMKMS, and TYPEOF.

◆ sRMatrix_validate()

SEXP sRMatrix_validate ( SEXP obj)

Definition at line 606 of file validity.c.

References _, GET_SLOT, Matrix_jSym, Matrix_pSym, RMKMS, and UPLO.

Referenced by tRMatrix_validate(), and xsRMatrix_validate().

◆ sTMatrix_validate()

SEXP sTMatrix_validate ( SEXP obj)

Definition at line 693 of file validity.c.

References _, GET_SLOT, Matrix_iSym, Matrix_jSym, RMKMS, and UPLO.

Referenced by tTMatrix_validate(), and xsTMatrix_validate().

◆ supernodalCholesky_validate()

SEXP supernodalCholesky_validate ( SEXP obj)

◆ symmetricMatrix_validate()

SEXP symmetricMatrix_validate ( SEXP obj)

◆ tCMatrix_validate()

SEXP tCMatrix_validate ( SEXP obj)

Definition at line 558 of file validity.c.

References _, DIAG, GET_SLOT, Matrix_iSym, Matrix_pSym, RMKMS, sCMatrix_validate(), and UPLO.

Referenced by xtCMatrix_validate().

◆ triangularMatrix_validate()

SEXP triangularMatrix_validate ( SEXP obj)

Definition at line 254 of file validity.c.

References _, DIM, GET_SLOT, Matrix_diagSym, Matrix_uploSym, RMKMS, and TYPEOF.

◆ tRMatrix_validate()

SEXP tRMatrix_validate ( SEXP obj)

Definition at line 645 of file validity.c.

References _, DIAG, GET_SLOT, Matrix_jSym, Matrix_pSym, RMKMS, sRMatrix_validate(), and UPLO.

Referenced by xtRMatrix_validate().

◆ TsparseMatrix_validate()

SEXP TsparseMatrix_validate ( SEXP obj)

Definition at line 399 of file validity.c.

References _, DIM, GET_SLOT, Matrix_iSym, Matrix_jSym, RMKMS, and TYPEOF.

◆ tTMatrix_validate()

SEXP tTMatrix_validate ( SEXP obj)

Definition at line 722 of file validity.c.

References _, DIAG, GET_SLOT, Matrix_iSym, Matrix_jSym, RMKMS, sTMatrix_validate(), and UPLO.

Referenced by xtTMatrix_validate().

◆ unpackedMatrix_validate()

SEXP unpackedMatrix_validate ( SEXP obj)

Definition at line 281 of file validity.c.

References _, DIM, GET_SLOT, Matrix_xSym, and RMKMS.

◆ validObject()

void validObject ( SEXP obj,
const char * cl )

Definition at line 2004 of file validity.c.

References cl, IS_VALID, and IS_VALID_SPARSE.

Referenced by R_subscript_1ary(), R_subscript_1ary_2col(), and R_subscript_2ary().

◆ xgCMatrix_validate()

SEXP xgCMatrix_validate ( SEXP obj)

Definition at line 766 of file validity.c.

References _, GET_SLOT, Matrix_iSym, Matrix_xSym, and RMKMS.

Referenced by xsCMatrix_validate(), and xtCMatrix_validate().

◆ xgRMatrix_validate()

SEXP xgRMatrix_validate ( SEXP obj)

Definition at line 792 of file validity.c.

References _, GET_SLOT, Matrix_jSym, Matrix_xSym, and RMKMS.

Referenced by xsRMatrix_validate(), and xtRMatrix_validate().

◆ xgTMatrix_validate()

SEXP xgTMatrix_validate ( SEXP obj)

Definition at line 818 of file validity.c.

References _, GET_SLOT, Matrix_iSym, Matrix_xSym, and RMKMS.

Referenced by xsTMatrix_validate(), and xtTMatrix_validate().

◆ xpCMatrix_validate()

SEXP xpCMatrix_validate ( SEXP obj)

Definition at line 907 of file validity.c.

References _, DIM, GET_SLOT, Matrix_iSym, Matrix_pSym, Matrix_xSym, RMK, RMKMS, TRANS, TYPEOF, and UPLO.

◆ xpoMatrix_validate()

SEXP xpoMatrix_validate ( SEXP obj)

Definition at line 849 of file validity.c.

References _, DIM, GET_SLOT, Matrix_xSym, RMK, RMKMS, TRANS, and TYPEOF.

◆ xppMatrix_validate()

SEXP xppMatrix_validate ( SEXP obj)

Definition at line 872 of file validity.c.

References _, DIM, GET_SLOT, Matrix_xSym, RMK, RMKMS, TRANS, TYPEOF, and UPLO.

◆ xpRMatrix_validate()

SEXP xpRMatrix_validate ( SEXP obj)

Definition at line 950 of file validity.c.

References _, DIM, GET_SLOT, Matrix_jSym, Matrix_pSym, Matrix_xSym, RMK, RMKMS, TRANS, TYPEOF, and UPLO.

◆ xpTMatrix_validate()

SEXP xpTMatrix_validate ( SEXP obj)

Definition at line 993 of file validity.c.

References _, DIM, FRMK, GET_SLOT, Matrix_Calloc, Matrix_Free, Matrix_iSym, Matrix_jSym, Matrix_xSym, RMKMS, TRANS, and TYPEOF.

◆ xsCMatrix_validate()

SEXP xsCMatrix_validate ( SEXP obj)

Definition at line 776 of file validity.c.

References sCMatrix_validate(), TYPEOF, and xgCMatrix_validate().

◆ xsRMatrix_validate()

SEXP xsRMatrix_validate ( SEXP obj)

Definition at line 802 of file validity.c.

References sRMatrix_validate(), TYPEOF, and xgRMatrix_validate().

◆ xsTMatrix_validate()

SEXP xsTMatrix_validate ( SEXP obj)

Definition at line 828 of file validity.c.

References sTMatrix_validate(), TYPEOF, and xgTMatrix_validate().

◆ xtCMatrix_validate()

SEXP xtCMatrix_validate ( SEXP obj)

Definition at line 784 of file validity.c.

References tCMatrix_validate(), TYPEOF, and xgCMatrix_validate().

◆ xtRMatrix_validate()

SEXP xtRMatrix_validate ( SEXP obj)

Definition at line 810 of file validity.c.

References tRMatrix_validate(), TYPEOF, and xgRMatrix_validate().

◆ xtTMatrix_validate()

SEXP xtTMatrix_validate ( SEXP obj)

Definition at line 836 of file validity.c.

References tTMatrix_validate(), TYPEOF, and xgTMatrix_validate().