| 1 |
useDynLib(Matrix, .registration = TRUE) |
| 2 |
|
| 3 |
|
| 4 |
## ==== IMPORTS ======================================================== |
| 5 |
|
| 6 |
## Try to import all of the functions that we need |
| 7 |
## (including generic functions for which we define methods), |
| 8 |
## but not more ... |
| 9 |
|
| 10 |
importFrom("grDevices", colorRampPalette, grey) |
| 11 |
|
| 12 |
importFrom("graphics", image, par) |
| 13 |
|
| 14 |
importFrom("grid", convertHeight, convertWidth, current.viewport, |
| 15 |
gpar, grid.rect) |
| 16 |
|
| 17 |
importFrom("lattice", levelplot, panel.levelplot.raster) |
| 18 |
|
| 19 |
importFrom("methods", .hasSlot, .selectSuperClasses, .slotNames, |
| 20 |
Arith, Compare, Complex, Logic, Math, Math2, Ops, Summary, |
| 21 |
as, callGeneric, callNextMethod, canCoerce, cbind2, coerce, |
| 22 |
extends, getClassDef, getGroupMembers, |
| 23 |
is, isClassDef, kronecker, new, rbind2, |
| 24 |
setAs, setClass, setClassUnion, setGeneric, setMethod, |
| 25 |
setOldClass, show, slot, "slot<-", slotNames, validObject) |
| 26 |
|
| 27 |
importFrom("stats", contr.SAS, contr.helmert, contr.poly, contr.sum, |
| 28 |
contr.treatment, "contrasts<-", cov2cor , diffinv, model.frame, |
| 29 |
rnorm, runif, symnum, terms, toeplitz, update) |
| 30 |
|
| 31 |
importFrom("utils", capture.output, head, head.matrix, str, tail, tail.matrix) |
| 32 |
|
| 33 |
|
| 34 |
## ==== EXPORTS ======================================================== |
| 35 |
|
| 36 |
## ---- Non-generic functions ------------------------------------------ |
| 37 |
|
| 38 |
export(.M2C, |
| 39 |
.M2R, |
| 40 |
.M2T, |
| 41 |
.M2V, |
| 42 |
.M2diag, |
| 43 |
.M2gen, |
| 44 |
.M2kind, |
| 45 |
.M2m, |
| 46 |
.M2packed, |
| 47 |
.M2sym, |
| 48 |
.M2tri, |
| 49 |
.M2unpacked, |
| 50 |
.M2v, |
| 51 |
.bdiag, |
| 52 |
.dense2sparse, |
| 53 |
.diag.dsC, |
| 54 |
.diag2dense, |
| 55 |
.diag2sparse, |
| 56 |
.diagN2U, |
| 57 |
.diagU2N, |
| 58 |
.ind2dense, |
| 59 |
.ind2sparse, |
| 60 |
.formatSparseSimple, |
| 61 |
.m2V, |
| 62 |
.m2dense, |
| 63 |
.m2sparse, |
| 64 |
.sparse2dense, |
| 65 |
.sparseDiagonal, |
| 66 |
.symDiagonal, |
| 67 |
.trDiagonal, |
| 68 |
.solve.dgC.chol, |
| 69 |
.solve.dgC.lu, |
| 70 |
.solve.dgC.qr, |
| 71 |
.tCRT, |
| 72 |
.updateCHMfactor, |
| 73 |
.validateCsparse, |
| 74 |
Diagonal, |
| 75 |
Hilbert, |
| 76 |
KhatriRao, |
| 77 |
Matrix, |
| 78 |
Matrix.Version, |
| 79 |
MatrixClass, |
| 80 |
T2graph, |
| 81 |
abIseq, |
| 82 |
abIseq1, |
| 83 |
aggregateT, |
| 84 |
anyDuplicatedT, |
| 85 |
asPerm, |
| 86 |
asUniqueT, |
| 87 |
bandSparse, |
| 88 |
bdiag, |
| 89 |
## 'c' dispatches on first argument only, so allow direct method calls : |
| 90 |
## c.Matrix, # not yet (see below) |
| 91 |
c.sparseVector, |
| 92 |
colScale, |
| 93 |
condest, |
| 94 |
det, |
| 95 |
diagN2U, |
| 96 |
diagU2N, |
| 97 |
dimScale, |
| 98 |
dmperm, |
| 99 |
drop0, |
| 100 |
fac2Sparse, |
| 101 |
fac2sparse, |
| 102 |
formatSpMatrix, |
| 103 |
formatSparseM, |
| 104 |
graph2T, |
| 105 |
invPerm, |
| 106 |
invertPerm, |
| 107 |
is.null.DN, |
| 108 |
isLDL, |
| 109 |
isPerm, |
| 110 |
isUniqueT, |
| 111 |
mat2triplet, |
| 112 |
nearPD, |
| 113 |
onenormest, |
| 114 |
qr2rankMatrix, |
| 115 |
qrR, |
| 116 |
printSpMatrix, |
| 117 |
printSpMatrix2, |
| 118 |
rankMatrix, |
| 119 |
readHB, |
| 120 |
readMM, |
| 121 |
rep2abI, |
| 122 |
rowScale, |
| 123 |
rsparsematrix, |
| 124 |
signPerm, |
| 125 |
spMatrix, |
| 126 |
sparse.model.matrix, |
| 127 |
sparseMatrix, |
| 128 |
sparseVector) |
| 129 |
|
| 130 |
## Deprecated since Matrix 1.5-4 {Apr 2023} |
| 131 |
export(..2dge, .C2nC, .T2Cmat, .asmatrix, .dense2sy, |
| 132 |
.diag2mat, .diag2sT, .diag2tT, .dsy2dsp, .dsy2mat, .dxC2mat, |
| 133 |
.m2dgC, .m2lgC, .m2ngC, .m2ngCn, .m2ngTn, .n2dgT, .nC2d, .nC2l) |
| 134 |
|
| 135 |
## Defunct since Matrix 1.3-3 {May 2021} |
| 136 |
export(cBind, rBind) |
| 137 |
|
| 138 |
## Redundant now but not yet deprecated ... |
| 139 |
export(.CR2RC, .CR2T, .SuiteSparse_version, .T2CR, .dense2g, .dense2kind, |
| 140 |
.dense2m, .dense2v, .sparse2g, .sparse2kind, .sparse2m, .sparse2v, |
| 141 |
.tCR2RC, uniqTsparse) |
| 142 |
|
| 143 |
|
| 144 |
## ---- S3 generic functions ------------------------------------------- |
| 145 |
|
| 146 |
## export() # {probably none ever} |
| 147 |
|
| 148 |
|
| 149 |
## ---- S3 methods ----------------------------------------------------- |
| 150 |
|
| 151 |
## So that dispatch also happens inside of 'base' functions: |
| 152 |
S3method(as.matrix, Matrix) |
| 153 |
S3method(as.matrix, sparseVector) |
| 154 |
S3method(as.array, Matrix) |
| 155 |
S3method(as.array, sparseVector) |
| 156 |
|
| 157 |
## Because S4 dispatch is "hard" for c(): |
| 158 |
## S3method(c, Matrix) # breaks 7 rev. dep. {2023-09-08} |
| 159 |
S3method(c, sparseVector) |
| 160 |
S3method(c, abIndex) |
| 161 |
|
| 162 |
## For printing return values of our summary() methods: |
| 163 |
S3method(print, diagSummary) |
| 164 |
S3method(print, sparseSummary) |
| 165 |
|
| 166 |
|
| 167 |
## ---- S4 generic functions, methods ---------------------------------- |
| 168 |
|
| 169 |
export(crossprod, tcrossprod) # *necessary* (once .Primitive in base) |
| 170 |
## MJ: why these and not also export(dim, ...) which are also primitive ?? |
| 171 |
|
| 172 |
## From 'Matrix' {no need to also export(); see WRE} |
| 173 |
exportMethods("%&%", |
| 174 |
BunchKaufman, |
| 175 |
Cholesky, |
| 176 |
Schur, |
| 177 |
band, |
| 178 |
expand, |
| 179 |
expand1, |
| 180 |
expand2, |
| 181 |
expm, |
| 182 |
facmul, |
| 183 |
forceSymmetric, |
| 184 |
isDiagonal, |
| 185 |
isTriangular, |
| 186 |
lu, |
| 187 |
nnzero, |
| 188 |
pack, |
| 189 |
skewpart, |
| 190 |
symmpart, |
| 191 |
tril, |
| 192 |
triu, |
| 193 |
unpack, |
| 194 |
updown, |
| 195 |
writeMM) |
| 196 |
|
| 197 |
## From 'base' --- several of these are implicitGeneric |
| 198 |
exportMethods("!", |
| 199 |
"%*%", |
| 200 |
"+", |
| 201 |
all.equal, |
| 202 |
as.array, |
| 203 |
as.complex, |
| 204 |
as.integer, |
| 205 |
as.logical, |
| 206 |
as.matrix, |
| 207 |
as.numeric, |
| 208 |
as.vector, |
| 209 |
chol, |
| 210 |
chol2inv, |
| 211 |
colMeans, |
| 212 |
colSums, |
| 213 |
crossprod, |
| 214 |
determinant, |
| 215 |
diag, |
| 216 |
"diag<-", |
| 217 |
diff, |
| 218 |
dim, |
| 219 |
"dim<-", |
| 220 |
dimnames, |
| 221 |
"dimnames<-", |
| 222 |
drop, |
| 223 |
format, |
| 224 |
is.finite, |
| 225 |
is.infinite, |
| 226 |
is.na, |
| 227 |
isSymmetric, |
| 228 |
kronecker, |
| 229 |
length, |
| 230 |
mean, |
| 231 |
norm, |
| 232 |
print, |
| 233 |
qr, |
| 234 |
qr.Q, |
| 235 |
qr.R, |
| 236 |
qr.X, |
| 237 |
qr.coef, |
| 238 |
qr.fitted, |
| 239 |
qr.resid, |
| 240 |
qr.qty, |
| 241 |
qr.qy, |
| 242 |
rcond, |
| 243 |
rep, |
| 244 |
rowMeans, |
| 245 |
rowSums, |
| 246 |
solve, |
| 247 |
summary, |
| 248 |
t, |
| 249 |
tcrossprod, |
| 250 |
unname, |
| 251 |
which, |
| 252 |
zapsmall) |
| 253 |
|
| 254 |
## From 'graphics' |
| 255 |
exportMethods(image) |
| 256 |
|
| 257 |
## From 'methods' |
| 258 |
exportMethods(Arith, Compare, Logic, Math, Math2, Ops, Summary, |
| 259 |
cbind2, coerce, rbind2, show) |
| 260 |
|
| 261 |
## From 'stats' |
| 262 |
exportMethods(cov2cor, toeplitz, update) |
| 263 |
|
| 264 |
## From 'utils' |
| 265 |
exportMethods(head, tail) |
| 266 |
|
| 267 |
|
| 268 |
## ---- S4 CLASSES ----------------------------------------------------- |
| 269 |
|
| 270 |
exportClasses(Matrix, # and its subclasses ............................. |
| 271 |
|
| 272 |
generalMatrix, |
| 273 |
symmetricMatrix, |
| 274 |
triangularMatrix, |
| 275 |
diagonalMatrix, |
| 276 |
|
| 277 |
denseMatrix, |
| 278 |
unpackedMatrix, |
| 279 |
packedMatrix, |
| 280 |
|
| 281 |
sparseMatrix, |
| 282 |
CsparseMatrix, |
| 283 |
RsparseMatrix, |
| 284 |
TsparseMatrix, |
| 285 |
|
| 286 |
nMatrix, |
| 287 |
|
| 288 |
ndenseMatrix, |
| 289 |
ngeMatrix, |
| 290 |
nsyMatrix, |
| 291 |
nspMatrix, |
| 292 |
ntrMatrix, |
| 293 |
ntpMatrix, |
| 294 |
|
| 295 |
nsparseMatrix, |
| 296 |
ngCMatrix, |
| 297 |
ngRMatrix, |
| 298 |
ngTMatrix, |
| 299 |
nsCMatrix, |
| 300 |
nsRMatrix, |
| 301 |
nsTMatrix, |
| 302 |
ntCMatrix, |
| 303 |
ntRMatrix, |
| 304 |
ntTMatrix, |
| 305 |
|
| 306 |
ndiMatrix, |
| 307 |
|
| 308 |
lMatrix, |
| 309 |
|
| 310 |
ldenseMatrix, |
| 311 |
lgeMatrix, |
| 312 |
lsyMatrix, |
| 313 |
lspMatrix, |
| 314 |
ltrMatrix, |
| 315 |
ltpMatrix, |
| 316 |
|
| 317 |
lsparseMatrix, |
| 318 |
lgCMatrix, |
| 319 |
lgRMatrix, |
| 320 |
lgTMatrix, |
| 321 |
lsCMatrix, |
| 322 |
lsRMatrix, |
| 323 |
lsTMatrix, |
| 324 |
ltCMatrix, |
| 325 |
ltRMatrix, |
| 326 |
ltTMatrix, |
| 327 |
|
| 328 |
ldiMatrix, |
| 329 |
|
| 330 |
iMatrix, |
| 331 |
|
| 332 |
## idenseMatrix, |
| 333 |
## igeMatrix, |
| 334 |
## isyMatrix, |
| 335 |
## ispMatrix, |
| 336 |
## itrMatrix, |
| 337 |
## itpMatrix, |
| 338 |
|
| 339 |
## isparseMatrix, |
| 340 |
## igCMatrix, |
| 341 |
## igRMatrix, |
| 342 |
## igTMatrix, |
| 343 |
## isCMatrix, |
| 344 |
## isRMatrix, |
| 345 |
## isTMatrix, |
| 346 |
## itCMatrix, |
| 347 |
## itRMatrix, |
| 348 |
## itTMatrix, |
| 349 |
|
| 350 |
## idiMatrix, |
| 351 |
|
| 352 |
dMatrix, |
| 353 |
|
| 354 |
ddenseMatrix, |
| 355 |
dgeMatrix, |
| 356 |
dsyMatrix, |
| 357 |
dspMatrix, |
| 358 |
dpoMatrix, |
| 359 |
dppMatrix, |
| 360 |
corMatrix, |
| 361 |
copMatrix, |
| 362 |
dtrMatrix, |
| 363 |
dtpMatrix, |
| 364 |
|
| 365 |
dsparseMatrix, |
| 366 |
dgCMatrix, |
| 367 |
dgRMatrix, |
| 368 |
dgTMatrix, |
| 369 |
dsCMatrix, |
| 370 |
dsRMatrix, |
| 371 |
dsTMatrix, |
| 372 |
dtCMatrix, |
| 373 |
dtRMatrix, |
| 374 |
dtTMatrix, |
| 375 |
|
| 376 |
ddiMatrix, |
| 377 |
|
| 378 |
zMatrix, |
| 379 |
|
| 380 |
## zdenseMatrix, |
| 381 |
## zgeMatrix, |
| 382 |
## zsyMatrix, |
| 383 |
## zspMatrix, |
| 384 |
## ztrMatrix, |
| 385 |
## ztpMatrix, |
| 386 |
|
| 387 |
## zsparseMatrix, |
| 388 |
## zgCMatrix, |
| 389 |
## zgRMatrix, |
| 390 |
## zgTMatrix, |
| 391 |
## zsCMatrix, |
| 392 |
## zsRMatrix, |
| 393 |
## zsTMatrix, |
| 394 |
## ztCMatrix, |
| 395 |
## ztRMatrix, |
| 396 |
## ztTMatrix, |
| 397 |
|
| 398 |
## zdiMatrix, |
| 399 |
|
| 400 |
indMatrix, |
| 401 |
pMatrix, |
| 402 |
|
| 403 |
MatrixFactorization, # and its subclasses ................ |
| 404 |
|
| 405 |
LU, |
| 406 |
denseLU, |
| 407 |
sparseLU, |
| 408 |
|
| 409 |
QR, |
| 410 |
## denseQR, |
| 411 |
sparseQR, |
| 412 |
|
| 413 |
SchurFactorization, |
| 414 |
Schur, |
| 415 |
|
| 416 |
BunchKaufmanFactorization, |
| 417 |
BunchKaufman, |
| 418 |
pBunchKaufman, |
| 419 |
|
| 420 |
CholeskyFactorization, |
| 421 |
Cholesky, |
| 422 |
pCholesky, |
| 423 |
CHMfactor, |
| 424 |
CHMsuper, |
| 425 |
dCHMsuper, |
| 426 |
nCHMsuper, # unused |
| 427 |
CHMsimpl, |
| 428 |
dCHMsimpl, |
| 429 |
nCHMsimpl, # unused |
| 430 |
|
| 431 |
sparseVector, # and its subclasses ....................... |
| 432 |
nsparseVector, |
| 433 |
lsparseVector, |
| 434 |
isparseVector, |
| 435 |
dsparseVector, |
| 436 |
zsparseVector, |
| 437 |
|
| 438 |
## MJ: aim to deprecate and eventually remove these |
| 439 |
## (except perhaps 'index') |
| 440 |
abIndex, |
| 441 |
atomicVector, |
| 442 |
compMatrix, |
| 443 |
index, |
| 444 |
number, |
| 445 |
replValue, |
| 446 |
rleDiff) |