NEWS | R Documentation |
quite a collection of new PROTECT(.)
's thanks to
Tomas Kalibera's ‘rprotect’ analysis.
"Ops"
between "table", "xtabs", and our matrices now work.
as(matrix(diag(3), 3, dimnames=rep(list(c("A","b","c")),2)),
"diagonalMatrix")@x
is no longer named.
norm(x, "2")
now works as well (and equivalently to base::norm
).
sparseVector()
now also works without x
argument.
c.sparseVector()
method for c()
of
sparseVectors (and available as regular function on purpose).
as(Diagonal(3), "denseMatrix")
no longer returns a
non-dense "ddiMatrix"
.
S[sel,] <- value
and similar no longer segfault, but
give a "not (yet?) supported"
error
for sparse matrices S
and logical sel
when
sel
contains NA
s.
The same error (instead of a low-level one) is signalled for
indexing (with NA-containing logical sel
), i.e.,
S[sel,]
.
which(x, arr.ind=TRUE, *)
(when x
is a
"lMatrix"
or "nMatrix"
) now works the same as
base::which
, obeying an optional useNames
argument
which defaults to TRUE
. Previously, the resulting
two-column matrix typically had empty dimnames
.
0-length matrix "Ops"
(binary operations) are now
compatible to R-devel (to be R 3.4.0).
C-API: SuiteSparse_long
is now defined as
int64_t
on all platforms, and we now include (C99) ‘inttypes.h’
x[.] <- value
now also works for
"sparseVector"
's, both as x
and as value
.
x[FALSE] <- value
now also works for "sparseVector"
's.
rep(x, *)
now works for "sparseVector"
s and
sparse and dense "Matrix"
-classed matrices x
.
solve(<sparse_LU>)
no gives an error in some cases of
singular matrices, where before the C code accessed illegal memory locations.
in C code, protect _POSIX_C_SOURCE by #ifdef __GLIBC__
cBind()
and rBind()
have been almost silently
deprecated in R >= 3.2.0
and now give a warning,
“once per session” only.
bandSparse(*, k=k, *)
now returns matrices inheriting from
"triangularMatrix"
when obvious from the diagonal indices k
.
KhatriRao(X,Y)
now also works when X
or
Y
is completely zero.
The 0-dim. Matrix multiplication fix in 1.2-5 did trigger wrong warnings in other diagonal matrix multiplications.
isSymmetric(m)
now also works for "indMatrix"
m
.
isSymmetric(m)
is faster for large dense asymmetric matrices.
Matrix multiplications (A %*% B
) now work correctly
when one of the matrices is diagonal and the other has a zero dimension.
sparseMatrix()
gets new argument triangular
and a smarter default for dims
when symmetric
or
triangular
is true.
as(<sparse>, "denseMatrix")
now works in more cases
when prod(dim(.))
is larger than 2^{31} - 1.
Hence, e.g., !S
now works for much larger sparse matrices
S
.
creating very large dense matrices, e.g., by
as(<sparseM.>, "matrix")
would segfault (in case it could
allocate enough storage).
MatrixClass()
is exported now.
More exports of semi-internal functions (for speed, named
".<foo>"
, i.e., inofficial API), such as .solve.dgC.lu()
.
more Korean translations
Packages linking to Matrix (LinkingTo:
in ‘DESCRIPTION’) now find
alloca properly defined in ‘Matrix.h’ even for non-GNU
compilation environments such as on Solaris or AIX.
extended "n?CMatrix" classes (e.g., from setClass(.,
contains="ngCMatrix")
) now can be coerced via as(.)
to
"d.CMatrix"
.
The printing of largish sparse matrices is improved, notably
in the case where columns are suppressed, via new fitWidth =
TRUE
option in printSpMatrix2()
.
cbind2()
and rbind2()
no longer fail to
determine sparse
when it is unspecified and hence
NA
, fixing R-forge bug #6259.
Explicitly import from “base” packages such as "stats"
.
Our colSums(x)
, rowMeans(y)
, ..., methods
now “keep names”, i.e., if the result is a numeric vector,
and the matrix x
has column or row names, these become the
names(.)
of the result, fixing R-forge bug #6018.
"Matrix"
now has an initialization()
method
coercing 0-length dimnames components to NULL
and other
non-NULL
dimnames to character
. Before, e.g.,
numeric dimnames components partially worked, even though it has
always been documented that non-NULL
dimnames should be
character
.
For symmetricMatrix
objects which have symmetrical
dimnames by definition, it is allowed to only set one half of the
dimnames
to save storage, e.g., list(NULL, nms)
is
semantically equivalent to list(nms, nms)
.
as.vector(<sparseVector>)
etc, now work, too.
lu(<sparseMatrix>)
now keeps dimnames
.
better ‘NEWS.Rd’ (which pleases Kurt and tidy
;-)
S[] <- T
and S[] <- spV
now work (in more cases)
for sparse matrices S, T and sparseVector spV
.
Huge dense matrix multiplication did lead to segfaults, see R-help, “does segfault mean (always) a bug?”, May 5, 2015. Fixed by using C's Alloca() only in smallish cases.
Optional arguments in image()
, e.g., main=
<..>)
now also work for lgCMatrix
, nMatrix
etc;
thanks to a 4.5 years old report by Mstislav Elagin.
dimnames(A) <- val
now resets the factors
slot
to empty, as the factorizations now keep dimnames more often.
crossprod(<matrix>, Diagonal(<n>))
works again (and
these are tested more systematically).
Matrix products (%*%
, crossprod
, and
tcrossprod
) for "dtrMatrix"
are correct in all
cases, including keeping dimnames.
Matrix(d)
(and other coercions to "Matrix"
)
now correctly keeps dimnames
also when d
is a
traditional diagonal "matrix"
.
New %&%
for “boolean arithmetic” matrix product.
New argument boolArith = NA
in crossprod()
and
tcrossprod()
. boolArith = TRUE
now forces boolean
arithmetic, where boolArith = FALSE
forces numeric one.
Several of these products are more efficient thanks to new C
functionality based on our new chm_transpose_dense()
, and
others based on geMatrix_crossprod
,
geMatrix_matrix_mm
, etc.
Most dense matrix products, also for non-dgeMatrix
,
including "l..Matrix"
and "n..Matrix"
ones are now
directly handled by new .Call()
s.
"dMatrix"
(numeric) and "lMatrix"
(logical)
matrices can now be coerced to "nMatrix"
(non-zero pattern
or “boolean”) even when they contain NA
s, which then
become TRUE
s.
More thorough checking of cbind2()
and
rbind2()
methods, notably as they are called from cbind()
and rbind()
from R version 3.2.0 on.
rbind2(<dense>, <dense>)
is faster, being based on new C code.
symmetric Matrices (i.e., inheriting from
"symmetricMatrix"
) are allowed to have dimnames
of
the form list(NULL, <names>)
and now print correctly
and get correctly coerced to general matrices.
indMatrix
object (“index matrices”) no longer
need to be “skinny”.
rsparseMatrix()
now accepts rand.x = NULL
and
then creates a random pattern matrix
("nsparseMatrix"
).
anyDuplicatedT()
and uniqTsparse()
low level
utilities are exported now.
Partial Korean translations of messages.
For R ≥ 3.2.0, cBind()
and rBind()
are deprecated, as they are no longer needed since cbind()
and rbind()
do work automatically.
Fix some rbind2()
methods.
t()
now transposes the dimnames even for symmetric
matrices.
diag(M) <- val
did not always recycle val
to
full length, e.g., when M
was a "dtrMatrix"
.
crossprod(<indMatrix>)
was wrong in cases where the
matrix had all-zero columns.
Matrix products (%*%
, crossprod
, and
tcrossprod
) with one sparse and one dense argument now
return numeric (a "dMatrix"
) when they should, i.e.,
unless the new setting boolArith = TRUE
is applied.
More use of anyNA()
(for speedup).
Matrix products (%*%
, crossprod
,
tcrossprod
) now behave compatibly to R 3.2.0, i.e., more
lenient in matching dimensions for matrix - vector products.
isTriangular()
gets new optional argument upper = NA
.
crossprod()
and tcrossprod()
fixes for
several <diagonal> o <sparse> combinations.
rowMeans(<dgeMatrix>, na.rm=TRUE)
was wrong sometimes.
fix and speedup of coercions (as(., .)
) from and to
symmetric or triangular matrices.
invPerm()
coercion to integer
dimnames( solve(.,.) )
fix [r3036]
tril()
and triu()
now return correct uplo
.
names(dimnames(.))
now preserved, e.g. in
symmpart()
or subsetting (A[i,j]
).
new rsparsematrix()
for random sparse Matrices.
improved warnings, notably for unused arguments previously
swallowed into ...
.
crossprod(<vec>, <dsyMatrix>)
fixed.
crossprod()
and kronecker()
fixes for some
<indMatrix> cases.
%*%
and crossprod()
now also work with
sparseVector
s.
speedup of crossprod(v, <sparseM>)
, thanks to nudge
by Niels Richard Hansen.
new help page for all such matrix products (‘../man/matrix-products.Rd’).
image()
now gets correct ylim
again.
More consistent matrix products.
correct adaption to R 3.1.0
using tolerance
(and not ‘tol’) in all.equal()
export fast power-user coercion utilities
.dsy2mat()
, .dxC2mat()
, .T2Cmat()
, ..2dge()
.
matrix products now (mostly) work with sparseVector
s;
and correctly in some more cases.
Testing code's assertWarning()
adapted for R ≤ 3.0.1.
Depends: R >= 2.15.2
eases checking.
image(.., xlim, ylim)
: nicer defaults
for the axis limits, and ylim
is sorted decreasingly; not
strictly back-compatible but should never harm.
rankMatrix(*, method="qr")
now using tol
T2graph()
and graph2T()
export old functionality explicitly.
Tweaks in conversions between "graph"
and
"sparseMatrix"
objects. Notably, as(<graph>,
<Matrix>)
now more often returns a (0/1 pattern) "n..Matrix".
sparseMatrix()
: new use.last.ij
argument.
KhatriRao()
: fix rownames (X <-> Y)
qr.coef()
, qr.fitted
, and qr.resid
now
also work with sparse RHS y
.
sparse matrix “sub assignments”, e.g., M[ii] <- v
,
speedup and fixes.
bug fixes also in M[negative indices] <- value
and
<sparseMatrix>[cbind(i,j)]
.
fac2sparse
and fac2Sparse
now exported, with a
new giveCsparse
option.
Update to latest SuiteSparse
C library by Tim Davis,
U. Florida.
ensuing “C API changes”
new .SuiteSparse_version()
function
Many ‘Imports:’ instead of ‘Depends:’.
fixed long lasting undetected solve(<dsCMatrix>, *)
bug.
Our all.equal()
methods no longer sometimes return
c("TRUE", "....difference..")
.
rankMatrix(<matrix>)
: fix the internal x.dense
definition.
Revert some wrong changes to solve(<sparse>, *)
from
1.0-13 (“stop gap fix” for R 3.0.2).
New (efficient) KhatriRao()
function by Michael Cysouw
New "indMatrix"
class of “index matrices”, a
generalization of "pMatrix"
, the permutation matrices, many
methods generalized from pMatrix to indMatrix. All (initial)
functionality contributed by Fabian Scheibl, Univ. Munich.
Export and document isDiagonal()
and
isTriangular()
as they are useful outside of Matrix.
rankMatrix(M, method="qr")
no longer needs
sval
which makes it considerably more useful for large
sparse M
.
Start providing anyNA
methods for R >= 3.1.0.
solve(<sparse> a, <sparse> b)
: if a
is
symmetric, now compute sparse result.
nearPD()
gets new option conv.norm.type = "I"
.
determinant(<dpoMatrix>)
now uses chol()
, and
hence also an existing (‘cached’) Cholesky factor.
3 new C -> R
utilities (including hidden R function
.set.factors()
for caching also from R, not just in C).
M[] <- v
for unitriangular M
now correct.
lu(.)
no longer sometimes returns unsorted columns.
.
.
.
as(<csr>, "dgCMatrix")
(from package SparseM)
now works again.
.
.sparseDiagonal()
: new unitri
argument, and
more flexibility;
new solve(<dsCMatrix>, <missing>)
via efficient C code.
.
new sparseVector()
constructor function.
is.finite()
is.infinite()
now work for our
matrices and "*sparseVector" objects.
diag(.) <- V
now preserves symmetricity,
triangularity and even uni-triangularity sometimes.
Quite a few fixes for Ops
(arithmetic, logic, etc)
group methods.
Ditto for diagonalMatrix
methods.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
During Doug Bates' sabbatical in Zurich, Martin Maechler becomes co-author of the Matrix package.
Beginning of class reorganization with a more systematic naming scheme.
More (correct) coercions as(<from>, <to>)
.
lme4 / lmer specific R code moved out to lme4 package.
.
Doug Bates (only)
Sparse matrices, classes and methods, partly via
Interface to LDL, TAUCS, Metis and UMFPACK C libraries
.............................................
The first CRAN release of the Matrix package, titled “A Matrix library for R” authored by Douglas Bates (maintainer, principal author) and Saikat DebRoy.
Matrix()
constructor for R objects of class Matrix
.
Matrix.class()
returning informal subclasses such as
"Hermitian"
, "LowerTriangular"
is.Orthonormal()
, is.Hermitian()
,
is.UpperTriangular()
functions.
SVD()
, lu()
, and schur()
decomposition
generics with "Matrix"
methods.
rcond()
, norm()
, det()
;
expand()
and facmul()
.
C++ interface to LAPACK