utils
Utils
Ec_to_inv_pF(Ec)
GHz -> 1/picoFarad
Source code in jaxquantum/utils/units.py
81 82 83 84 85 86 87 88 | |
as_series(*arrs)
Return arguments as a list of 1-d arrays.
The returned list contains array(s) of dtype double, complex double, or
object. A 1-d argument of shape (N,) is parsed into N arrays of
size one; a 2-d argument of shape (M,N) is parsed into M arrays
of size N (i.e., is "parsed by row"); and a higher dimensional array
raises a Value Error if it is not first reshaped into either a 1-d or 2-d
array.
Parameters
arrs : array_like 1- or 2-d array_like trim : boolean, optional When True, trailing zeros are removed from the inputs. When False, the inputs are passed through intact.
Returns
a1, a2,... : 1-D arrays A copy of the input data as 1-d arrays.
Source code in jaxquantum/utils/hermgauss.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | |
comb(N, k)
NCk
TODO: replace with jsp.special.comb once issue is closed:
https://github.com/google/jax/issues/9709
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
N
|
total items |
required | |
k
|
of items to choose |
required |
Returns:
| Name | Type | Description |
|---|---|---|
NCk |
N choose k |
Source code in jaxquantum/utils/utils.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | |
hermcompanion(c)
Return the scaled companion matrix of c.
The basis polynomials are scaled so that the companion matrix is
symmetric when c is an Hermite basis polynomial. This provides
better eigenvalue estimates than the unscaled case and for basis
polynomials the eigenvalues are guaranteed to be real if
jax.numpy.linalg.eigvalsh is used to obtain them.
Parameters
c : array_like 1-D array of Hermite series coefficients ordered from low to high degree.
Returns
mat : ndarray Scaled companion matrix of dimensions (deg, deg).
Source code in jaxquantum/utils/hermgauss.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | |
inductance_to_inductive_energy(L)
Convert inductance to inductive energy E_L.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
L
|
float
|
Inductance in nH. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
Inductive energy in GHz. |
Source code in jaxquantum/utils/units.py
57 58 59 60 61 62 63 64 65 66 67 68 69 | |
inductive_energy_to_inductance(El)
Convert inductive energy E_L to inductance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
El
|
float
|
inductive energy in GHz. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
Inductance in nH. |
Source code in jaxquantum/utils/units.py
44 45 46 47 48 49 50 51 52 53 54 55 | |
inv_pF_to_Ec(inv_pfarad)
1/picoFarad -> GHz
Source code in jaxquantum/utils/units.py
72 73 74 75 76 77 78 | |
n_thermal(frequency, temperature)
Calculate the average thermal photon number for a given frequency and temperature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frequency
|
float
|
Frequency in GHz. |
required |
temperature
|
float
|
Temperature in Kelvin. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Average thermal photon number. |
Source code in jaxquantum/utils/units.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
set_precision(precision)
Set the precision of JAX operations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
precision
|
Literal['single', 'double']
|
'single' or 'double' |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
if precision is not 'single' or 'double' |
Source code in jaxquantum/utils/utils.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | |