Package: MatrixExtra 0.1.15

David Cortes

MatrixExtra: Extra Methods for Sparse Matrices

Extends sparse matrix and vector classes from the 'Matrix' package by providing: (a) Methods and operators that work natively on CSR formats (compressed sparse row, a.k.a. 'RsparseMatrix') such as slicing/sub-setting, assignment, rbind(), mathematical operators for CSR and COO such as addition ("+") or sqrt(), and methods such as diag(); (b) Multi-threaded matrix multiplication and cross-product for many <sparse, dense> types, including the 'float32' type from 'float'; (c) Coercion methods between pairs of classes which are not present in 'Matrix', such as 'dgCMatrix' -> 'ngRMatrix', as well as convenience conversion functions; (d) Utility functions for sparse matrices such as sorting the indices or removing zero-valued entries; (e) Fast transposes that work by outputting in the opposite storage format; (f) Faster replacements for many 'Matrix' methods for all sparse types, such as slicing and elementwise multiplication. (g) Convenience functions for sparse objects, such as 'mapSparse' or a shorter 'show' method.

Authors:David Cortes [aut, cre, cph], Dmitry Selivanov [cph], Thibaut Goetghebuer-Planchon [cph], Martin Maechler [cph], Robert Gentleman [cph], Ross Ihaka [cph]

MatrixExtra_0.1.15.tar.gz
MatrixExtra_0.1.15.zip(r-4.5)MatrixExtra_0.1.15.zip(r-4.4)MatrixExtra_0.1.15.zip(r-4.3)
MatrixExtra_0.1.15.tgz(r-4.4-arm64)MatrixExtra_0.1.15.tgz(r-4.4-x86_64)MatrixExtra_0.1.15.tgz(r-4.3-arm64)MatrixExtra_0.1.15.tgz(r-4.3-x86_64)
MatrixExtra_0.1.15.tar.gz(r-4.5-noble)MatrixExtra_0.1.15.tar.gz(r-4.4-noble)
MatrixExtra.pdf |MatrixExtra.html
MatrixExtra/json (API)

