#include "Mdefines.h"
#include "M5.h"
#include "t_rle.c"
Go to the source code of this file.
|
| SEXP | R_index_triangle (SEXP s_n, SEXP s_packed, SEXP s_upper, SEXP s_diag) |
| |
| SEXP | R_index_diagonal (SEXP s_n, SEXP s_packed, SEXP s_upper) |
| |
| SEXP | R_nnz (SEXP s_x, SEXP s_countNA, SEXP s_nnzmax) |
| |
| SEXP | R_all0 (SEXP x) |
| |
| SEXP | R_any0 (SEXP x) |
| |
| SEXP | Mmatrix (SEXP args) |
| |
| static int * | expand_cmprPt (int ncol, const int mp[], int mj[]) |
| | Expand compressed pointers in the array mp into a full set of indices in the array mj.
|
| |
| SEXP | compressed_non_0_ij (SEXP x, SEXP colP) |
| | Return a 2 column matrix '' cbind(i, j) '' of 0-origin index vectors (i,j) which entirely correspond to the (i,j) slots of as(x, "TsparseMatrix") :
|
| |
| SEXP | Matrix_expand_pointers (SEXP pP) |
| |
| SEXP | m_encodeInd (SEXP ij, SEXP di, SEXP orig_1, SEXP chk_bnds) |
| | Encode Matrix index (i,j) |--> i + j * nrow {i,j : 0-origin}.
|
| |
| SEXP | m_encodeInd2 (SEXP i, SEXP j, SEXP di, SEXP orig_1, SEXP chk_bnds) |
| | Encode Matrix index (i,j) |--> i + j * nrow {i,j : 0-origin}.
|
| |
◆ _rle_d_
◆ _rle_i_
◆ do_ii_FILL
| #define do_ii_FILL |
( |
| _i_, |
|
|
| _j_ ) |
Value: int i; \
if (check_bounds) { \
for (i = 0; i < n; i++) { \
if (_i_[i] == NA_INTEGER || _j_[i] == NA_INTEGER) \
ii[i] = NA_INTEGER; \
else { \
register int i_i, j_i; \
if (one_ind) { \
i_i = _i_[i]-1; \
j_i = _j_[i]-1; \
} else { \
i_i = _i_[i]; \
j_i = _j_[i]; \
} \
if (i_i < 0 || i_i >= Di[0]) \
Rf_error(
_(
"subscript 'i' out of bounds in M[ij]")); \
if (j_i < 0 || j_i >= Di[1]) \
Rf_error(
_(
"subscript 'j' out of bounds in M[ij]")); \
ii[i] = i_i + j_i * nr; \
} \
} \
} else { \
for (i = 0; i < n; i++) \
ii[i] = (_i_[i] == NA_INTEGER || _j_[i] == NA_INTEGER) \
? NA_INTEGER \
: ((one_ind) \
? ((_i_[i]-1) + (_j_[i]-1) * nr) \
: _i_[i] + _j_[i] * nr); \
}
Referenced by m_encodeInd(), and m_encodeInd2().
◆ DO_INDEX [1/2]
◆ DO_INDEX [2/2]
Value: do { \
if (!packed) { \
for (j = 0; j < n; ++j) { \
*(pr++) = k++; \
k += n; \
} \
} else if (upper) { \
for (j = 0; j < n; ++j) { \
*(pr++) = k; \
k += j+2; \
} \
} else { \
for (j = 0; j < n; ++j) { \
*(pr++) = k; \
k += n-j; \
} \
} \
} while (0)
◆ FALSE_
| #define FALSE_ Rf_ScalarLogical(0) |
◆ TEMPLATE
Value: do { \
c##TYPE *px =
c##PTR(s_x); \
if (countNA == NA_LOGICAL) { \
while (n-- > 0) { \
return Rf_ScalarInteger(NA_INTEGER); \
++nnz; \
++px; \
} \
} else if (countNA != 0) { \
while (n-- > 0) { \
++nnz; \
++px; \
} \
} else { \
while (n-- > 0) { \
if (
c##NOT_NA(*px) &&
c##NOT_ZERO(*px)) \
++nnz; \
++px; \
} \
} \
} while (0)
Referenced by R_nnz().
◆ TRUE_
| #define TRUE_ Rf_ScalarLogical(1) |
◆ compressed_non_0_ij()
| SEXP compressed_non_0_ij |
( |
SEXP | x, |
|
|
SEXP | colP ) |
◆ expand_cmprPt()
| static int * expand_cmprPt |
( |
int | ncol, |
|
|
const int | mp[], |
|
|
int | mj[] ) |
|
static |
Expand compressed pointers in the array mp into a full set of indices in the array mj.
- Parameters
-
| ncol | number of columns (or rows) |
| mp | column pointer vector of length ncol + 1 |
| mj | vector of length mp[ncol] to hold the result |
- Returns
- mj
Definition at line 432 of file utils-R.c.
Referenced by compressed_non_0_ij(), and Matrix_expand_pointers().
◆ m_encodeInd()
| SEXP m_encodeInd |
( |
SEXP | ij, |
|
|
SEXP | di, |
|
|
SEXP | orig_1, |
|
|
SEXP | chk_bnds ) |
Encode Matrix index (i,j) |--> i + j * nrow {i,j : 0-origin}.
- Parameters
-
| ij | 2-column integer matrix |
| di | dim(.), i.e. length 2 integer vector |
| chk_bnds | logical indicating 0 <= ij[,k] < di[k] need to be checked. |
- Returns
- encoded index; integer if prod(dim) is small; double otherwise
Definition at line 493 of file utils-R.c.
References _, do_ii_FILL, and TYPEOF.
◆ m_encodeInd2()
| SEXP m_encodeInd2 |
( |
SEXP | i, |
|
|
SEXP | j, |
|
|
SEXP | di, |
|
|
SEXP | orig_1, |
|
|
SEXP | chk_bnds ) |
Encode Matrix index (i,j) |--> i + j * nrow {i,j : 0-origin}.
- Parameters
-
| i | integer vector |
| j | integer vector of same length as 'i' |
| orig_1 | logical: if TRUE, "1-origin" otherwise "0-origin" |
| di | dim(.), i.e. length 2 integer vector |
| chk_bnds | logical indicating 0 <= ij[,k] < di[k] need to be checked. |
- Returns
- encoded index; integer if prod(dim) is small; double otherwise
Definition at line 571 of file utils-R.c.
References _, do_ii_FILL, and TYPEOF.
◆ Matrix_expand_pointers()
| SEXP Matrix_expand_pointers |
( |
SEXP | pP | ) |
|
◆ Mmatrix()
| SEXP Mmatrix |
( |
SEXP | args | ) |
|
◆ R_all0()
◆ R_any0()
◆ R_index_diagonal()
| SEXP R_index_diagonal |
( |
SEXP | s_n, |
|
|
SEXP | s_packed, |
|
|
SEXP | s_upper ) |
◆ R_index_triangle()
| SEXP R_index_triangle |
( |
SEXP | s_n, |
|
|
SEXP | s_packed, |
|
|
SEXP | s_upper, |
|
|
SEXP | s_diag ) |
◆ R_nnz()
| SEXP R_nnz |
( |
SEXP | s_x, |
|
|
SEXP | s_countNA, |
|
|
SEXP | s_nnzmax ) |