@@ -30,10 +30,10 @@ function HGLET_Synthesis(dvec::Matrix{Float64}, GP::GraphPart, BS::BasisSpec,
30
30
# Preliminaries
31
31
W = G. W
32
32
jmax = size (GP. rs,2 )
33
- f = dmatrix[:,jmax,:]
34
33
35
34
# Fill in the appropriate entries of dmatrix
36
35
dmatrix = dvec2dmatrix (dvec,GP,BS)
36
+ f = dmatrix[:,jmax,:]
37
37
38
38
# Perform the signal synthesis from the given coefficients
39
39
for j = jmax: - 1 : 1
@@ -57,16 +57,16 @@ function HGLET_Synthesis(dvec::Matrix{Float64}, GP::GraphPart, BS::BasisSpec,
57
57
indrs = GP. ind[rs1: rs3- 1 ]
58
58
W_temp = W[indrs,indrs]
59
59
D = Diagonal (vec (sum (W_temp, dims = 1 )))
60
- D2 = D .^ (- 0.5 )
60
+ D2 = Diagonal ( vec ( sum (W_temp, dims = 1 )) .^ (- 0.5 ) )
61
61
normalizep = false # a flag for normalizing L for Lsym/Lrw
62
62
if minimum (diag (D)) > 10 ^ 3 * eps () # avoiding 1/small entries
63
63
normalizep = true
64
64
end
65
65
# compute the GL eigenvectors via svd.
66
66
if ( method == :Lrw || method == :Lsym ) && normalizep
67
- v,_,_ = svd (D2 * (D - W_temp) * D2)
67
+ v,_,_ = svd (D2 * (D - Matrix ( W_temp) ) * D2)
68
68
else
69
- v,_,_ = svd (D - W_temp)
69
+ v,_,_ = svd (D - Matrix ( W_temp) )
70
70
if method != :L
71
71
@warn (" Due to the small diagonal entries of W, we revert back to the option :L, not :" * String (method))
72
72
end
@@ -82,6 +82,7 @@ function HGLET_Synthesis(dvec::Matrix{Float64}, GP::GraphPart, BS::BasisSpec,
82
82
standardized = true
83
83
elseif v[row,col] < - 10 ^ 3 * eps ()
84
84
v[:,col] = - v[:,col]
85
+ standardized = true
85
86
else
86
87
row += 1
87
88
end
@@ -181,17 +182,17 @@ function HGLET_Analysis(G::GraphSig, GP::GraphPart, method::Symbol = :L)
181
182
indrs = ind[rs1: rs3- 1 ]
182
183
W_temp = W[indrs,indrs]
183
184
D = Diagonal (vec (sum (W_temp, dims = 1 )))
184
- D2 = D .^ (- 0.5 )
185
+ D2 = Diagonal ( vec ( sum (W_temp, dims = 1 )) .^ (- 0.5 ) )
185
186
normalizep = false # a flag for normalizing L for Lsym and Lrw
186
187
if minimum (diag (D)) > 10 ^ 3 * eps () # avoiding 1/small entries
187
188
normalizep = true
188
189
end
189
190
190
191
# compute the GL eigenvectors via svd
191
192
if ( method == :Lrw || method == :Lsym ) && normalizep
192
- v,_,_ = svd (D2 * (D - W_temp) * D2)
193
+ v,_,_ = svd (D2 * (D - Matrix ( W_temp) ) * D2)
193
194
else
194
- v,_,_ = svd (D - W_temp)
195
+ v,_,_ = svd (D - Matrix ( W_temp) )
195
196
if method != :L
196
197
@warn (" Due to the small diagonal entries of W, we revert back to the option :L, not :" * String (method))
197
198
end
@@ -207,6 +208,7 @@ function HGLET_Analysis(G::GraphSig, GP::GraphPart, method::Symbol = :L)
207
208
standardized = true
208
209
elseif v[row,col] < - 10 ^ 3 * eps ()
209
210
v[:,col] = - v[:,col]
211
+ standardized = true
210
212
else
211
213
row += 1
212
214
end
@@ -274,7 +276,8 @@ function HGLET_Analysis_All(G::GraphSig, GP::GraphPart)
274
276
indrs = ind[rs1: rs3- 1 ]
275
277
276
278
# compute the eigenvectors of L ==> svd(L)
277
- v,_,_ = svd (Diagonal (vec (sum (W[indrs,indrs],dims = 1 )))- W[indrs,indrs])
279
+ v,_,_ = svd (Diagonal (vec (sum (W[indrs,indrs],dims = 1 )))
280
+ - Matrix (W[indrs,indrs]))
278
281
v = v[:,end : - 1 : 1 ]
279
282
280
283
# standardize the eigenvector signs
@@ -286,6 +289,7 @@ function HGLET_Analysis_All(G::GraphSig, GP::GraphPart)
286
289
standardized = true
287
290
elseif v[row,col] < - 10 ^ 3 * eps ()
288
291
v[:,col] = - v[:,col]
292
+ standardized = true
289
293
else
290
294
row += 1
291
295
end
@@ -325,17 +329,16 @@ function HGLET_Analysis_All(G::GraphSig, GP::GraphPart)
325
329
# ## eigenvectors of L_rw ==> svd(L_sym)
326
330
W_temp = W[indrs,indrs]
327
331
D = Diagonal (vec (sum (W_temp,dims = 1 )))
328
- D2 = D .^ (- 0.5 )
329
- v,_,_ = svd (D2 * (D - W_temp) * D2)
332
+ D2 = Diagonal ( vec ( sum (W_temp,dims = 1 )) .^ (- 0.5 ) )
333
+ v,_,_ = svd (D2 * (D - Matrix ( W_temp) ) * D2)
330
334
v = v[:,end : - 1 : 1 ]
331
-
332
335
else
333
336
useLrw = false
334
337
335
338
# ## eigenvectors of L ==> svd(L)
336
339
W_temp = W[indrs,indrs]
337
340
D = Diagonal (vec (sum (W_temp,dims = 1 )))
338
- v,_,_ = svd (D- W_temp)
341
+ v,_,_ = svd (D - Matrix ( W_temp) )
339
342
v = v[:,end : - 1 : 1 ]
340
343
end
341
344
@@ -348,6 +351,7 @@ function HGLET_Analysis_All(G::GraphSig, GP::GraphPart)
348
351
standardized = true
349
352
elseif v[row,col] < - 10 ^ 3 * eps ()
350
353
v[:,col] = - v[:,col]
354
+ standardized = true
351
355
else
352
356
row += 1
353
357
end
@@ -359,7 +363,7 @@ function HGLET_Analysis_All(G::GraphSig, GP::GraphPart)
359
363
360
364
# obtain the expansion coeffcients for L_rw
361
365
if useLrw
362
- dmatrixHrw[rs1: rs3- 1 ,j,:] = v' * (Diagonal (vec (sum (W_temp,dims = 1 ))) .^ 0.5 )* G. f[indrs,:]
366
+ dmatrixHrw[rs1: rs3- 1 ,j,:] = v' * (Diagonal (vec (sum (W_temp,dims = 1 )).^ 0.5 ) )* G. f[indrs,:]
363
367
else
364
368
dmatrixHrw[rs1: rs3- 1 ,j,:] = v' * G. f[indrs,:]
365
369
end
0 commit comments