ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
Functions
basic_funcs.h File Reference
#include <cmath>
#include <vector>
#include <ostream>
#include "source_base/vector3.h"
Include dependency graph for basic_funcs.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

double maxval_abs_2d (const std::vector< ModuleBase::Vector3< double > > &array)
 Find the maximum absolute value in a 2D array.
 
std::pair< int, int > maxloc_abs_2d (const std::vector< ModuleBase::Vector3< double > > &array)
 Find the maximum absolute value in a 2D array and its index.
 
template<typename T >
T sum_2d (const std::vector< ModuleBase::Vector3< T > > &array)
 sum of all elements in a 2D array.
 
void scalar_multiply_2d (const std::vector< ModuleBase::Vector3< double > > &array, double scalar, std::vector< ModuleBase::Vector3< double > > &result)
 scalar multiply a 2D array.
 
void add_scalar_multiply_2d (const std::vector< ModuleBase::Vector3< double > > &array_1, const std::vector< ModuleBase::Vector3< double > > &array_2, double scalar, std::vector< ModuleBase::Vector3< double > > &result)
 array_1 + scalar * array_2.
 
void subtract_2d (const std::vector< ModuleBase::Vector3< double > > &array_1, const std::vector< ModuleBase::Vector3< double > > &array_2, std::vector< ModuleBase::Vector3< double > > &result)
 array_1 - array_2.
 
void fill_scalar_2d (double scalar, std::vector< ModuleBase::Vector3< double > > &result)
 fill a 2D array with a scalar.
 
void where_fill_scalar_2d (const std::vector< ModuleBase::Vector3< int > > &array_mask, int mask, double scalar, std::vector< ModuleBase::Vector3< double > > &result)
 fill a 2D array with a scalar if the corresponding element is equal to mask.
 
void where_fill_scalar_else_2d (const std::vector< ModuleBase::Vector3< int > > &array_mask, int mask, double scalar, const std::vector< ModuleBase::Vector3< double > > &rest, std::vector< ModuleBase::Vector3< double > > &result)
 
void print_2d (const std::string info, const std::vector< ModuleBase::Vector3< double > > &array, const int nspin, const double unit_convert=1.0, std::ostream &ofs=std::cout)
 

Function Documentation

◆ add_scalar_multiply_2d()

void add_scalar_multiply_2d ( const std::vector< ModuleBase::Vector3< double > > &  array_1,
const std::vector< ModuleBase::Vector3< double > > &  array_2,
double  scalar,
std::vector< ModuleBase::Vector3< double > > &  result 
)

array_1 + scalar * array_2.

Here is the caller graph for this function:

◆ fill_scalar_2d()

void fill_scalar_2d ( double  scalar,
std::vector< ModuleBase::Vector3< double > > &  result 
)

fill a 2D array with a scalar.

Here is the caller graph for this function:

◆ maxloc_abs_2d()

std::pair< int, int > maxloc_abs_2d ( const std::vector< ModuleBase::Vector3< double > > &  array)

Find the maximum absolute value in a 2D array and its index.

Here is the caller graph for this function:

◆ maxval_abs_2d()

double maxval_abs_2d ( const std::vector< ModuleBase::Vector3< double > > &  array)

Find the maximum absolute value in a 2D array.

Here is the caller graph for this function:

◆ print_2d()

void print_2d ( const std::string  info,
const std::vector< ModuleBase::Vector3< double > > &  array,
const int  nspin,
const double  unit_convert = 1.0,
std::ostream &  ofs = std::cout 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ scalar_multiply_2d()

void scalar_multiply_2d ( const std::vector< ModuleBase::Vector3< double > > &  array,
double  scalar,
std::vector< ModuleBase::Vector3< double > > &  result 
)

scalar multiply a 2D array.

Here is the caller graph for this function:

◆ subtract_2d()

void subtract_2d ( const std::vector< ModuleBase::Vector3< double > > &  array_1,
const std::vector< ModuleBase::Vector3< double > > &  array_2,
std::vector< ModuleBase::Vector3< double > > &  result 
)

array_1 - array_2.

Here is the caller graph for this function:

◆ sum_2d()

template<typename T >
T sum_2d ( const std::vector< ModuleBase::Vector3< T > > &  array)

sum of all elements in a 2D array.

Here is the caller graph for this function:

◆ where_fill_scalar_2d()

void where_fill_scalar_2d ( const std::vector< ModuleBase::Vector3< int > > &  array_mask,
int  mask,
double  scalar,
std::vector< ModuleBase::Vector3< double > > &  result 
)

fill a 2D array with a scalar if the corresponding element is equal to mask.

Here is the caller graph for this function:

◆ where_fill_scalar_else_2d()

void where_fill_scalar_else_2d ( const std::vector< ModuleBase::Vector3< int > > &  array_mask,
int  mask,
double  scalar,
const std::vector< ModuleBase::Vector3< double > > &  rest,
std::vector< ModuleBase::Vector3< double > > &  result 
)
Here is the caller graph for this function: