You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pkg/unmixR/R/atgp.R
+70-2Lines changed: 70 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,8 @@
5
5
#'
6
6
#' @param p Number of endmembers.
7
7
#'
8
-
#' @references Based on Python implementation in [pysptools](https://github.com/ctherien/pysptools/blob/fbcd3ecaa7ab27f0158b28b4327537c3e75db160/pysptools/eea/eea.py#L52)
8
+
#' @references Based on Python implementation in [pysptools](https://github.com/ctherien/pysptools/blob/fbcd3ecaa7ab27f0158b28b4327537c3e75db160/pysptools/eea/eea.py#L52).
9
+
#' Also matches [matlabHyperspectralToolbox](https://github.com/isaacgerg/matlabHyperspectralToolbox/blob/master/hyperspectralToolbox/hyperAtgp.m)
9
10
#'
10
11
#' @return A list which contains:
11
12
#' \itemize{
@@ -33,7 +34,13 @@ atgp <- function(data, p) {
33
34
projection_vectors<-NULL
34
35
while (length(indices) <p) {
35
36
# Get the next projection vector
36
-
P<-MASS::Null(t(data[indices,,drop=FALSE]))
37
+
# Same as `P <- MASS::Null(t(data[indices,,drop=FALSE]))`
38
+
# But MASS::Null is very slow, it is faster to use orthogonal complement:
39
+
# $P = I - U(UU^T)^{-1}U^T$
40
+
# P is symmetric matrix, so we use Ut directly to reduce transpositions
0 commit comments