File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -418,6 +418,9 @@ X = rand(n, p)
418418Y = rand(n, 3)
419419w = pweight(rand(n))
420420
421+ corm(X)
422+ corm(X, Y)
423+
421424corm(X, w)
422425corm(X, Y, w)
423426```
@@ -454,6 +457,8 @@ The Frobenius norm of `X` is:
454457
455458The weighted Frobenius norm is:
456459* sqrt(tr(X' * D * X)), where D is the diagonal matrix of vector `weights.values`.
460+
461+ See function `frob2`.
457462"""
458463frob (X:: AbstractMatrix{Q} ) where Q <: AbstractFloat = sqrt (frob2 (X))
459464
@@ -466,7 +471,24 @@ Squared Frobenius norm of a matrix.
466471* `X` : A matrix (n, p).
467472* `weights` : Weights (n) of the observations. Object of type `ProbabilityWeights` (e.g., generated by function `pweight`).
468473
469- See function `frob`.
474+ The squared Frobenius norm of `X` is:
475+ * tr(X' * X).
476+
477+ The squared weighted Frobenius norm is:
478+ * tr(X' * D * X), where D is the diagonal matrix of vector `weights.values`.
479+
480+ ## Examples
481+ ```julia
482+ using Jchemo
483+
484+ n, p = 5, 6
485+ X = rand(n, p)
486+ w = pweight(rand(n))
487+
488+ frob2(X)
489+
490+ frob2(X, w)
491+ ```
470492"""
471493frob2 (X:: AbstractMatrix{Q} ) where Q <: AbstractFloat = sum (colnorm2 (X))
472494
You can’t perform that action at this time.
0 commit comments