@@ -55,7 +55,7 @@ def rescale_kpm(ek, rho, scale_fact_a, scale_fact_b):
55
55
rho = rho / scale_fact_a
56
56
return ek , rho
57
57
58
- def pykpm (
58
+ def tfkpm (
59
59
H ,
60
60
num_moments = 10 ,
61
61
num_vecs = 10 ,
@@ -89,6 +89,8 @@ def pykpm(
89
89
epsilon: float
90
90
Used to rescale the matrix eigenvalues into the interval
91
91
[-1, 1]
92
+ device: str
93
+ '/gpu:ID' or '/cpu:ID'
92
94
93
95
Returns
94
96
-------
@@ -100,18 +102,6 @@ def pykpm(
100
102
rho: array of floats
101
103
An array containing the densities of each "eigenvalue"
102
104
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
-
115
105
"""
116
106
117
107
if (lmin is None ) or (lmax is None ):
@@ -191,7 +181,41 @@ def cupykpm(
191
181
lmax = None ,
192
182
epsilon = 0.01
193
183
):
184
+ """
185
+ Kernel Polynomial Method using a Jackson's kernel. CUPY version
186
+
187
+ Parameters
188
+ ----------
194
189
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
+ """
195
219
dimension = H .shape [0 ]
196
220
197
221
if (lmin is None ) or (lmax is None ):
@@ -226,5 +250,5 @@ def cupykpm(
226
250
227
251
return ek , rho
228
252
229
- tfkpm = pykpm
253
+ pykpm = tfkpm
230
254
__all__ = ["pykpm" , "cupykpm" , "tfkpm" ]
0 commit comments