pyscf.pbc.lib package#
Submodules#
pyscf.pbc.lib.arnoldi module#
Extension to scipy.linalg module developed for PBC branch.
pyscf.pbc.lib.chkfile module#
- pyscf.pbc.lib.chkfile.load_cell(chkfile)[source]#
Load Cell object from chkfile.
- Args:
- chkfilestr
Name of chkfile.
- Returns:
An (initialized/built) Cell object
Examples:
>>> from pyscf.pbc import gto, scf >>> cell = gto.Cell() >>> cell.build(atom='He 0 0 0') >>> scf.chkfile.save_cell(cell, 'He.chk') >>> scf.chkfile.load_cell('He.chk') <pyscf.pbc.gto.cell.Cell object at 0x7fdcd94d7f50>
pyscf.pbc.lib.kpts module#
- class pyscf.pbc.lib.kpts.KPoints(cell=None, kpts=array([[0., 0., 0.]]))[source]#
Bases:
Symmetry
,StreamObject
A symmetry object which handles k-point symmetry.
Parameters#
- cell
Cell
instance Unit cell information.
- kpts(nkpts,3) ndarray
K-points in full BZ.
Examples#
>>> cell = gto.M( ... atom = '''He 0. 0. 0.''', ... a = numpy.eye(3)*2.0).build() >>> kpts = KPoints(cell, numpy.array([[0.,0.,0.],[0.5,0.,0.],[0.,0.5,0.],[0.,0.,0.5]])) >>> kpts.build(space_group_symmetry=True) >>> print(kpts.kpts_ibz) [[0. 0. 0. ] [0. 0. 0.5]]
Attributes#
- cell
Cell
instance Unit cell information.
- verboseint
Print level. Default value is
cell.verbose
.- time_reversalbool
Whether to consider time-reversal symmetry. For systems with inversion symmetry, time-reversal symmetry is not considered unless spin-orbit coupling is present.
- kpts(nkpts,3) ndarray
K-points in full BZ.
- kpts_scaled(nkpts,3) ndarray
Scaled k-points in full BZ.
- weights(nkpts,) ndarray
Weights of k-points in full BZ.
- bz2ibz(nkpts,) ndarray of int
Mapping table from full BZ to IBZ.
- kpts_ibz(nkpts_ibz,3) ndarray
K-points in IBZ.
- kpts_scaled_ibz(nkpts_ibz,3) ndarray
Scaled k-points in IBZ.
- weights_ibz(nkpts_ibz,) ndarray
Weights of k-points in IBZ.
- ibz2bz(nkpts_ibz,) ndarray of int
Mapping table from IBZ to full BZ.
- k2opk (bz2bz_ks)(nkpts, nop*(time_reversal+1)) ndarray of int
Mapping table between kpts and ops.rot * kpts.
- starslist of (nk,) ndarrays of int
Stars of k-points in full BZ with len(stars) = nkpts_ibz and
nk
is the number of symmetry-related k-points for each k-point in IBZ.- stars_opssame as
stars
Indices of rotation operators connecting k points in full BZ and in IBZ.
- stars_ops_bz(nkpts,) ndarray of int
Same as stars_ops but arranged in the sequence of k-points in full BZ.
- time_reversal_symm_bz(nkpts,) ndarray of int
Whether k-points in BZ and IBZ are related in addition by time-reversal symmetry.
- property addition_table#
- check_mo_occ_symmetry(mo_occ, tol=1e-05)#
Check if MO occupations in full BZ have the correct symmetry. If not, raise error; else, return MO occupations in IBZ.
Parameters#
kpts :
KPoints
object mo_occ : list of (nmo,) ndarrayMO occupations for k-points in full BZ. len(mo_occ) = nkpts
- tolfloat
Occupations differ less than
tol
are considered as the same. Default is 1e-5.
Returns#
- mo_occ_ibzlist of (nmo,) ndarray
MO occupations for k-points in IBZ. len(mo_occ_ibz) = nkpts_ibz
Raises#
- RuntimeError
If symmetry is broken.
- dm_at_ref_cell(dm_ibz)#
Given the density matrices in IBZ, compute the reference cell density matrix.
Parameters#
kpts :
KPoints
object dm_ibz : ([2,] nkpts_ibz, nao, nao) ndarrayDensity matrices for k-points in IBZ.
Returns#
- dm0([2,] nao, nao) ndarray
Density matrix at reference cell.
- get_rotation_mat_for_mos(mo_coeff, ovlp, k1, k2, ops_id=None)#
Rotation matrices for rotating MO[k1] to MO[k2].
- Args:
- kpts
KPoints
instance K-point object.
- mo_coeffarray
MO coefficients.
- ovlparray
Overlap matrix in AOs.
- k1array like
Indices of the original k-points in the BZ.
- k2array like
Indices of the target k-points in the BZ.
- ops_idlist, optional
Indices of space group operations. If not given, all the rotations are considered.
- kpts
- Returns:
- outlist
Rotation matrices.
- property inverse_table#
- make_gdf_kptij_lst_jk()[source]#
Build GDF k-point-pair list for get_jk All combinations:
k_ibz != k_bz k_bz == k_bz
- make_k4_ibz(sym='s1', return_ops=False)#
- make_kpts_ibz(tol=1e-06)#
Locate k-points in IBZ.
Parameters#
kpts :
KPoints
objectNotes#
This function modifies the
kpts
object.
- make_ktuples_ibz(kpts_scaled=None, ntuple=2, tol=1e-06)#
Constructe k-point tuples in IBZ.
Parameters#
kpts :
KPoints
object kpts_scaled : (nkpts, ntuple, 3) ndarrayInput k-points among which symmetry relations are seeked. Default is None, meaning all the k-points in
kpts
are considered.- ntupleint
Dimension of the tuples. Default is 2.
- tolfloat
K-points differ by
tol
are considered as different. Default is 1e-6.
Returns#
- ibz2bz(nibz,) ndarray of int
Mapping table from IBZ to full BZ.
- weight_ibz(nibz,) ndarray of int
Weights of each k-point tuple in the IBZ.
- bz2ibz(nkpts**ntuple,) ndarray of int
Mapping table from full BZ to IBZ.
- starslist of (nibz,) ndarrays of int
Similar as
stars
.- stars_opslist of (nibz,) ndarrays of int
Similar as
stars_ops
.- stars_ops_bz(nkpts**ntuple,) ndarray of int
Similar as
stars_ops_bz
.
- property nkpts#
- property nkpts_ibz#
- symmetrize_density(rhoR_k, ibz_k_idx, mesh)#
Transform real-space densities from IBZ to full BZ
- symmetrize_wavefunction(psiR_k, mesh)#
transform real-space wavefunctions from IBZ to full BZ
- transform_1e_operator(fock_ibz)#
Transform 1-electron operator from IBZ to full BZ.
Parameters#
kpts :
KPoints
object fock_ibz : ([2,] nkpts_ibz, nao, nao) ndarrayFock-like matrices for k-points in IBZ.
Returns#
- fock_bz([2,] nkpts, nao, nao) ndarray
Fock-like matrices for k-points in full BZ.
- transform_dm(dm_ibz)#
Transform density matrices from IBZ to full BZ.
Parameters#
kpts :
KPoints
object dm_ibz : ([2,] nkpts_ibz, nao, nao) ndarrayDensity matrices for k-points in IBZ.
Returns#
- dm_bz([2,] nkpts, nao, nao) ndarray
Density matrices for k-points in full BZ.
- transform_fock(fock_ibz)#
Transform 1-electron operator from IBZ to full BZ.
Parameters#
kpts :
KPoints
object fock_ibz : ([2,] nkpts_ibz, nao, nao) ndarrayFock-like matrices for k-points in IBZ.
Returns#
- fock_bz([2,] nkpts, nao, nao) ndarray
Fock-like matrices for k-points in full BZ.
- transform_mo_coeff(mo_coeff_ibz)#
Transform MO coefficients from IBZ to full BZ.
Parameters#
kpts :
KPoints
object mo_coeff_ibz : ([2,] nkpts_ibz, nao, nmo) ndarrayMO coefficients for k-points in IBZ.
Returns#
- mo_coeff_bz([2,] nkpts, nao, nmo) ndarray
MO coefficients for k-points in full BZ.
- transform_mo_energy(mo_energy_ibz)#
Transform MO energies from IBZ to full BZ
- transform_mo_occ(mo_occ_ibz)#
Transform MO occupations from IBZ to full BZ
- transform_single_mo_coeff(mo_coeff_ibz, k)#
Get MO coefficients for a single k-point in full BZ.
Parameters#
kpts :
KPoints
object mo_coeff_ibz : (nkpts_ibz, nao, nmo) ndarrayMO coefficients for k-points in IBZ.
- kint
Index of the k-point in full BZ.
Returns#
- mo_coeff_bz(nao, nmo) ndarray
MO coefficients for the
k
-th k-point in full BZ.
- cell
- class pyscf.pbc.lib.kpts.KQuartets(kpts)[source]#
Bases:
object
The class holding the symmetry relations between k-quartets.
- class pyscf.pbc.lib.kpts.MORotationMatrix(kpts, mo_coeff, ovlp, nocc, nmo)[source]#
Bases:
object
The class holding the rotation matrices that transform MOs from one k-point to another.
- pyscf.pbc.lib.kpts.check_mo_occ_symmetry(kpts, mo_occ, tol=1e-05)[source]#
Check if MO occupations in full BZ have the correct symmetry. If not, raise error; else, return MO occupations in IBZ.
Parameters#
kpts :
KPoints
object mo_occ : list of (nmo,) ndarrayMO occupations for k-points in full BZ. len(mo_occ) = nkpts
- tolfloat
Occupations differ less than
tol
are considered as the same. Default is 1e-5.
Returns#
- mo_occ_ibzlist of (nmo,) ndarray
MO occupations for k-points in IBZ. len(mo_occ_ibz) = nkpts_ibz
Raises#
- RuntimeError
If symmetry is broken.
- pyscf.pbc.lib.kpts.dm_at_ref_cell(kpts, dm_ibz)[source]#
Given the density matrices in IBZ, compute the reference cell density matrix.
Parameters#
kpts :
KPoints
object dm_ibz : ([2,] nkpts_ibz, nao, nao) ndarrayDensity matrices for k-points in IBZ.
Returns#
- dm0([2,] nao, nao) ndarray
Density matrix at reference cell.
- pyscf.pbc.lib.kpts.get_rotation_mat_for_mos(kpts, mo_coeff, ovlp, k1, k2, ops_id=None)[source]#
Rotation matrices for rotating MO[k1] to MO[k2].
- Args:
- kpts
KPoints
instance K-point object.
- mo_coeffarray
MO coefficients.
- ovlparray
Overlap matrix in AOs.
- k1array like
Indices of the original k-points in the BZ.
- k2array like
Indices of the target k-points in the BZ.
- ops_idlist, optional
Indices of space group operations. If not given, all the rotations are considered.
- kpts
- Returns:
- outlist
Rotation matrices.
- pyscf.pbc.lib.kpts.make_kpts(cell, kpts=array([[0., 0., 0.]]), space_group_symmetry=False, time_reversal_symmetry=False, **kwargs)[source]#
A wrapper function to build the
KPoints
object.Parameters#
- cell
Cell
instance Unit cell information.
- kpts(nkpts,3) ndarray
K-points in full BZ.
- space_group_symmetrybool
Whether to consider space group symmetry. Default is False.
- time_reversal_symmetrybool
Whether to consider time reversal symmetry. Default is False.
Examples#
>>> cell = gto.M( ... atom = '''He 0. 0. 0.''', ... a = numpy.eye(3)*2.0).build() >>> kpts = make_kpts(cell, ... numpy.array([[0.,0.,0.], ... [0.5,0.,0.], ... [0.,0.5,0.], ... [0.,0.,0.5]]), ... space_group_symmetry=True) >>> print(kpts.kpts_ibz) [[0. 0. 0. ] [0. 0. 0.5]]
- cell
- pyscf.pbc.lib.kpts.make_kpts_ibz(kpts, tol=1e-06)[source]#
Locate k-points in IBZ.
Parameters#
kpts :
KPoints
objectNotes#
This function modifies the
kpts
object.
- pyscf.pbc.lib.kpts.make_ktuples_ibz(kpts, kpts_scaled=None, ntuple=2, tol=1e-06)[source]#
Constructe k-point tuples in IBZ.
Parameters#
kpts :
KPoints
object kpts_scaled : (nkpts, ntuple, 3) ndarrayInput k-points among which symmetry relations are seeked. Default is None, meaning all the k-points in
kpts
are considered.- ntupleint
Dimension of the tuples. Default is 2.
- tolfloat
K-points differ by
tol
are considered as different. Default is 1e-6.
Returns#
- ibz2bz(nibz,) ndarray of int
Mapping table from IBZ to full BZ.
- weight_ibz(nibz,) ndarray of int
Weights of each k-point tuple in the IBZ.
- bz2ibz(nkpts**ntuple,) ndarray of int
Mapping table from full BZ to IBZ.
- starslist of (nibz,) ndarrays of int
Similar as
stars
.- stars_opslist of (nibz,) ndarrays of int
Similar as
stars_ops
.- stars_ops_bz(nkpts**ntuple,) ndarray of int
Similar as
stars_ops_bz
.
- pyscf.pbc.lib.kpts.map_k_points_fast(kpts_scaled, ops, tol=1e-06)[source]#
Find symmetry-related k-points.
Parameters#
- kpts_scaled(nkpts, 3) ndarray
Scaled k-points.
- ops(nop, 3, 3) ndarray of int
Rotation operators.
- tolfloat
K-points differ by
tol
are considered as different. Default is 1e-6.
Returns#
- bz2bz_ks(nkpts, nop) ndarray of int
mapping table between k and op*k. bz2bz_ks[k1,s] = k2 if ops[s] * kpts_scaled[k1] = kpts_scaled[k2] + K, where K is a reciprocal lattice vector.
- pyscf.pbc.lib.kpts.map_kpts_tuples(kpts_scaled, ops, ntuple=2, tol=1e-06)[source]#
Find symmetry-related k-point tuples.
Parameters#
- kpts_scaled(nkpts, ntuple, 3) ndarray
Scaled k-point tuples.
- ops(nop, 3, 3) ndarray of int
Rotation operators.
- ntupleint
Dimension of tuples. Default is 2.
- tolfloat
K-points differ less than
tol
are considered as the same. Default is 1e-6.
Returns#
- bz2bz_ks(nkpts, nop) ndarray of int
mapping table between k and op*k. bz2bz_ks[k1,s] = k2 if ops[s] * kpts_scaled[k1] = kpts_scaled[k2] + K, where K is a reciprocal lattice vector.
- pyscf.pbc.lib.kpts.symmetrize_density(kpts, rhoR_k, ibz_k_idx, mesh)[source]#
Transform real-space densities from IBZ to full BZ
- pyscf.pbc.lib.kpts.symmetrize_wavefunction(kpts, psiR_k, mesh)[source]#
transform real-space wavefunctions from IBZ to full BZ
- pyscf.pbc.lib.kpts.transform_1e_operator(kpts, fock_ibz)[source]#
Transform 1-electron operator from IBZ to full BZ.
Parameters#
kpts :
KPoints
object fock_ibz : ([2,] nkpts_ibz, nao, nao) ndarrayFock-like matrices for k-points in IBZ.
Returns#
- fock_bz([2,] nkpts, nao, nao) ndarray
Fock-like matrices for k-points in full BZ.
- pyscf.pbc.lib.kpts.transform_dm(kpts, dm_ibz)[source]#
Transform density matrices from IBZ to full BZ.
Parameters#
kpts :
KPoints
object dm_ibz : ([2,] nkpts_ibz, nao, nao) ndarrayDensity matrices for k-points in IBZ.
Returns#
- dm_bz([2,] nkpts, nao, nao) ndarray
Density matrices for k-points in full BZ.
- pyscf.pbc.lib.kpts.transform_fock(kpts, fock_ibz)#
Transform 1-electron operator from IBZ to full BZ.
Parameters#
kpts :
KPoints
object fock_ibz : ([2,] nkpts_ibz, nao, nao) ndarrayFock-like matrices for k-points in IBZ.
Returns#
- fock_bz([2,] nkpts, nao, nao) ndarray
Fock-like matrices for k-points in full BZ.
- pyscf.pbc.lib.kpts.transform_mo_coeff(kpts, mo_coeff_ibz)[source]#
Transform MO coefficients from IBZ to full BZ.
Parameters#
kpts :
KPoints
object mo_coeff_ibz : ([2,] nkpts_ibz, nao, nmo) ndarrayMO coefficients for k-points in IBZ.
Returns#
- mo_coeff_bz([2,] nkpts, nao, nmo) ndarray
MO coefficients for k-points in full BZ.
- pyscf.pbc.lib.kpts.transform_mo_coeff_k(kpts, mo_coeff_ibz, k)[source]#
Get MO coefficients for a single k-point in full BZ.
Parameters#
kpts :
KPoints
object mo_coeff_ibz : (nkpts_ibz, nao, nmo) ndarrayMO coefficients for k-points in IBZ.
- kint
Index of the k-point in full BZ.
Returns#
- mo_coeff_bz(nao, nmo) ndarray
MO coefficients for the
k
-th k-point in full BZ.
- pyscf.pbc.lib.kpts.transform_mo_energy(kpts, mo_energy_ibz)[source]#
Transform MO energies from IBZ to full BZ
- pyscf.pbc.lib.kpts.transform_mo_occ(kpts, mo_occ_ibz)[source]#
Transform MO occupations from IBZ to full BZ
- pyscf.pbc.lib.kpts.transform_single_mo_coeff(kpts, mo_coeff_ibz, k)#
Get MO coefficients for a single k-point in full BZ.
Parameters#
kpts :
KPoints
object mo_coeff_ibz : (nkpts_ibz, nao, nmo) ndarrayMO coefficients for k-points in IBZ.
- kint
Index of the k-point in full BZ.
Returns#
- mo_coeff_bz(nao, nmo) ndarray
MO coefficients for the
k
-th k-point in full BZ.
pyscf.pbc.lib.kpts_helper module#
- class pyscf.pbc.lib.kpts_helper.KptsHelper(cell, kpts, init_symm_map=True)[source]#
Bases:
StreamObject
- class pyscf.pbc.lib.kpts_helper.VectorSplitter(vector)[source]#
Bases:
object
- pyscf.pbc.lib.kpts_helper.check_kpt_antiperm_symmetry(array, idx1, idx2, tolerance=1e-08)[source]#
Checks antipermutational symmetry for k-point array.
Checks whether an array with k-point symmetry has antipermutational symmetry with respect to switching the particle indices idx1, idx2. The particle indices switches both the orbital index and k-point index associated with the two indices.
- Note:
One common reason for not obeying antipermutational symmetry in a calculation involving FFTs is that the grid to perform the FFT may be too coarse. This symmetry is present in operators in spin-orbital form and ‘spin-free’ operators.
- array (
ndarray
): array to test permutational symmetry, where for an n-particle array, the first (2n-1) array elements are kpoint indices while the final 2n array elements are orbital indices.
idx1 (int): first index idx2 (int): second index
- Examples:
- For a 3-particle array, such as the T3 amplitude
t3[ki, kj, kk, ka, kb, i, j, a, b, c],
setting idx1 = 0 and idx2 = 1 would switch the orbital indices i, j as well as the kpoint indices ki, kj.
>>> nkpts, nocc, nvir = 3, 4, 5 >>> t2 = numpy.random.random_sample((nkpts, nkpts, nkpts, nocc, nocc, nvir, nvir)) >>> t2 = t2 + t2.transpose(1,0,2,4,3,5,6) >>> check_kpt_antiperm_symmetry(t2, 0, 1) True
- pyscf.pbc.lib.kpts_helper.conj_mapping(cell, kpts)[source]#
Find the mapping index: -kpts = kpts[index]
- pyscf.pbc.lib.kpts_helper.gamma_point(kpt)#
- pyscf.pbc.lib.kpts_helper.get_kconserv(cell, kpts)[source]#
Get the momentum conservation array for a set of k-points.
Given k-point indices (k, l, m) the array kconserv[k,l,m] returns the index n that satisfies momentum conservation,
(k(k) - k(l) + k(m) - k(n)) dot a = 2npi
- This is used for symmetry e.g. integrals of the form
[phi*[k](1) phi[l](1) | phi*[m](2) phi[n](2)]
are zero unless n satisfies the above.
- pyscf.pbc.lib.kpts_helper.get_kconserv3(cell, kpts, kijkab)[source]#
Get the momentum conservation array for a set of k-points.
This function is similar to get_kconserv, but instead finds the ‘kc’ that satisfies momentum conservation for 5 k-points,
(ki + kj + kk - ka - kb - kc) dot a = 2npi
where these kpoints are stored in kijkab[ki, kj, kk, ka, kb].
- pyscf.pbc.lib.kpts_helper.get_kconserv_ria(cell, kpts)[source]#
Get the momentum conservation array for single excitation amplitudes for a set of k-points with appropriate k-shift.
Given k-point indices m the array kconserv[kshift,m] returns the index n that satisfies a shifted momentum conservation,
(k(m) - k(n) - k(kshift)) dot a = 2npi
- This is used in CIS/EOM-CCSD where the single excitation amplitudes
r_{i k(m)}^{a k(n)}
are zero unless n satisfies the above.
- pyscf.pbc.lib.kpts_helper.group_by_conj_pairs(cell, kpts, wrap_around=True, return_kpts_pairs=True)[source]#
Find all conjugation k-point pairs in the input kpts. This function lables three types of conjugation. 1. self-conjugated. The two index in idx_pairs have the same value. 2. conjugated to the k-point within the input kpts. The indices of conjugated k-points are held in idx_pairs. 3. conjugated to the k-point not inside the input kpts. The record is (index, None).
- pyscf.pbc.lib.kpts_helper.intersection(kpts1, kpts2)[source]#
Return the indices of the common k-points in kpts1
- pyscf.pbc.lib.kpts_helper.is_gamma_point(kpt)#
- pyscf.pbc.lib.kpts_helper.kk_adapted_iter(cell, kpts, kk_idx=None, time_reversal_symmetry=True)[source]#
Generates kpt which is adapted to the kpt_p in (ij|p)
- pyscf.pbc.lib.kpts_helper.member(kpt, kpts)[source]#
Return the indices of the common k-points in kpts
- pyscf.pbc.lib.kpts_helper.members_with_wrap_around(cell, kpts, test_kpts)[source]#
Search the indices of kpts in first Brillouin zone. [where(k==test_kpts) for k in kpts]
- kptsarray_like
kpts to index
- test_kptsarray_like
The values against which to index each value of kpts.
- pyscf.pbc.lib.kpts_helper.round_to_fbz(kpts, wrap_around=False, tol=1e-06)[source]#
Round scaled k-points to the first Brillouin zone.
- Args:
- kpts(…,3) ndarray
Scaled k-points.
- wrap_aroundbool
If set to True, k-points are rounded to [-0.5, 0.5), otherwise [0.0, 1.0). Default value is False.
- tolfloat
K-points differ less than tol are considered as the same. Default value is 1e-6.
pyscf.pbc.lib.ktensor module#
- class pyscf.pbc.lib.ktensor.KsymmArray(subarray_shape, dtype=<class 'float'>, subarray_order='C', metadata={}, init_with_zeros=False)[source]#
Bases:
NDArrayOperatorsMixin
- property dtype#
- property ndim#
- property shape#
- property subarray_ndim#
- property subarray_order#
- property subarray_shape#
- pyscf.pbc.lib.ktensor.fromdense(arr, shape, dtype=None, order=None, metadata=None)#
- pyscf.pbc.lib.ktensor.fromraw(arr, shape, dtype=None, order=None, metadata=None)#
- pyscf.pbc.lib.ktensor.zeros(shape, dtype=<class 'float'>, order='C', metadata=None)#
pyscf.pbc.lib.linalg_helper module#
Extension to scipy.linalg module developed for PBC branch.
- class pyscf.pbc.lib.linalg_helper.Arnoldi(matr_multiply, xStart, inPreCon, nroots=1, tol=1e-10)[source]#
Bases:
object
- pyscf.pbc.lib.linalg_helper.davidson(mult_by_A, N, neig, x0=None, Adiag=None, verbose=4)[source]#
Diagonalize a matrix via non-symmetric Davidson algorithm.
- mult_by_A() is a function which takes a vector of length N
and returns a vector of length N.
neig is the number of eigenvalues requested
- pyscf.pbc.lib.linalg_helper.davidson_guess(mult_by_A, N, neig, Adiag=None)[source]#
Diagonalize a matrix via non-symmetric Davidson algorithm.
- mult_by_A() is a function which takes a vector of length N
and returns a vector of length N.
neig is the number of eigenvalues requested
Targets the first nroots closest in amplitude to the first nroots of the basis. This is useful for the QP peaks in IP/EA.
- pyscf.pbc.lib.linalg_helper.diagonalize_asymm(H)[source]#
Diagonalize a real, asymmetric matrix and return sorted results.
Return the eigenvalues and eigenvectors (column matrix) sorted from lowest to highest eigenvalue.