Skip to content

Commit dfdb9a3

Browse files
committed
Minor changes in the DOC
1 parent a13175a commit dfdb9a3

File tree

2 files changed

+40
-19
lines changed

2 files changed

+40
-19
lines changed

emate/hermitian/cupyops/kpm.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@ def get_moments(
4141
num_moments: (uint) number of cheby. moments
4242
dimension: (uint) size of the matrix
4343
44-
alpha0: Tensor(shape=(H.shape[0], num_vecs), dtype=tf_complex)
45-
alpha1: Tensor(shape=(H.shape[0], num_vecs), dtype=tf_complex)
46-
47-
4844
Returns
4945
-------
5046
"""
@@ -80,7 +76,8 @@ def apply_kernel(
8076
"""
8177
Parameters
8278
----------
83-
79+
Apply a given kernel in a given array of moments.
80+
Return the cosine transform of type III.
8481
"""
8582

8683
moments = cp.sum(moments.real, axis=0)

emate/hermitian/kpm.py

+38-14
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def rescale_kpm(ek, rho, scale_fact_a, scale_fact_b):
5555
rho = rho/scale_fact_a
5656
return ek, rho
5757

58-
def pykpm(
58+
def tfkpm(
5959
H,
6060
num_moments=10,
6161
num_vecs=10,
@@ -89,6 +89,8 @@ def pykpm(
8989
epsilon: float
9090
Used to rescale the matrix eigenvalues into the interval
9191
[-1, 1]
92+
device: str
93+
'/gpu:ID' or '/cpu:ID'
9294
9395
Returns
9496
-------
@@ -100,18 +102,6 @@ def pykpm(
100102
rho: array of floats
101103
An array containing the densities of each "eigenvalue"
102104
103-
References
104-
----------
105-
106-
[1] Wang, L.W., 1994. Calculating the density of states and
107-
optical-absorption spectra of large quantum systems by the plane-wave moments
108-
method. Physical Review B, 49(15), p.10154.
109-
110-
[2] Hutchinson, M.F., 1990. A stochastic estimator of the trace of the
111-
influence matrix for laplacian smoothing splines. Communications in
112-
Statistics-Simulation and Computation, 19(2), pp.433-450.
113-
114-
115105
"""
116106

117107
if (lmin is None) or (lmax is None):
@@ -191,7 +181,41 @@ def cupykpm(
191181
lmax=None,
192182
epsilon=0.01
193183
):
184+
"""
185+
Kernel Polynomial Method using a Jackson's kernel. CUPY version
186+
187+
Parameters
188+
----------
194189
190+
H: scipy CSR sparse matrix
191+
The Hermitian matrix
192+
num_moments: int
193+
num_vecs: int
194+
Number of random vectors in oder to aproximate the
195+
trace
196+
extra_points: int
197+
precision: int
198+
Single or double precision
199+
limin: float, optional
200+
The smallest eigenvalue
201+
lmax: float
202+
The highest eigenvalue
203+
epsilon: float
204+
Used to rescale the matrix eigenvalues into the interval
205+
[-1, 1]
206+
207+
Returns
208+
-------
209+
210+
ek: array of floats
211+
An array with num_moments + extra_points approximated
212+
"eigenvalues"
213+
214+
rho: array of floats
215+
An array containing the densities of each "eigenvalue"
216+
217+
218+
"""
195219
dimension = H.shape[0]
196220

197221
if (lmin is None) or (lmax is None):
@@ -226,5 +250,5 @@ def cupykpm(
226250

227251
return ek, rho
228252

229-
tfkpm = pykpm
253+
pykpm = tfkpm
230254
__all__ = ["pykpm", "cupykpm", "tfkpm"]

0 commit comments

Comments
 (0)