# Install 'MatrixExtra' in R:
install.packages('MatrixExtra', repos = c('https://fastverse.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Bug tracker:https://github.com/david-cortes/matrixextra/issues

Uses libs:
  • openblas– Optimized BLAS
  • c++– GNU Standard C++ Library v3
  • openmp– GCC OpenMP (GOMP) support library

On CRAN:

csrsparse-matrix

24 exports 19 stars 4.05 score 5 dependencies 23 dependents 3.8k downloads

Last updated 1 months agofrom:40508dbfef

Exports:as.coo.matrixas.csc.matrixas.csr.matrixas.sparse.vectorcbind2check_sparse_matrixdeepcopy_sparse_objectdiagdiag<-emptySparsefilterSparsemapSparsenormprintrbind_csrrbind2remove_sparse_zerosrestore_old_matrix_behaviorset_new_matrix_behaviorshowsort_sparse_indicestt_deept_shallow

Dependencies:floatlatticeMatrixRcppRhpcBLASctl

Introducing MatrixExtra

Rendered fromIntroducing_MatrixExtra.Rmdusingknitr::rmarkdownon Jul 21 2024.

Last update: 2024-01-22
Started: 2021-04-13

Readme and manuals

Help Manual

Help pageTopics
Assignment operator for CSR matricesassignment [<-,ANY,lsparseVector,lsparseVector,ANY-method [<-,ANY,lsparseVector,lsparseVector,replValue-method [<-,ANY,lsparseVector,missing,ANY-method [<-,ANY,lsparseVector,missing,replValue-method [<-,ANY,missing,lsparseVector,ANY-method [<-,ANY,missing,lsparseVector,replValue-method [<-,ANY,missing,nsparseVector,ANY-method [<-,ANY,missing,nsparseVector,replValue-method [<-,ANY,nsparseVector,missing,ANY-method [<-,ANY,nsparseVector,missing,replValue-method [<-,ANY,nsparseVector,nsparseVector,ANY-method [<-,ANY,nsparseVector,nsparseVector,replValue-method [<-,dgRMatrix,index,index,replValue-method [<-,dgRMatrix,index,index,sparseVector-method [<-,dgRMatrix,index,missing,replValue-method [<-,dgRMatrix,index,missing,sparseVector-method [<-,dgRMatrix,missing,index,replValue-method [<-,dgRMatrix,missing,index,sparseVector-method [<-,dgRMatrix,missing,missing,replValue-method [<-,dgRMatrix,missing,missing,sparseVector-method
Concatenate sparse matrices by columnscbind2,CsparseMatrix,sparseVector-method cbind2,integer,RsparseMatrix-method cbind2,logical,RsparseMatrix-method cbind2,numeric,RsparseMatrix-method cbind2,RsparseMatrix,integer-method cbind2,RsparseMatrix,logical-method cbind2,RsparseMatrix,numeric-method cbind2,RsparseMatrix,RsparseMatrix-method cbind2,RsparseMatrix,sparseVector-method cbind2,RsparseMatrix,TsparseMatrix-method cbind2,sparseVector,CsparseMatrix-method cbind2,sparseVector,RsparseMatrix-method cbind2,sparseVector,sparseVector-method cbind2,sparseVector,TsparseMatrix-method cbind2,TsparseMatrix,RsparseMatrix-method cbind2,TsparseMatrix,sparseVector-method cbind2,TsparseMatrix,TsparseMatrix-method cbind2-method
Check if the underlying data behind a sparse matrix constitutes a valid objectcheck_sparse_matrix
Conversions between matrix typesas.coo.matrix as.csc.matrix as.csr.matrix as.sparse.vector conversions
Linear Algebra functions for CSR matricescsr-linalg diag,RsparseMatrix-method diag<-,RsparseMatrix-method norm,RsparseMatrix,character-method norm,RsparseMatrix,missing-method
Deep copy sparse matrices and vectorsdeepcopy_sparse_object
Create Empty Sparse MatrixemptySparse
Filter values of a sparse matrix or vectorfilterSparse
Map values of a sparse matrix/vectormapSparse
Mathematical functions for CSR and COO matricesabs,RsparseMatrix-method abs,TsparseMatrix-method atanh,RsparseMatrix-method atanh,TsparseMatrix-method ceiling,RsparseMatrix-method ceiling,TsparseMatrix-method expm1,RsparseMatrix-method expm1,TsparseMatrix-method floor,RsparseMatrix-method floor,TsparseMatrix-method log1p,RsparseMatrix-method log1p,TsparseMatrix-method mathematical-functions round,RsparseMatrix-method round,TsparseMatrix-method sign,RsparseMatrix-method sign,TsparseMatrix-method signif,RsparseMatrix-method signif,TsparseMatrix-method sin,RsparseMatrix-method sin,TsparseMatrix-method sinh,RsparseMatrix-method sinh,TsparseMatrix-method sqrt,RsparseMatrix-method sqrt,TsparseMatrix-method tan,RsparseMatrix-method tan,TsparseMatrix-method tanh,RsparseMatrix-method tanh,TsparseMatrix-method tanpi,RsparseMatrix-method tanpi,TsparseMatrix-method trunc,RsparseMatrix-method trunc,TsparseMatrix-method
Multithreaded Sparse-Dense Matrix and Vector Multiplications%*%,float32,CsparseMatrix-method %*%,matrix,CsparseMatrix-method %*%,RsparseMatrix,float32-method %*%,RsparseMatrix,integer-method %*%,RsparseMatrix,logical-method %*%,RsparseMatrix,matrix-method %*%,RsparseMatrix,numeric-method %*%,RsparseMatrix,sparseVector-method crossprod,float32,CsparseMatrix-method crossprod,matrix,CsparseMatrix-method matmult tcrossprod,float32,RsparseMatrix-method tcrossprod,matrix,RsparseMatrix-method tcrossprod,RsparseMatrix,float32-method tcrossprod,RsparseMatrix,matrix-method
MatrixExtra packageMatrixExtra-package MatrixExtra
MatrixExtra internal optionsMatrixExtra-options restore_old_matrix_behavior set_new_matrix_behavior
Mathematical operators on sparse matrices and sparse vectors%%,integer,RsparseMatrix-method %%,integer,TsparseMatrix-method %%,logical,RsparseMatrix-method %%,logical,TsparseMatrix-method %%,matrix,RsparseMatrix-method %%,matrix,TsparseMatrix-method %%,numeric,RsparseMatrix-method %%,numeric,TsparseMatrix-method %%,RsparseMatrix,integer-method %%,RsparseMatrix,logical-method %%,RsparseMatrix,matrix-method %%,RsparseMatrix,numeric-method %%,TsparseMatrix,integer-method %%,TsparseMatrix,logical-method %%,TsparseMatrix,matrix-method %%,TsparseMatrix,numeric-method %/%,integer,RsparseMatrix-method %/%,integer,TsparseMatrix-method %/%,logical,RsparseMatrix-method %/%,logical,TsparseMatrix-method %/%,matrix,RsparseMatrix-method %/%,matrix,TsparseMatrix-method %/%,numeric,RsparseMatrix-method %/%,numeric,TsparseMatrix-method %/%,RsparseMatrix,integer-method %/%,RsparseMatrix,logical-method %/%,RsparseMatrix,matrix-method %/%,RsparseMatrix,numeric-method %/%,TsparseMatrix,integer-method %/%,TsparseMatrix,logical-method %/%,TsparseMatrix,matrix-method %/%,TsparseMatrix,numeric-method &,CsparseMatrix,float32-method &,CsparseMatrix,matrix-method &,CsparseMatrix,TsparseMatrix-method &,float32,CsparseMatrix-method &,integer,RsparseMatrix-method &,integer,TsparseMatrix-method &,lgRMatrix,matrix-method &,lgRMatrix,sparseMatrix-method &,lgTMatrix,matrix-method &,logical,RsparseMatrix-method &,logical,TsparseMatrix-method &,matrix,CsparseMatrix-method &,matrix,lgRMatrix-method &,matrix,lgTMatrix-method &,matrix,ngRMatrix-method &,matrix,ngTMatrix-method &,matrix,RsparseMatrix-method &,matrix,TsparseMatrix-method &,ngRMatrix,matrix-method &,ngRMatrix,sparseMatrix-method &,ngTMatrix,matrix-method &,numeric,RsparseMatrix-method &,numeric,TsparseMatrix-method &,RsparseMatrix,integer-method &,RsparseMatrix,logical-method &,RsparseMatrix,matrix-method &,RsparseMatrix,numeric-method &,RsparseMatrix,sparseMatrix-method &,sparseMatrix,lgRMatrix-method &,sparseMatrix,ngRMatrix-method &,sparseMatrix,RsparseMatrix-method &,TsparseMatrix,CsparseMatrix-method &,TsparseMatrix,integer-method &,TsparseMatrix,logical-method &,TsparseMatrix,matrix-method &,TsparseMatrix,numeric-method *,CsparseMatrix,float32-method *,CsparseMatrix,matrix-method *,CsparseMatrix,TsparseMatrix-method *,float32,CsparseMatrix-method *,float32,lgRMatrix-method *,float32,lgTMatrix-method *,float32,ngRMatrix-method *,float32,ngTMatrix-method *,float32,RsparseMatrix-method *,float32,sparseVector-method *,float32,TsparseMatrix-method *,integer,RsparseMatrix-method *,integer,TsparseMatrix-method *,lgRMatrix,float32-method *,lgRMatrix,matrix-method *,lgRMatrix,sparseMatrix-method *,lgTMatrix,float32-method *,lgTMatrix,matrix-method *,logical,RsparseMatrix-method *,logical,TsparseMatrix-method *,matrix,CsparseMatrix-method *,matrix,lgRMatrix-method *,matrix,lgTMatrix-method *,matrix,ngRMatrix-method *,matrix,ngTMatrix-method *,matrix,RsparseMatrix-method *,matrix,sparseVector-method *,matrix,TsparseMatrix-method *,ngRMatrix,float32-method *,ngRMatrix,matrix-method *,ngRMatrix,sparseMatrix-method *,ngTMatrix,float32-method *,ngTMatrix,matrix-method *,numeric,RsparseMatrix-method *,numeric,TsparseMatrix-method *,RsparseMatrix,float32-method *,RsparseMatrix,integer-method *,RsparseMatrix,logical-method *,RsparseMatrix,matrix-method *,RsparseMatrix,numeric-method *,RsparseMatrix,sparseMatrix-method *,RsparseMatrix,sparseVector-method *,sparseMatrix,lgRMatrix-method *,sparseMatrix,ngRMatrix-method *,sparseMatrix,RsparseMatrix-method *,sparseVector,float32-method *,sparseVector,matrix-method *,sparseVector,RsparseMatrix-method *,TsparseMatrix,CsparseMatrix-method *,TsparseMatrix,float32-method *,TsparseMatrix,integer-method *,TsparseMatrix,logical-method *,TsparseMatrix,matrix-method *,TsparseMatrix,numeric-method +,CsparseMatrix,TsparseMatrix-method +,lgRMatrix,sparseMatrix-method +,ngRMatrix,sparseMatrix-method +,RsparseMatrix,sparseMatrix-method +,sparseMatrix,lgRMatrix-method +,sparseMatrix,ngRMatrix-method +,sparseMatrix,RsparseMatrix-method +,TsparseMatrix,CsparseMatrix-method -,CsparseMatrix,TsparseMatrix-method -,lgRMatrix,sparseMatrix-method -,ngRMatrix,sparseMatrix-method -,RsparseMatrix,sparseMatrix-method -,sparseMatrix,lgRMatrix-method -,sparseMatrix,ngRMatrix-method -,sparseMatrix,RsparseMatrix-method -,TsparseMatrix,CsparseMatrix-method /,integer,RsparseMatrix-method /,integer,TsparseMatrix-method /,logical,RsparseMatrix-method /,logical,TsparseMatrix-method /,matrix,RsparseMatrix-method /,matrix,TsparseMatrix-method /,numeric,RsparseMatrix-method /,numeric,TsparseMatrix-method /,RsparseMatrix,integer-method /,RsparseMatrix,logical-method /,RsparseMatrix,matrix-method /,RsparseMatrix,numeric-method /,TsparseMatrix,integer-method /,TsparseMatrix,logical-method /,TsparseMatrix,matrix-method /,TsparseMatrix,numeric-method operators ^,integer,RsparseMatrix-method ^,integer,TsparseMatrix-method ^,logical,RsparseMatrix-method ^,logical,TsparseMatrix-method ^,matrix,RsparseMatrix-method ^,matrix,TsparseMatrix-method ^,numeric,RsparseMatrix-method ^,numeric,TsparseMatrix-method ^,RsparseMatrix,integer-method ^,RsparseMatrix,logical-method ^,RsparseMatrix,matrix-method ^,RsparseMatrix,numeric-method ^,TsparseMatrix,integer-method ^,TsparseMatrix,logical-method ^,TsparseMatrix,matrix-method ^,TsparseMatrix,numeric-method |,CsparseMatrix,TsparseMatrix-method |,lgRMatrix,sparseMatrix-method |,ngRMatrix,sparseMatrix-method |,RsparseMatrix,sparseMatrix-method |,sparseMatrix,lgRMatrix-method |,sparseMatrix,ngRMatrix-method |,sparseMatrix,RsparseMatrix-method |,TsparseMatrix,CsparseMatrix-method
Concatenate inputs by rows into a CSR matrixrbind_csr
Concatenate sparse matrices/vectors by rowsrbind2,CsparseMatrix,CsparseMatrix-method rbind2,CsparseMatrix,RsparseMatrix-method rbind2,CsparseMatrix,sparseVector-method rbind2,CsparseMatrix,TsparseMatrix-method rbind2,integer,RsparseMatrix-method rbind2,logical,RsparseMatrix-method rbind2,numeric,RsparseMatrix-method rbind2,RsparseMatrix,CsparseMatrix-method rbind2,RsparseMatrix,integer-method rbind2,RsparseMatrix,logical-method rbind2,RsparseMatrix,numeric-method rbind2,RsparseMatrix,RsparseMatrix-method rbind2,RsparseMatrix,sparseVector-method rbind2,RsparseMatrix,TsparseMatrix-method rbind2,sparseVector,CsparseMatrix-method rbind2,sparseVector,RsparseMatrix-method rbind2,sparseVector,sparseVector-method rbind2,sparseVector,TsparseMatrix-method rbind2,TsparseMatrix,CsparseMatrix-method rbind2,TsparseMatrix,RsparseMatrix-method rbind2,TsparseMatrix,sparseVector-method rbind2,TsparseMatrix,TsparseMatrix-method rbind2-method
Remove Zeros from a Sparse Matrix or Sparse Vectorremove_sparse_zeros
Quick Glance at Sparse Objectsprint,sparseVector-method show show,sparseMatrix-method show,sparseVector-method
Sparse Matrices Slicingslice [,ANY,index,lsparseVector,logical-method [,ANY,index,lsparseVector,missing-method [,ANY,index,nsparseVector,logical-method [,ANY,index,nsparseVector,missing-method [,ANY,lsparseVector,index,logical-method [,ANY,lsparseVector,index,missing-method [,ANY,lsparseVector,lsparseVector,logical-method [,ANY,lsparseVector,lsparseVector,missing-method [,ANY,lsparseVector,missing,logical-method [,ANY,lsparseVector,missing,missing-method [,ANY,missing,lsparseVector,logical-method [,ANY,missing,lsparseVector,missing-method [,ANY,missing,nsparseVector,logical-method [,ANY,missing,nsparseVector,missing-method [,ANY,nsparseVector,index,logical-method [,ANY,nsparseVector,index,missing-method [,ANY,nsparseVector,missing,logical-method [,ANY,nsparseVector,missing,missing-method [,ANY,nsparseVector,nsparseVector,logical-method [,ANY,nsparseVector,nsparseVector,missing-method [,CsparseMatrix,index,index,logical-method [,CsparseMatrix,index,index,missing-method [,CsparseMatrix,index,missing,logical-method [,CsparseMatrix,index,missing,missing-method [,CsparseMatrix,missing,index,logical-method [,CsparseMatrix,missing,index,missing-method [,CsparseMatrix,missing,missing,logical-method [,CsparseMatrix,missing,missing,missing-method [,RsparseMatrix,index,index,logical-method [,RsparseMatrix,index,index,missing-method [,RsparseMatrix,index,missing,logical-method [,RsparseMatrix,index,missing,missing-method [,RsparseMatrix,missing,index,logical-method [,RsparseMatrix,missing,index,missing-method [,RsparseMatrix,missing,missing,logical-method [,RsparseMatrix,missing,missing,missing-method [,TsparseMatrix,index,index,logical-method [,TsparseMatrix,index,index,missing-method [,TsparseMatrix,index,missing,logical-method [,TsparseMatrix,index,missing,missing-method [,TsparseMatrix,missing,index,logical-method [,TsparseMatrix,missing,index,missing-method [,TsparseMatrix,missing,missing,logical-method [,TsparseMatrix,missing,missing,missing-method
Sort the indices of a sparse matrix or sparse vectorsort_sparse_indices
Transpose a sparse matrix by changing its formatt,CsparseMatrix-method t,dgCMatrix-method t,dsCMatrix-method t,dtCMatrix-method t,lgCMatrix-method t,lsCMatrix-method t,ltCMatrix-method t,ngCMatrix-method t,nsCMatrix-method t,ntCMatrix-method t,RsparseMatrix-method t,sparseVector-method t,TsparseMatrix-method t_deep t_shallow