Commit 5a4caa89 by Corson N. Areshenkoff

### Fix spd-whiten

parent 71bef5c5
 ... ... @@ -7,10 +7,10 @@ #' @param unwhiten Logical. If TRUE, reverses a previously applied whitening transform. #' @return A symmetric, positive-definite matrix. # to <- cov(matrix(rnorm(30), ncol = 3)) # from <- cov(matrix(rnorm(30), ncol = 3)) # x <- cov(matrix(rnorm(30), ncol = 3)) # x <- spd.logmap(x, from) to <- cov(matrix(rnorm(30), ncol = 3)) from <- cov(matrix(rnorm(30), ncol = 3)) x <- cov(matrix(rnorm(30), ncol = 3)) x <- spd.logmap(x, from) spd.transport <- function(x, to, from, nsteps = 10){ ... ... @@ -24,6 +24,7 @@ spd.transport <- function(x, to, from, nsteps = 10){ stop('from must be a positive definite matrix') } # Generate discrete geodesic from source to target geod <- lapply(seq(0, 1, length.out = nsteps), function(i) { spd.interpolate(from, to, t = i, method = 'riemannian') }) ... ...
 ... ... @@ -17,10 +17,10 @@ spd.whiten <- function(x, p, unwhiten = F){ } if (!unwhiten){ p.inv.sqrt <- solve(sqrtm(p.inv)) p.inv.sqrt <- solve(sqrtm(p)) return(p.inv.sqrt %*% x %*% p.inv.sqrt) } else if (unwhiten){ p.sqrt <- sqrtm(p.inv) p.sqrt <- sqrtm(p) return(p.sqrt %*% x %*% p.sqrt) } ... ...
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!