ergo
|
Utilities related to the hierarchical matrix library (HML), including functions for setting up permutations of basis functions to increase data locality in the hierarchical matrix data structure. More...
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include "matrix_utilities.h"
#include "output.h"
Classes | |
struct | CompareClass< RandomAccessIterator > |
Functions | |
mat::SizesAndBlocks | prepareMatrixSizesAndBlocks (int n_basis_functions, int sparse_block_size, int factor1, int factor2, int factor3) |
template<typename Treal , typename TIndexIterator > | |
void | sortCoord (std::vector< Treal > const &xpos, std::vector< Treal > const &ypos, std::vector< Treal > const &zpos, TIndexIterator first, TIndexIterator last) |
template<typename Treal > | |
void | permuteAndRecurse (std::vector< Treal > const &xpos, std::vector< Treal > const &ypos, std::vector< Treal > const &zpos, std::vector< int > &index, int const first, int const last, std::vector< int > const &blockSizes, int bSizeIndex) |
template<typename Treal > | |
void | permuteAndRecurseStart (std::vector< Treal > const &xpos, std::vector< Treal > const &ypos, std::vector< Treal > const &zpos, std::vector< int > &index, int const first, int const last, std::vector< int > const &blockSizes, int bSizeIndex) |
template<typename Treal > | |
void | getPermutation (std::vector< Treal > const &xpos, std::vector< Treal > const &ypos, std::vector< Treal > const &zpos, std::vector< int > &permutation, std::vector< int > const &blockSizes) |
void | getMatrixPermutation (const BasisInfoStruct &basisInfo, int sparse_block_size, int factor1, int factor2, int factor3, std::vector< int > &permutation, std::vector< int > &inversePermutation) |
void | getMatrixPermutation (const BasisInfoStruct &basisInfo, int sparse_block_size, int factor1, int factor2, int factor3, std::vector< int > &permutation) |
void | getMatrixPermutationOnlyFactor2 (const std::vector< ergo_real > &xcoords, const std::vector< ergo_real > &ycoords, const std::vector< ergo_real > &zcoords, int sparse_block_size_lowest, int first_factor_in, std::vector< int > &permutation, std::vector< int > &inversePermutation) |
void | getMatrixPermutationOnlyFactor2 (const BasisInfoStruct &basisInfo, int sparse_block_size_lowest, int first_factor, std::vector< int > &permutation, std::vector< int > &inversePermutation) |
void | fill_matrix_with_random_numbers (int n, symmMatrix &M) |
static ergo_real | rand_minus1_to_1 () |
void | add_random_diag_perturbation (int n, symmMatrix &M, ergo_real eps) |
bool | check_if_matrix_contains_strange_elements (const symmMatrix &M, std::vector< int > const &inversePermutationHML) |
This function is supposed to check if a matrix contains any strange numbers such as "inf" or "nan". More... | |
void | output_matrix (int n, const ergo_real *matrix, const char *matrixName) |
Utilities related to the hierarchical matrix library (HML), including functions for setting up permutations of basis functions to increase data locality in the hierarchical matrix data structure.
void add_random_diag_perturbation | ( | int | n, |
symmMatrix & | M, | ||
ergo_real | eps | ||
) |
References rand_minus1_to_1().
bool check_if_matrix_contains_strange_elements | ( | const symmMatrix & | M, |
std::vector< int > const & | inversePermutationHML | ||
) |
This function is supposed to check if a matrix contains any strange numbers such as "inf" or "nan".
The function returns true is any strange numbers are found, and false if the matrix seems ok.
Referenced by SCF_restricted::get_2e_part_and_energy().
void fill_matrix_with_random_numbers | ( | int | n, |
symmMatrix & | M | ||
) |
void getMatrixPermutation | ( | const BasisInfoStruct & | basisInfo, |
int | sparse_block_size, | ||
int | factor1, | ||
int | factor2, | ||
int | factor3, | ||
std::vector< int > & | permutation | ||
) |
References getMatrixPermutation().
void getMatrixPermutation | ( | const BasisInfoStruct & | basisInfo, |
int | sparse_block_size, | ||
int | factor1, | ||
int | factor2, | ||
int | factor3, | ||
std::vector< int > & | permutation, | ||
std::vector< int > & | inversePermutation | ||
) |
References BasisInfoStruct::basisFuncList, BasisFuncStruct::centerCoords, do_output(), getPermutation(), LOG_AREA_UNDEFINED, LOG_CAT_INFO, and BasisInfoStruct::noOfBasisFuncs.
Referenced by calculation_shared(), getMatrixPermutation(), load_density_and_project_sparse(), main(), SCF::MatOptions::prepare(), preparePermutations(), and preparePermutationsHML().
void getMatrixPermutationOnlyFactor2 | ( | const BasisInfoStruct & | basisInfo, |
int | sparse_block_size_lowest, | ||
int | first_factor, | ||
std::vector< int > & | permutation, | ||
std::vector< int > & | inversePermutation | ||
) |
void getMatrixPermutationOnlyFactor2 | ( | const std::vector< ergo_real > & | xcoords, |
const std::vector< ergo_real > & | ycoords, | ||
const std::vector< ergo_real > & | zcoords, | ||
int | sparse_block_size_lowest, | ||
int | first_factor_in, | ||
std::vector< int > & | permutation, | ||
std::vector< int > & | inversePermutation | ||
) |
References do_output(), getPermutation(), LOG_AREA_UNDEFINED, and LOG_CAT_INFO.
Referenced by create_mtx_files_with_different_orderings(), and getMatrixPermutationOnlyFactor2().
void getPermutation | ( | std::vector< Treal > const & | xpos, |
std::vector< Treal > const & | ypos, | ||
std::vector< Treal > const & | zpos, | ||
std::vector< int > & | permutation, | ||
std::vector< int > const & | blockSizes | ||
) |
References permuteAndRecurse().
Referenced by getMatrixPermutation(), and getMatrixPermutationOnlyFactor2().
void output_matrix | ( | int | n, |
const ergo_real * | matrix, | ||
const char * | matrixName | ||
) |
Referenced by dft_get_uxc(), and dft_get_xc().
void permuteAndRecurse | ( | std::vector< Treal > const & | xpos, |
std::vector< Treal > const & | ypos, | ||
std::vector< Treal > const & | zpos, | ||
std::vector< int > & | index, | ||
int const | first, | ||
int const | last, | ||
std::vector< int > const & | blockSizes, | ||
int | bSizeIndex | ||
) |
References sortCoord().
Referenced by getPermutation(), and permuteAndRecurseStart().
void permuteAndRecurseStart | ( | std::vector< Treal > const & | xpos, |
std::vector< Treal > const & | ypos, | ||
std::vector< Treal > const & | zpos, | ||
std::vector< int > & | index, | ||
int const | first, | ||
int const | last, | ||
std::vector< int > const & | blockSizes, | ||
int | bSizeIndex | ||
) |
References permuteAndRecurse(), and sortCoord().
mat::SizesAndBlocks prepareMatrixSizesAndBlocks | ( | int | n_basis_functions, |
int | sparse_block_size, | ||
int | factor1, | ||
int | factor2, | ||
int | factor3 | ||
) |
References do_output(), LOG_AREA_UNDEFINED, and LOG_CAT_INFO.
Referenced by calculation_shared(), get_dipole_moment_fullmat(), load_density_and_project_sparse(), main(), SCF::MatOptions::prepare(), preparePermutations(), and preparePermutationsHML().
|
static |
Referenced by add_random_diag_perturbation().
void sortCoord | ( | std::vector< Treal > const & | xpos, |
std::vector< Treal > const & | ypos, | ||
std::vector< Treal > const & | zpos, | ||
TIndexIterator | first, | ||
TIndexIterator | last | ||
) |
Referenced by permuteAndRecurse(), and permuteAndRecurseStart().