11"""
2- function LPHGLET_Synthesis(dvec::Vector{Float64}, GP::GraphPart, BS::BasisSpec, G::GraphSig; method ::Symbol = :L, ϵ::Float64 = 0.3)
2+ function LPHGLET_Synthesis(dvec::Vector{Float64}, GP::GraphPart, BS::BasisSpec, G::GraphSig; gltype ::Symbol = :L, ϵ::Float64 = 0.3)
33
44Perform Lapped-HGLET Synthesis transform
55
@@ -8,14 +8,14 @@ Perform Lapped-HGLET Synthesis transform
88* `GP`: a GraphPart object
99* `BS`: a BasisSpec object
1010* `G`: a GraphSig object
11- * `method `: :L or :Lsym, indicating which eigenvectors are used
11+ * `gltype `: :L or :Lsym, indicating which eigenvectors are used
1212* `ϵ`: relative action bandwidth (default: 0.3)
1313
1414### Output Argument
1515* `f`: the reconstructed signal
1616* `GS`: the reconstructed GraphSig object
1717"""
18- function LPHGLET_Synthesis (dvec:: Matrix{Float64} , GP:: GraphPart , BS:: BasisSpec , G:: GraphSig ; method :: Symbol = :L , ϵ:: Float64 = 0.3 )
18+ function LPHGLET_Synthesis (dvec:: Matrix{Float64} , GP:: GraphPart , BS:: BasisSpec , G:: GraphSig ; gltype :: Symbol = :L , ϵ:: Float64 = 0.3 )
1919 # Preliminaries
2020 W = G. W
2121 inds = GP. inds
@@ -48,32 +48,32 @@ function LPHGLET_Synthesis(dvec::Matrix{Float64}, GP::GraphPart, BS::BasisSpec,
4848 if (j == jmax || count (! iszero, dmatrix[indr, j + 1 , :]) == 0 ) && count (! iszero, dmatrix[indr, j, :]) > 0
4949 # compute the eigenvectors
5050 W_temp = W[indrs,indrs]
51- D_temp = sparse ( Diagonal (dropdims (sum (W_temp, dims = 1 ) , dims = 1 )))
52- if method == :L
51+ D_temp = Diagonal (vec (sum (W_temp, dims = 1 )))
52+ if gltype == :L
5353 # compute the eigenvectors of L ==> svd(L)
54- vec = svd (Matrix (D_temp - W_temp)). U
55- elseif method == :Lsym
54+ v = svd (Matrix (D_temp - W_temp)). U
55+ elseif gltype == :Lsym
5656 # check if one can assemble the Lsym
5757 if minimum (sum (W[indrs, indrs], dims = 1 )) > 10 ^ 3 * eps ()
5858 # ## eigenvectors of L_sym ==> svd(L_sym)
59- D_temp_p = sparse ( Diagonal (dropdims (sum (W_temp, dims = 1 ), dims = 1 ).^ (- 1 / 2 ) ))
60- vec = svd (Matrix (D_temp_p * (D_temp - W_temp) * D_temp_p)). U
59+ D_temp_p = Diagonal (vec (sum (W_temp, dims = 1 )).^ (- 0.5 ))
60+ v = svd (Matrix (D_temp_p * (D_temp - W_temp) * D_temp_p)). U
6161 else
6262 # ## eigenvectors of L ==> svd(L)
63- vec = svd (Matrix (D_temp - W_temp)). U
63+ v = svd (Matrix (D_temp - W_temp)). U
6464 end
6565 end
66- vec = vec [:, end : - 1 : 1 ]
66+ v = v [:,end : - 1 : 1 ]
6767
6868
6969 # standardize the eigenvector signs
70- standardize_eigenvector_signs! (vec )
70+ standardize_eigenvector_signs! (v )
7171
7272 # construct unfolder operator custom to current region
7373 P = Uf[indrs, :]'
7474
7575 # reconstruct the signal
76- f += (P * vec ) * dmatrix[indr, j, :]
76+ f += (P * v ) * dmatrix[indr, j, :]
7777
7878 end
7979 end
@@ -131,30 +131,30 @@ function LPHGLET_Analysis_All(G::GraphSig, GP::GraphPart; ϵ::Float64 = 0.3)
131131
132132 # compute the eigenvectors
133133 W_temp = W[indrs,indrs]
134- D_temp = sparse ( Diagonal (dropdims (sum (W_temp, dims = 1 ) , dims = 1 )))
134+ D_temp = Diagonal (vec (sum (W_temp, dims = 1 )))
135135 # # eigenvectors of L ==> svd(L)
136- vec = svd (Matrix (D_temp - W_temp)). U
136+ v = svd (Matrix (D_temp - W_temp)). U
137137 # # eigenvectors of L_sym ==> svd(L_sym)
138138 if minimum (sum (W[indrs, indrs], dims = 1 )) > 10 ^ 3 * eps ()
139139 # ## eigenvectors of L_sym ==> svd(L_sym)
140- D_temp_p = sparse ( Diagonal (dropdims (sum (W_temp, dims = 1 ), dims = 1 ).^ (- 1 / 2 ) ))
141- vec_sym = svd (Matrix (D_temp_p * (D_temp - W_temp) * D_temp_p)). U
140+ D_temp_p = Diagonal (vec (sum (W_temp, dims = 1 )).^ (- 0.5 ))
141+ v_sym = svd (Matrix (D_temp_p * (D_temp - W_temp) * D_temp_p)). U
142142 else
143143 # ## eigenvectors of L ==> svd(L)
144- vec_sym = deepcopy (vec )
144+ v_sym = deepcopy (v )
145145 end
146146
147147 # standardize the eigenvector signs
148- vec = vec [:, end : - 1 : 1 ]
149- standardize_eigenvector_signs! (vec )
150- vec_sym = vec_sym [:, end : - 1 : 1 ]
151- standardize_eigenvector_signs! (vec_sym )
148+ v = v [:,end : - 1 : 1 ]
149+ standardize_eigenvector_signs! (v )
150+ v_sym = v_sym [:,end : - 1 : 1 ]
151+ standardize_eigenvector_signs! (v_sym )
152152
153153 # construct unfolding operator custom to current region
154154 P = Uf[indrs, :]'
155155 # obtain the expansion coefficients
156- dmatrixlH[indr, j, :] = (P * vec )' * G. f
157- dmatrixlHsym[indr, j, :] = (P * vec_sym )' * G. f
156+ dmatrixlH[indr, j, :] = (P * v )' * G. f
157+ dmatrixlHsym[indr, j, :] = (P * v_sym )' * G. f
158158 end
159159 end
160160
@@ -164,16 +164,16 @@ end
164164
165165
166166
167- function standardize_eigenvector_signs! (vec )
167+ function standardize_eigenvector_signs! (v )
168168 # standardize the eigenvector signs for HGLET (different with NGWPs)
169- for col = 1 : size (vec , 2 )
169+ for col = 1 : size (v , 2 )
170170 row = 1
171171 standardized = false
172172 while ! standardized
173- if vec [row, col] > 10 ^ 3 * eps ()
173+ if v [row, col] > 10 ^ 3 * eps ()
174174 standardized = true
175- elseif vec [row,col] < - 10 ^ 3 * eps ()
176- vec [:, col] = - vec [:, col]
175+ elseif v [row,col] < - 10 ^ 3 * eps ()
176+ v [:, col] = - v [:, col]
177177 else
178178 row += 1
179179 end
@@ -201,33 +201,33 @@ function HGLET_dictionary(GP::GraphPart, G::GraphSig; gltype::Symbol = :L)
201201 dictionary = zeros (N, jmax, N)
202202 for j = 1 : jmax
203203 BS = BasisSpec (collect (enumerate (j * ones (Int, N))))
204- dictionary[:, j, :] = HGLET_Synthesis (Matrix {Float64} (I, N, N), GP, BS, G; gltype = method )[1 ]'
204+ dictionary[:, j, :] = HGLET_Synthesis (Matrix {Float64} (I, N, N), GP, BS, G; gltype = gltype )[1 ]'
205205 end
206206 return dictionary
207207end
208208
209209"""
210- LPHGLET_dictionary(GP::GraphPart, G::GraphSig; method ::Symbol = :L, ϵ::Float64 = 0.3)
210+ LPHGLET_dictionary(GP::GraphPart, G::GraphSig; gltype ::Symbol = :L, ϵ::Float64 = 0.3)
211211
212212assemble the whole LP-HGLET dictionary
213213
214214### Input Arguments
215215* `GP`: a GraphPart object
216216* `G`: a GraphSig object
217- * `method `: `:L` or `:Lsym`
217+ * `gltype `: `:L` or `:Lsym`
218218* `ϵ`: relative action bandwidth (default: 0.3)
219219
220220### Output Argument
221221* `dictionary`: the LP-HGLET dictionary
222222
223223"""
224- function LPHGLET_dictionary (GP:: GraphPart , G:: GraphSig ; method :: Symbol = :L , ϵ:: Float64 = 0.3 )
224+ function LPHGLET_dictionary (GP:: GraphPart , G:: GraphSig ; gltype :: Symbol = :L , ϵ:: Float64 = 0.3 )
225225 N = size (G. W, 1 )
226226 jmax = size (GP. rs, 2 )
227227 dictionary = zeros (N, jmax, N)
228228 for j = 1 : jmax
229229 BS = BasisSpec (collect (enumerate (j * ones (Int, N))))
230- dictionary[:, j, :] = LPHGLET_Synthesis (Matrix {Float64} (I, N, N), GP, BS, G; method = method , ϵ = ϵ)[1 ]'
230+ dictionary[:, j, :] = LPHGLET_Synthesis (Matrix {Float64} (I, N, N), GP, BS, G; gltype = gltype , ϵ = ϵ)[1 ]'
231231 end
232232 return dictionary
233233end
0 commit comments