Skip to content

Commit

Permalink
version 0.6-0
Browse files Browse the repository at this point in the history
  • Loading branch information
wrathematics authored and cran-robot committed Dec 13, 2016
1 parent 897269d commit 185df25
Show file tree
Hide file tree
Showing 91 changed files with 7,965 additions and 2,883 deletions.
51 changes: 36 additions & 15 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,35 +1,56 @@
Release 0.6-0 (12/12/2016):
* Added inverse method.
* Added C99 configure test.
* Added internal C lib tests and benchmarks.
* Minor C lib refactoring.
* Fixed a few memory errors.
* Switch to LaTeX vignettes.

Release 0.5-1 (7/7/2016):
* Added scaler() to center and/or scale efficiently.
* Better safety in internal OpenMP statements (default(none)).
* Added tcosine(), tpcor(), tcovar().
* Added blocked xpose and symmetrize.

Release 0.5-0 (4/24/2016):
* Implemented inplace methods for correlation and covariance (correlation is
always doneinplance)
* Added 'inplace' argument.
* Implemented use='pairwise.complete.obs' methods.
* Several small performance improvements.

Release 0.4-0 (4/4/2016):
* Implement a fast naomit for dense internals.
* Add 'use' argument.
* Implement use with "everything", "all.obs", and "complete.obs".
* Add fix to coop_covar_vecvec for older compilers.
* Implemented a fast naomit for dense internals.
* Added 'use' argument.
* Implemented 'use' with "everything", "all.obs", and "complete.obs".
* Added fix to coop_covar_vecvec for older compilers.

Release 0.3-1 (3/22/2016):
* Add support for dgCMatrix from Matrix.
* Lower cost (time/mem) to rebuild the vignette.
* Retain column names as row/col names in all co-operations.
* Added support for dgCMatrix from Matrix.
* Lowered cost (time/mem) to rebuild the vignette.
* Retained column names as row/col names in all co-operations.

Release 0.3-0 (3/17/2016):
* Rename package to 'coop'.
* Renamed package to 'coop'.
* 'Namespaced' the internal lib.
* Improved vignettes, package description.
* Use https in inst/CITATION.
* Release to CRAN.
* Released to CRAN.

Release 0.2-2 (3/11/2016);
* Split vignette into 2.
* Improve R help.
* Improved R help.

Release 0.2-1 (3/9/2016):
* Better memory allocation checking.
* Move sparsity functions from wrappers.c to sparse_utils.c.
* Moved sparsity functions from wrappers.c to sparse_utils.c.

Release 0.2-0 (3/6/2016):
* Add covariance and pearson correlation.
* Rename package from fastcosim to fastco.
* Added covariance and pearson correlation.
* Renamed package from fastcosim to fastco.
* Major re-organization of internals.
* Better tests.

Release 0.1-0 (12/9/2016):
* Add cosine() function.
* Add dense matrix, dense vector-vector, and sparse matrix methods.
* Added cosine() function.
* Added dense matrix, dense vector-vector, and sparse matrix methods.
9 changes: 4 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Package: coop
Type: Package
Title: Co-Operation: Fast Covariance, Correlation, and Cosine
Similarity Operations
Version: 0.4-0
Version: 0.6-0
Description: Fast implementations of the co-operations: covariance,
correlation, and cosine similarity. The implementations are
fast and memory-efficient and their use is resolved
Expand All @@ -12,8 +12,7 @@ Description: Fast implementations of the co-operations: covariance,
License: BSD 2-clause License + file LICENSE
Depends: R (>= 3.1.0)
Enhances: slam (>= 0.1.32), Matrix
Suggests: memuse, knitr, rmarkdown
VignetteBuilder: knitr
Suggests: memuse
NeedsCompilation: yes
ByteCompile: yes
URL: https://github.com/wrathematics/coop
Expand All @@ -24,8 +23,8 @@ Authors@R: c(person("Drew", "Schmidt", role=c("aut", "cre"),
memory errors."))
Maintainer: Drew Schmidt <wrathematics@gmail.com>
RoxygenNote: 5.0.1
Packaged: 2016-04-04 23:40:03 UTC; mschmid3
Packaged: 2016-12-12 17:11:05 UTC; iao
Author: Drew Schmidt [aut, cre],
Christian Heckendorf [ctb] (Caught some memory errors.)
Repository: CRAN
Date/Publication: 2016-04-05 08:14:28
Date/Publication: 2016-12-13 01:21:11
117 changes: 75 additions & 42 deletions MD5
Original file line number Diff line number Diff line change
@@ -1,57 +1,90 @@
095032e7e8b6e028ceb235804db8f47c *ChangeLog
64e29a492519eeb42ddb242699514120 *DESCRIPTION
d6e21b8f581264b7b65260a0b040057d *ChangeLog
6dcceb2b3fe86a22663fe7636b34ce18 *DESCRIPTION
32151991ac40f1c2a881a4fde17f3991 *LICENSE
0545a83d05d544200671f4bad25c7425 *NAMESPACE
780f4778973ddedce8fe710e5103fefb *NAMESPACE
94a06c3901cce73726005c8e21c472e1 *R/00_global.r
41b1c23f975c0e9242aebfeae99c1752 *R/coop-package.r
2f5b770cbdfce75f46b31a02d1696e67 *R/cosine.r
36b3f7c8aa5fbbf8c08a8fb999598cc7 *R/covar.r
a4d161d59c68c8530158c9088e74c3e6 *R/coop-package.r
b8fb90f62ebebe09c1cd6e11c0cae914 *R/cosine.r
0d458777e8b206bd0ea9a843a0a45c75 *R/covar.r
3f4ba4111bcb5d251f8fa9e56fc82eef *R/maxco.r
208d30a6ea68b44106fce0300b0648a4 *R/naomit.r
79fef2306f55f82c54cdbbf34be7ee6e *R/pcor.r
54bdc451886276146d8408807578196f *R/pcor.r
9de718aac140bceb36138ee3b8bd264b *R/scaler.r
c4bca881ce1b7667433e2df8599ca50e *R/sparse_utils.r
9e541f63924ccf6dde872ec8990d0467 *R/utils.r
bcf094afaa7f20326923c37455914a49 *R/wrappers_dense.r
09bc102c6dcc3c0fa0851126dcd24834 *R/wrappers_sparse.r
a6bd7cfb56a1b41bf854ad6fa9e1992c *README.md
4d10f08e09ff8bc512a64fd178968bdb *build/vignette.rds
166871e57ef5ed7c9461ec7827b88f14 *cleanup
a51da2a78ef6b009800a7b156f8dbb5f *R/utils.r
c38b0b37d63c90780173e029d4a63f78 *R/weighted.r
f892819b1297ee39728d5c37887d69dc *R/wrappers_dense.r
36327f12f0204abe5abfb429d3ec0217 *R/wrappers_sparse.r
40bdb72f2309cd16ea12187abf743d39 *README.md
cea65614abad0d8dcc74fe1636ab2a39 *cleanup
b5530b8555dc17eeb91776d98f5a0798 *configure
c6dd3e936cff072a8b121aee6f53477d *configure.ac
d41d8cd98f00b204e9800998ecf8427e *configure.win
0ac65c575d2680a5df6a96c3c10b8dda *inst/CITATION
8f9bfc2f5d48b4f31ab3bdb3f0b6bf45 *inst/benchmarks/cosine_dense.r
fcadfd066a6719865305f9e9aedd86ab *inst/benchmarks/cosine_lsa.r
f85f416e87de8c38e2808fc8b940df01 *inst/benchmarks/cosine_sparse.r
d034a24811e8b0f1ce330b9c7887007e *inst/benchmarks/covar_dense.r
bc34ef6d7e008b47c3e817392edf9e96 *inst/benchmarks/covar_dense.r
e280faf5ccb89b4003e58121ad59e771 *inst/benchmarks/pairwise.r
888bf1c07127c388735c255052205e21 *inst/benchmarks/pcor_dense.r
1b069a3d12f52d7e28aa56cb51603b6f *inst/doc/algos.R
d699fe7dd9dddf1482de5c1a3e08a602 *inst/doc/algos.Rmd
3ef52be496204a10d279a95a3fb7e230 *inst/doc/algos.html
52fdd1ed200bbf9d54cc0373ea279ac3 *inst/doc/coop.R
47491bd1b826f48ea78d9952af06da97 *inst/doc/coop.Rmd
4a855cc099b038de958dc7e2aa8a0ac7 *inst/doc/coop.html
94ed171866df7a7c74b9f41d4c21cb39 *man/coop-package.Rd
bcfef184856a002da12f7a6d91a8cd13 *man/cosine.Rd
095cd7f0cd2f1033ae7f38ab9d7b9515 *man/covar.Rd
9b1de26d23f62e1fe9b02fa94c1193d3 *man/pcor.Rd
7825bc7cfe3d4789cef0012624b96f57 *inst/benchmarks/scale.r
9d7abae18251ba5894ae133050e9126a *inst/doc/algos.Rnw
36bbc565ddf309f3c8911a663333e629 *inst/doc/algos.pdf
9efd979cc64c48cb90e28a48282aeab6 *inst/doc/coop.Rnw
1ea4771529586a7bd9c88f0786b6938e *inst/doc/coop.pdf
76c872383c2b5e7e4fb63bbacd75da35 *man/coop-package.Rd
0ceb6ce4d87ad098f28ad385f9938317 *man/cosine.Rd
110b522a5bc973ee60ff9c475a7235e9 *man/covar.Rd
6b355c75bdec6e6e478b31be3676959d *man/pcor.Rd
b31dd318a55fbb3f1eac735a6ec3b0ec *man/scaler.Rd
4af2b676cdaf23b229abc9009feab152 *man/sparsity.Rd
8582a329b5a3b3cad8a219e6ec86e58a *man/weighted.Rd
189087126049e969612cebc6f8a59615 *src/Makevars
801a9d0992b02697cea7c4c0ca0b4013 *src/coop.h
4b9bdc99fbf282e7acb01bc5cf9b13b3 *src/dense.c
de1b9b18887c73f46064a1e9db8eaccd *src/naomit.c
11057898bd19e220e1456eee61841a30 *src/omp.h
25c24be622d6760c37b155fc1d4f9cf2 *src/sparse.c
80a7aedd0ca413f82275d18de922f60d *src/utils.c
336ff2406e215849fc8599b143289d95 *src/wrapper.c
599dcc943dfd49be96594a42afb182ec *tests/dense_matrix.R
4f215a0274261b678d47b1d644e8414f *src/R_checks.c
9bee5d616891765df180d141f33d8f47 *src/R_naomit.c
681b9e1c50d041d9c5f3850da2aed7d3 *src/R_wrapper.c
f4e21198cd9c5ae8a99a9bbd200f9c7b *src/coop.h
80658d9b26f3f58959a57282ebdc39b1 *src/dense.c
7033f694bcbac05f0e06a7bd5cf12988 *src/dense_inplace.c
b8d24fdcb6f48bd7ae58c433ed5b8b46 *src/dense_pairwise.c
840637f5a2c2b6c6463973cc9d754243 *src/experimental/dense_minmax.c
52418b13ebd46ccfdd6cb19b1e5692b6 *src/experimental/dense_wt.c
5de142fc94d4918aca5d498adf8bba3d *src/experimental/inv.c
f84f574109f98efb7b9fd2d97ada00c0 *src/scale.c
29688c18026f970724631ecced8bc7dc *src/sparse.c
015cb54f5813da3894c26f1a718d0dc1 *src/utils/cdefs.h
2da932fd1c6d77f97dfb454cea568214 *src/utils/copy.h
e3f30615048b9a276293c76e126288fa *src/utils/fill.h
66760a063b310236e234d5626a72a716 *src/utils/internal/all_equal.h
ef457916daf1d742cdc3370d2ecb821c *src/utils/internal/gen.h
921969898bdde69fd08e1fd2f8e7fdcf *src/utils/internal/printer.h
8d9f3f5ab537f869745bdcf298774e6c *src/utils/internal/timer.h
ee69c8f9e63ebb354e4d53d2d9952547 *src/utils/inverse.h
ae25d2e710f74e934f6b159452946a2b *src/utils/lapack.h
cb61e545e9373dbf80ce4c48ea923305 *src/utils/mmult.h
595ee45b6bc661ba6e953bad25fda856 *src/utils/naive/symmetrize.h
0c45f260b608b08926b80341d73d5533 *src/utils/naive/xpose.h
216b5b1f0a6d8c7b0515ba396ad5090d *src/utils/safeomp.h
216beb3176623b967751f7d788b95153 *src/utils/scale.h
2fb6bc06df7d851eddfb8cb7871f2d57 *src/utils/sparsity.h
d65479d2f8838776727278ae22e01023 *src/utils/special_vals.h
878360907fde3511241ef17d11ae3944 *src/utils/sumstats.h
c2c91a30df022143b467c6b125673b68 *src/utils/xpose.h
8f266963acf0b1df0a9846ad930871b1 *tests/dense_matrix.R
19c3610270e4fa5a370773ddf164094c *tests/dense_matrix_inplace.R
7cfb2bc3227633874c8e604109cecfb8 *tests/dense_matrix_pairwise.R
1e3e7830c1338674932cfdf828925218 *tests/dense_vecvec.R
6a46eeaeae008bc5f17686692038fd71 *tests/naomit.r
4c1d061ef8ee973e9be9820f353631f7 *tests/sparse_matrix.R
e05204bebb84ca65fc52a9bf50417367 *tests/naomit.R
f8abc7e254dca27354eb6d631aa40950 *tests/run
12a6f577465682702d315f9e879499dd *tests/scale.R
943664fb36d0c4e46916e7bb61ca78b0 *tests/sparse_matrix.R
e8d9e924fc96fac47bf482bac1384aa3 *tests/sparse_utils.R
b4541bf5bde1f8de7214e13f2bad9ea2 *tests/use_method.R
d699fe7dd9dddf1482de5c1a3e08a602 *vignettes/algos.Rmd
b97853e4703084704becbe7cc76685f5 *vignettes/cleanup
47491bd1b826f48ea78d9952af06da97 *vignettes/coop.Rmd
9d7abae18251ba5894ae133050e9126a *vignettes/algos.Rnw
6fdbe0bfece0e5500fe8688d0b3d6125 *vignettes/build_pdf.sh
9efd979cc64c48cb90e28a48282aeab6 *vignettes/coop.Rnw
1f1790fff9ca358690e809d36eceaec7 *vignettes/include/00-acknowledgement.tex
618c6b3a2cf2cce15c91434ed0d943b5 *vignettes/include/bench.png
4e4aec951fee7e6a9c8deabf2adf0e32 *vignettes/include/coop.bib
b9fe5ab2a2112614ca78779b7d10eafc *vignettes/include/custom.css
42b936088db6e1da3b0e0d5f3699e901 *vignettes/include/headers.js
415ce49f0c2624b998fb21c46d1c3557 *vignettes/include/ieee.csl
578b1eda5f3370f0580d2d2ff7889db9 *vignettes/rebuild
e1330e87376f9670b558a083d20b9a54 *vignettes/include/coop.bib
95b6a826d34db7aba7847917bf3cf948 *vignettes/include/settings.tex
c361b262c34785162574e5dcd1fc559b *vignettes/include/uch_small.png
9 changes: 8 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,15 @@ S3method(pcor,default)
S3method(pcor,matrix)
S3method(sparsity,matrix)
S3method(sparsity,simple_triplet_matrix)
S3method(tcosine,matrix)
S3method(tcovar,matrix)
S3method(tpcor,matrix)
export(cosine)
export(covar)
export(pcor)
export(scaler)
export(sparsity)
useDynLib(coop, R_co_mat, R_co_vecvec, R_co_sparse, R_sparsity_int, R_sparsity_dbl, R_csc_to_coo, R_fast_naomit, R_naomit_vecvec)
export(tcosine)
export(tcovar)
export(tpcor)
useDynLib(coop, R_co_mat, R_co_mat_pairwise, R_co_vecvec, R_co_sparse, R_sparsity_int, R_sparsity_dbl, R_csc_to_coo, R_fast_naomit, R_naomit_vecvec, R_scaler, R_check_badvals)
27 changes: 25 additions & 2 deletions R/coop-package.r
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,28 @@
#' of all columns of a term-document or document-term matrix is
#' needed.
#'
#' @section The \code{inplace} argument:
#' When computing covariance and correlation with dense matrices,
#' we must operate on the centered and/or scaled input data. When
#' \code{inplace=FALSE}, a copy of the matrix is made. This
#' allows for very wall-clock efficient processing at the cost of
#' m*n additional double precision numbers allocated. On the
#' other hand, if \code{inplace=TRUE}, then the wall-clock
#' performance will drop considerably, but at the memory expense
#' of only m+n additional doubles. For perspective, given a
#' 30,000x30,000 matrix, a copy of the data requires an
#' additional 6.7 GiB of data, while the inplace method requires
#' only 469 KiB, a 15,000-fold difference.
#'
#' Note that cosine is always computed in place.
#'
#' @section The \code{t} functions:
#' The package also includes "t" functions, like \code{tcosine()}. These
#' behave analogously to \code{tcrossprod()} as \code{crossprod()} in base R.
#' So of \code{cosine()} operates on the columns of the input matrix, then
#' \code{tcosine()} operates on the rows. Another way to think of it is,
#' \code{tcosine(x) = cosine(t(x))}.
#'
#' @section Implementation Details:
#' Multiple storage schemes for the input data are accepted.
#' For dense matrices, an ordinary R matrix input is accepted.
Expand All @@ -30,9 +52,10 @@
#' \code{dgemm} and the normalizing products \code{t(y) \%*\% y},
#' each computed via the BLAS function \code{dsyrk}.
#'
#' @useDynLib coop, R_co_mat, R_co_vecvec,
#' @useDynLib coop, R_co_mat, R_co_mat_pairwise, R_co_vecvec,
#' R_co_sparse, R_sparsity_int, R_sparsity_dbl,
#' R_csc_to_coo, R_fast_naomit, R_naomit_vecvec
#' R_csc_to_coo, R_fast_naomit, R_naomit_vecvec,
#' R_scaler, R_check_badvals
#'
#' @docType package
#' @name coop-package
Expand Down
39 changes: 31 additions & 8 deletions R/cosine.r
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#' The NA handler, as in R's \code{cov()} and \code{cor()}
#' functions. Options are "everything", "all.obs", and
#' "complete.obs".
#' @param inverse
#' Logical; should the inverse covariance matrix be returned?
#'
#' @return
#' The \eqn{n\times n} matrix of all pair-wise vector cosine
Expand All @@ -30,29 +32,34 @@
#'
#' @author Drew Schmidt
#' @seealso \code{\link{sparsity}}
#' @name cosine
#' @rdname cosine
NULL

#' @rdname cosine
#' @export
cosine <- function(x, y, use="everything") UseMethod("cosine")
cosine <- function(x, y, use="everything", inverse=FALSE) UseMethod("cosine")



#' @export
cosine.matrix <- function(x, y, use="everything")
cosine.matrix <- function(x, y, use="everything", inverse=FALSE)
{
co_matrix(x, y, CO_SIM, use)
co_matrix(x, y, CO_SIM, use, inplace=FALSE, inverse=inverse)
}



#' @export
cosine.default <- function(x, y, use="everything")
cosine.default <- function(x, y, use="everything", inverse=FALSE)
{
co_vecvec(x, y, CO_SIM, use)
}



#' @export
cosine.simple_triplet_matrix <- function(x, y, use="everything")
cosine.simple_triplet_matrix <- function(x, y, use="everything", inverse=FALSE)
{
if (!missing(y))
stop("argument 'y' can not be used with a matrix 'x'")
Expand All @@ -67,7 +74,7 @@ cosine.simple_triplet_matrix <- function(x, y, use="everything")
if (length(a) != length(i) || length(i) != length(j))
stop("Malformed simple_triplet_matrix: lengths of 'v', 'i', and 'j' do not agree")

ret <- co_sparse(n, a, i, j, index, type, use)
ret <- co_sparse(n, a, i, j, index, type, use, inverse)
if (!is.null(colnames(x)))
{
rownames(ret) <- colnames(x)
Expand All @@ -80,7 +87,7 @@ cosine.simple_triplet_matrix <- function(x, y, use="everything")


#' @export
cosine.dgCMatrix <- function(x, y, use="everything")
cosine.dgCMatrix <- function(x, y, use="everything", inverse=FALSE)
{
if (!missing(y))
stop("argument 'y' can not be used with a matrix 'x'")
Expand All @@ -95,7 +102,7 @@ cosine.dgCMatrix <- function(x, y, use="everything")
if (length(a) != length(i) || length(i) != length(j))
stop("Malformed dgCMatrix: lengths of 'x', 'i', and 'p' do not agree")

ret <- co_sparse(n, a, i, j, index, type, use)
ret <- co_sparse(n, a, i, j, index, type, use, inverse)
if (!is.null(colnames(x)))
{
rownames(ret) <- colnames(x)
Expand All @@ -104,3 +111,19 @@ cosine.dgCMatrix <- function(x, y, use="everything")

ret
}



# tcosine

#' @rdname cosine
#' @export
tcosine <- function(x, y, use="everything", inverse=FALSE) UseMethod("tcosine")



#' @export
tcosine.matrix <- function(x, y, use="everything", inverse=FALSE)
{
co_matrix(x, y, CO_SIM, use, inplace=FALSE, trans=TRUE, inverse=inverse)
}

0 comments on commit 185df25

Please sign in to comment.