diff --git a/CHANGELOG.md b/CHANGELOG.md index bdb47ece..7835597a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ ## Version 5.6.0 * Update Makevars for ARM version of Windows. * Sanitize internal usage of `do.call` to avoid huge backtraces. -* Support lower triangular `distmat` objects for symmetric distances. +* Support lower triangular `distmat` objects for symmetric distances (#77). ## Version 5.5.12 * Remove explicit C++ requirements. diff --git a/DESCRIPTION b/DESCRIPTION index a7f58d5d..7343785e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -12,7 +12,7 @@ Description: Time series clustering along with optimized techniques related All included distance functions have custom loops optimized for the calculation of cross-distance matrices, including parallelization support. Several cluster validity indices are included. -Version: 5.5.12 +Version: 5.5.12.9000 Depends: R (>= 3.3.0), methods, @@ -47,7 +47,7 @@ Suggests: knitr, rmarkdown, testthat -Date: 2024-06-22 +Date: 2024-07-01 Author: Alexis Sarda-Espinosa Maintainer: Alexis Sarda BugReports: https://github.com/asardaes/dtwclust/issues diff --git a/R/S4-DistmatLowerTriangular.R b/R/S4-DistmatLowerTriangular.R index c13c6a22..7aa815b9 100644 --- a/R/S4-DistmatLowerTriangular.R +++ b/R/S4-DistmatLowerTriangular.R @@ -20,7 +20,18 @@ lower_triangular_index <- function(i, j, n, diagonal) { #' #' @field distmat The lower triangular. #' -#' @keywords internal +#' @details +#' +#' If you wish to, you can use this class to access `dist` elements with `[` as if it were a normal +#' matrix. You can use [methods::new] passing the `dist` object in a `distmat` argument. +#' +#' @examples +#' +#' dm <- new("DistmatLowerTriangular", +#' distmat = proxy::dist(CharTraj[1:5], method = "gak", sigma = 5.5, window.size = 10L, +#' lower_triangular_only = TRUE, diag = TRUE)) +#' +#' dm[2:3, 4:5] #' DistmatLowerTriangular <- methods::setRefClass( "DistmatLowerTriangular", diff --git a/inst/NEWS.Rd b/inst/NEWS.Rd index 9e6c9aa5..89df923b 100644 --- a/inst/NEWS.Rd +++ b/inst/NEWS.Rd @@ -11,6 +11,6 @@ \itemize{ \item Update Makevars for ARM version of Windows. \item Sanitize internal usage of \code{do.call} to avoid huge backtraces. - \item Support lower triangular \code{distmat} objects for symmetric distances. + \item Support lower triangular \code{distmat} objects for symmetric distances. See PR #77 on GitHub. } } diff --git a/man/DistmatLowerTriangular-class.Rd b/man/DistmatLowerTriangular-class.Rd index 3a97c4de..23f6f707 100644 --- a/man/DistmatLowerTriangular-class.Rd +++ b/man/DistmatLowerTriangular-class.Rd @@ -9,6 +9,10 @@ Reference class that is used internally for PAM centroids when \code{pam.precompute = TRUE} and \code{pam.sparse = FALSE}. It contains \linkS4class{Distmat}. } +\details{ +If you wish to, you can use this class to access \code{dist} elements with \code{[} as if it were a normal +matrix. You can use \link[methods:new]{methods::new} passing the \code{dist} object in a \code{distmat} argument. +} \section{Fields}{ \describe{ @@ -21,4 +25,12 @@ Reference class that is used internally for PAM centroids when \code{pam.precomp \item{\code{initialize(..., distmat, series, distance, control, error.check = TRUE)}}{Initialization based on needed parameters} }} -\keyword{internal} +\examples{ + +dm <- new("DistmatLowerTriangular", + distmat = proxy::dist(CharTraj[1:5], method = "gak", sigma = 5.5, window.size = 10L, + lower_triangular_only = TRUE, diag = TRUE)) + +dm[2:3, 4:5] + +}