SPDMatrices | R Documentation |
Class for the manifold of symmetric positive definite (SPD) matrices.
rgeomstats::PythonClass
-> rgeomstats::Manifold
-> rgeomstats::OpenSet
-> SPDMatrices
n
An integer value specifying the number of rows and columns of the matrices.
rgeomstats::PythonClass$get_python_class()
rgeomstats::PythonClass$set_python_class()
rgeomstats::Manifold$belongs()
rgeomstats::Manifold$is_tangent()
rgeomstats::Manifold$random_point()
rgeomstats::Manifold$random_tangent_vec()
rgeomstats::Manifold$regularize()
rgeomstats::Manifold$set_metric()
rgeomstats::Manifold$to_tangent()
rgeomstats::OpenSet$projection()
new()
The SPDMatrices
class constructor.
SPDMatrices$new(n, ..., py_cls = NULL)
n
An integer value specifying the number of rows and columns of the matrices.
...
Extra arguments to be passed to parent class constructors. See
OpenSet
and Manifold
classes.
py_cls
A Python object of class SPDMatrices
. Defaults to NULL
in which case it is instantiated on the fly using the other input
arguments.
An object of class SPDMatrices
.
if (reticulate::py_module_available("geomstats")) { spd3 <- SPDMatrix(n = 3) spd3 }
cholesky_factor()
Computes Cholesky factor for a symmetric positive definite matrix.
SPDMatrices$cholesky_factor(mat)
mat
A numeric array of shape [… \times n \times n] specifying one or more SPD matrices.
A numeric array of the same shape storing the corresponding Cholesky factors.
if (reticulate::py_module_available("geomstats")) { spd3 <- SPDMatrix(n = 3) V <- cbind( c(sqrt(2) / 2, -sqrt(2) / 2, 0), c(sqrt(2) / 2, sqrt(2) / 2, 0), c(0, 0, 1) ) A <- V %*% diag(1:3) %*% t(V) spd3$cholesky_factor(A) }
differential_cholesky_factor()
Computes the differential of the Cholesky factor map.
SPDMatrices$differential_cholesky_factor(tangent_vec, base_point)
tangent_vec
A numeric array of shape [… \times n \times n] specifying one or more symmetric matrices at corresponding base points.
base_point
A numeric array of shape [… \times n \times n] specifying one or more SPD matrices specifying base points for the input tangent vectors.
A numeric array of shape [… \times n \times n] storing the differentials of the corresponding Cholesky factor maps.
if (reticulate::py_module_available("geomstats")) { spd3 <- SPDMatrix(n = 3) V <- cbind( c(sqrt(2) / 2, -sqrt(2) / 2, 0), c(sqrt(2) / 2, sqrt(2) / 2, 0), c(0, 0, 1) ) A <- V %*% diag(1:3) %*% t(V) spd3$differential_cholesky_factor(diag(1, 3), A) }
expm()
Computes the matrix exponential for a symmetric matrix.
SPDMatrices$expm(mat)
mat
A numeric array of shape [… \times n \times n] specifying one or more symmetric matrices.
A numeric array of the same shape storing the corresponding matrix exponentials.
if (reticulate::py_module_available("geomstats")) { spd3 <- SPDMatrix(n = 3) spd3$expm(diag(-1, 3)) }
differential_exp()
Computes the differential of the matrix exponential.
SPDMatrices$differential_exp(tangent_vec, base_point)
tangent_vec
A numeric array of shape [… \times n \times n] specifying one or more symmetric matrices at corresponding base points.
base_point
A numeric array of shape [… \times n \times n] specifying one or more SPD matrices specifying base points for the input tangent vectors.
A numeric array of shape [… \times n \times] storing the differentials of matrix exponential at corresponding base points applied to corresponding tangent vectors.
if (reticulate::py_module_available("geomstats")) { spd3 <- SPDMatrix(n = 3) V <- cbind( c(sqrt(2) / 2, -sqrt(2) / 2, 0), c(sqrt(2) / 2, sqrt(2) / 2, 0), c(0, 0, 1) ) A <- V %*% diag(1:3) %*% t(V) spd3$differential_exp(diag(1, 3), A) }
inverse_differential_exp()
Computes the inverse of the differential of the matrix exponential.
SPDMatrices$inverse_differential_exp(tangent_vec, base_point)
tangent_vec
A numeric array of shape [… \times n \times n] specifying one or more symmetric matrices at corresponding base points.
base_point
A numeric array of shape [… \times n \times n] specifying one or more SPD matrices specifying base points for the input tangent vectors.
A numeric array of shape [… \times n \times] storing the inverse of the differentials of matrix exponential at corresponding base points applied to corresponding tangent vectors.
if (reticulate::py_module_available("geomstats")) { spd3 <- SPDMatrix(n = 3) V <- cbind( c(sqrt(2) / 2, -sqrt(2) / 2, 0), c(sqrt(2) / 2, sqrt(2) / 2, 0), c(0, 0, 1) ) A <- V %*% diag(1:3) %*% t(V) spd3$inverse_differential_exp(diag(1, 3), A) }
logm()
Computes the matrix logarithm of an SPD matrix.
SPDMatrices$logm(mat)
mat
A numeric array of shape [… \times n \times n] specifying one or more SPD matrices.
A numeric array of the same shape storing the logarithms of the input SPD matrices.
if (reticulate::py_module_available("geomstats")) { spd3 <- SPDMatrix(n = 3) spd3$logm(diag(1, 3)) }
differential_log()
Computes the differential of the matrix logarithm.
SPDMatrices$differential_log(tangent_vec, base_point)
tangent_vec
A numeric array of shape [… \times n \times n] specifying one or more symmetric matrices at corresponding base points.
base_point
A numeric array of shape [… \times n \times n] specifying one or more SPD matrices specifying base points for the input tangent vectors.
A numeric array of shape [… \times n \times] storing the differentials of matrix logarithm at corresponding base points applied to corresponding tangent vectors.
if (reticulate::py_module_available("geomstats")) { spd3 <- SPDMatrix(n = 3) V <- cbind( c(sqrt(2) / 2, -sqrt(2) / 2, 0), c(sqrt(2) / 2, sqrt(2) / 2, 0), c(0, 0, 1) ) A <- V %*% diag(1:3) %*% t(V) spd3$differential_log(diag(1, 3), A) }
inverse_differential_log()
Computes the inverse of the differential of the matrix logarithm.
SPDMatrices$inverse_differential_log(tangent_vec, base_point)
tangent_vec
A numeric array of shape [… \times n \times n] specifying one or more symmetric matrices at corresponding base points.
base_point
A numeric array of shape [… \times n \times n] specifying one or more SPD matrices specifying base points for the input tangent vectors.
A numeric array of shape [… \times n \times] storing the inverse of the differentials of matrix logarithm at corresponding base points applied to corresponding tangent vectors.
if (reticulate::py_module_available("geomstats")) { spd3 <- SPDMatrix(n = 3) V <- cbind( c(sqrt(2) / 2, -sqrt(2) / 2, 0), c(sqrt(2) / 2, sqrt(2) / 2, 0), c(0, 0, 1) ) A <- V %*% diag(1:3) %*% t(V) spd3$inverse_differential_log(diag(1, 3), A) }
powerm()
Computes the matrix power of an SPD matrix.
SPDMatrices$powerm(mat, power)
mat
A numeric array of shape [… \times n \times n] specifying one or more SPD matrices.
power
A numeric value or vector specifying the desired power(s).
A numeric array of the same shape as mat
storing the
corresponding matrix powers computed as:
A^p = \exp(p \log(A)).
If power
is a vector, a list of such arrays is returned.
if (reticulate::py_module_available("geomstats")) { spd3 <- SPDMatrix(n = 3) spd3$powerm(diag(1, 3), 2) }
differential_power()
Computes the differential of the matrix power function.
SPDMatrices$differential_power(power, tangent_vec, base_point)
power
An integer value specifying the desired power.
tangent_vec
A numeric array of shape [… \times n \times n] specifying one or more symmetric matrices at corresponding base points.
base_point
A numeric array of shape [… \times n \times n] specifying one or more SPD matrices specifying base points for the input tangent vectors.
A numeric array of shape [… \times n \times] storing the differential of the power function
A^p = \exp(p \log(A))
at corresponding base points applied to corresponding tangent vectors.
if (reticulate::py_module_available("geomstats")) { spd3 <- SPDMatrix(n = 3) V <- cbind( c(sqrt(2) / 2, -sqrt(2) / 2, 0), c(sqrt(2) / 2, sqrt(2) / 2, 0), c(0, 0, 1) ) A <- V %*% diag(1:3) %*% t(V) spd3$differential_power(2, diag(1, 3), A) }
inverse_differential_power()
Computes the inverse of the differential of the matrix power function.
SPDMatrices$inverse_differential_power(power, tangent_vec, base_point)
power
An integer value specifying the desired power.
tangent_vec
A numeric array of shape [… \times n \times n] specifying one or more symmetric matrices at corresponding base points.
base_point
A numeric array of shape [… \times n \times n] specifying one or more SPD matrices specifying base points for the input tangent vectors.
A numeric array of shape [… \times n \times] storing the inverse of the differential of the power function
A^p = \exp(p \log(A))
at corresponding base points applied to corresponding tangent vectors.
if (reticulate::py_module_available("geomstats")) { spd3 <- SPDMatrix(n = 3) V <- cbind( c(sqrt(2) / 2, -sqrt(2) / 2, 0), c(sqrt(2) / 2, sqrt(2) / 2, 0), c(0, 0, 1) ) A <- V %*% diag(1:3) %*% t(V) spd3$inverse_differential_power(2, diag(1, 3), A) }
clone()
The objects of this class are cloneable with this method.
SPDMatrices$clone(deep = FALSE)
deep
Whether to make a deep clone.
Yann Thanwerdas
Other symmetric positive definite matrix classes:
SPDMatrix()
## ------------------------------------------------ ## Method `SPDMatrices$new` ## ------------------------------------------------ if (reticulate::py_module_available("geomstats")) { spd3 <- SPDMatrix(n = 3) spd3 } ## ------------------------------------------------ ## Method `SPDMatrices$cholesky_factor` ## ------------------------------------------------ if (reticulate::py_module_available("geomstats")) { spd3 <- SPDMatrix(n = 3) V <- cbind( c(sqrt(2) / 2, -sqrt(2) / 2, 0), c(sqrt(2) / 2, sqrt(2) / 2, 0), c(0, 0, 1) ) A <- V %*% diag(1:3) %*% t(V) spd3$cholesky_factor(A) } ## ------------------------------------------------ ## Method `SPDMatrices$differential_cholesky_factor` ## ------------------------------------------------ if (reticulate::py_module_available("geomstats")) { spd3 <- SPDMatrix(n = 3) V <- cbind( c(sqrt(2) / 2, -sqrt(2) / 2, 0), c(sqrt(2) / 2, sqrt(2) / 2, 0), c(0, 0, 1) ) A <- V %*% diag(1:3) %*% t(V) spd3$differential_cholesky_factor(diag(1, 3), A) } ## ------------------------------------------------ ## Method `SPDMatrices$expm` ## ------------------------------------------------ if (reticulate::py_module_available("geomstats")) { spd3 <- SPDMatrix(n = 3) spd3$expm(diag(-1, 3)) } ## ------------------------------------------------ ## Method `SPDMatrices$differential_exp` ## ------------------------------------------------ if (reticulate::py_module_available("geomstats")) { spd3 <- SPDMatrix(n = 3) V <- cbind( c(sqrt(2) / 2, -sqrt(2) / 2, 0), c(sqrt(2) / 2, sqrt(2) / 2, 0), c(0, 0, 1) ) A <- V %*% diag(1:3) %*% t(V) spd3$differential_exp(diag(1, 3), A) } ## ------------------------------------------------ ## Method `SPDMatrices$inverse_differential_exp` ## ------------------------------------------------ if (reticulate::py_module_available("geomstats")) { spd3 <- SPDMatrix(n = 3) V <- cbind( c(sqrt(2) / 2, -sqrt(2) / 2, 0), c(sqrt(2) / 2, sqrt(2) / 2, 0), c(0, 0, 1) ) A <- V %*% diag(1:3) %*% t(V) spd3$inverse_differential_exp(diag(1, 3), A) } ## ------------------------------------------------ ## Method `SPDMatrices$logm` ## ------------------------------------------------ if (reticulate::py_module_available("geomstats")) { spd3 <- SPDMatrix(n = 3) spd3$logm(diag(1, 3)) } ## ------------------------------------------------ ## Method `SPDMatrices$differential_log` ## ------------------------------------------------ if (reticulate::py_module_available("geomstats")) { spd3 <- SPDMatrix(n = 3) V <- cbind( c(sqrt(2) / 2, -sqrt(2) / 2, 0), c(sqrt(2) / 2, sqrt(2) / 2, 0), c(0, 0, 1) ) A <- V %*% diag(1:3) %*% t(V) spd3$differential_log(diag(1, 3), A) } ## ------------------------------------------------ ## Method `SPDMatrices$inverse_differential_log` ## ------------------------------------------------ if (reticulate::py_module_available("geomstats")) { spd3 <- SPDMatrix(n = 3) V <- cbind( c(sqrt(2) / 2, -sqrt(2) / 2, 0), c(sqrt(2) / 2, sqrt(2) / 2, 0), c(0, 0, 1) ) A <- V %*% diag(1:3) %*% t(V) spd3$inverse_differential_log(diag(1, 3), A) } ## ------------------------------------------------ ## Method `SPDMatrices$powerm` ## ------------------------------------------------ if (reticulate::py_module_available("geomstats")) { spd3 <- SPDMatrix(n = 3) spd3$powerm(diag(1, 3), 2) } ## ------------------------------------------------ ## Method `SPDMatrices$differential_power` ## ------------------------------------------------ if (reticulate::py_module_available("geomstats")) { spd3 <- SPDMatrix(n = 3) V <- cbind( c(sqrt(2) / 2, -sqrt(2) / 2, 0), c(sqrt(2) / 2, sqrt(2) / 2, 0), c(0, 0, 1) ) A <- V %*% diag(1:3) %*% t(V) spd3$differential_power(2, diag(1, 3), A) } ## ------------------------------------------------ ## Method `SPDMatrices$inverse_differential_power` ## ------------------------------------------------ if (reticulate::py_module_available("geomstats")) { spd3 <- SPDMatrix(n = 3) V <- cbind( c(sqrt(2) / 2, -sqrt(2) / 2, 0), c(sqrt(2) / 2, sqrt(2) / 2, 0), c(0, 0, 1) ) A <- V %*% diag(1:3) %*% t(V) spd3$inverse_differential_power(2, diag(1, 3), A) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.