fcdmft.utils.arraymath module#

fcdmft.utils.arraymath.array_scale(arr, alpha)[source]#

Scale an array in place by a scalar with BLAS if possible.

Parameters:
arrarray_like

Array to be scaled.

alphascalar

Scale factor.

Returns:
arrndarray

Scaled array equal to alpha * arr.

fcdmft.utils.arraymath.diag_array_view(arr)[source]#

Returns a view of the diagonal of a N-d array.

Parameters:
arr(…, M, M) array_like

Input array.

Returns:
diag(…, M) ndarray

View of the diagonal of the input array.

fcdmft.utils.arraymath.get_id_minus_pi(Pi)[source]#

Calculate I - Pi in place.

Parameters:
Pi(M, M) array_like

Input matrix. Must be C-contiguous.

Returns:
id_minus_pi(M, M) ndarray

(I - Pi)

fcdmft.utils.arraymath.get_pi_inv(Pi, overwrite_input=False)[source]#

Calculate (I - Pi)^-1 - I.

Parameters:
Pi(M, M) array_like

Input matrix. Must be C-contiguous.

Returns:
Pi_inv(M, M) ndarray

(I - Pi)^-1 - I.

fcdmft.utils.arraymath.mkslice(l)[source]#

Try to make a slice from a list of integers. If this is not possible, return the input unchanged.

Parameters:
lslice | list | range | ndarray

Various ways of representing a list of integer indices

Returns:
slice | list | ndarray

slice if possible, otherwise returns the input unchanged