From 732342373fdf84bf9d5b584d4c2a636ea931187c Mon Sep 17 00:00:00 2001 From: David Hong Date: Thu, 15 Aug 2024 18:25:09 -0400 Subject: [PATCH] Add docstring --- src/cpd.jl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/cpd.jl b/src/cpd.jl index 1933524..3ab1bf6 100644 --- a/src/cpd.jl +++ b/src/cpd.jl @@ -94,6 +94,13 @@ function norm2(M::CPD{T,N}) where {T,N} return sqrt(abs(M.λ' * V * M.λ)) end +""" + normalizecomps(M::CPD, p::Real = 2) + +Normalize the components of `M` so that the columns of all its factor matrices +all have `p`-norm equal to unity, i.e., `norm(M.U[k][:, j], p) == 1` for all +`k ∈ 1:ndims(M)` and `j ∈ 1:ncomps(M)`. The excess weight is absorbed into `M.λ`. +""" function normalizecomps(M::CPD, p::Real = 2) weights = M.λ[:]