ampsci
c++ program for high-precision atomic structure calculations of single-valence systems
|
Vector class (inherits from Matrix) More...
#include <Vector.hpp>
Inherits LinAlg::Matrix< double >.
Public Member Functions | |
Vector () | |
Default construct. | |
Vector (std::size_t dimension) | |
Initialise a blank square matrix dimension*dimension, filled with 0. | |
Vector (std::initializer_list< T > l) | |
Initialise a matrix from initialiser list. {{},{},{}}. Each row must be same length. | |
Vector (std::vector< T > &&v) | |
Initialise from std::vector using move() | |
Vector (const std::vector< T > &v) | |
Initialise from std::vector by copy. | |
Vector (const Matrix< T > &&m) | |
Initialise from Matrix by move. | |
Vector (const Matrix< T > &m) | |
Initialise from Matrix by copy. | |
T | operator[] (std::size_t i) const |
[] index access (with no range checking). [i][j] returns ith row, jth col | |
T & | operator[] (std::size_t i) |
As above, but const. | |
T & | at (std::size_t i) |
() index access (with range checking). (i,j) returns ith row, jth col | |
T | at (std::size_t i) const |
As above, but const. | |
T & | operator() (std::size_t i) |
() index access (with range checking). (i,j) returns ith row, jth col | |
T | operator() (std::size_t i) const |
As above, but const. | |
Vector< T > | conj () const |
auto | real () const |
auto | imag () const |
auto | complex () const |
Vector< T > | transpose () const =delete |
Vector< T > & | operator+= (const Vector< T > &rhs) |
Vector< T > & | operator-= (const Vector< T > rhs) |
Vector< T > & | operator*= (const T x) |
Vector< T > & | operator/= (const T x) |
auto | as_gsl_view () |
Returns gsl_vector_view (or _float_view, _complex_view, _complex_float_view). Call .matrix to use as a GSL matrix (no copy is involved). Allows one to use all GSL built-in functions. Note: non - owning pointer - matrix must remain in scope. | |
auto | as_gsl_view () const |
As above, but const. | |
Public Member Functions inherited from LinAlg::Matrix< double > | |
Matrix () | |
Default initialiser. | |
Matrix (std::size_t rows, std::size_t cols) | |
Initialise a blank matrix rows*cols, filled with 0. | |
Matrix (std::size_t dimension) | |
Initialise a blank square matrix dimension*dimension, filled with 0. | |
Matrix (std::initializer_list< std::initializer_list< double >> ll) | |
Initialise a matrix from initialiser list. {{},{},{}}. Each row must be same length. | |
Matrix (std::size_t rows, std::size_t cols, std::initializer_list< double > l) | |
Initialise a matrix from single initialiser list. {...}. | |
Matrix (std::size_t rows, std::size_t cols, std::vector< double > &&v) | |
Initialise a matrix from single initialiser list. {...}. | |
Matrix (std::size_t rows, std::size_t cols, const std::vector< double > &v) | |
Initialise a matrix from single initialiser list. {...}. | |
std::size_t | rows () const |
Return rows [major index size]. | |
std::size_t | cols () const |
Return columns [minor index size]. | |
std::size_t | size () const |
Return rows*columns [total array size]. | |
double * | data () |
Returns pointer to first element. Note: for std::complex<T>, this is a pointer to complex<T>, not T. | |
const double * | data () const |
As above, but const. | |
const double * | operator[] (std::size_t i) const |
[] index access (with no range checking). [i][j] returns ith row, jth col | |
double * | operator[] (std::size_t i) |
As above, but const. | |
double & | at (std::size_t row_i, std::size_t col_j) |
() index access (with range checking). (i,j) returns ith row, jth col | |
double | at (std::size_t row_i, std::size_t col_j) const |
As above, but const. | |
double & | operator() (std::size_t i, std::size_t j) |
() index access (with range checking). (i,j) returns ith row, jth col | |
double | operator() (std::size_t i, std::size_t j) const |
As above, but const. | |
auto | begin () |
iterators for underlying std::vector (entire data) | |
auto | cbegin () const |
auto | end () |
auto | cend () const |
const double * | row (std::size_t row) const |
Returns raw c pointer to start of a row. | |
View< double > | row_view (std::size_t row) |
Returns a mutable 'View' of a row. | |
View< const double > | row_view (std::size_t row) const |
Returns an immutable 'View' of a row. | |
View< double > | column_view (std::size_t col) |
Returns a mutable 'View' of a column. | |
View< const double > | column_view (std::size_t col) const |
Returns an immutable 'View' of a column. | |
auto | as_gsl_view () |
Returns gsl_matrix_view (or _float_view, _complex_view, _complex_float_view). Call .matrix to use as a GSL matrix (no copy is involved). Allows one to use all GSL built-in functions. Note: non-owning pointer - matrix AND gsl_view must remain in scope. | |
auto | as_gsl_view () const |
As above, but const. | |
double | determinant () const |
Returns the determinant. Uses GSL; via LU decomposition. Only works for double/complex<double> | |
Matrix< double > & | invert_in_place () |
Inverts the matrix, in place. Uses GSL; via LU decomposition. Only works for double/complex<double>. | |
Matrix< double > | inverse () const |
Returns inverse of the matrix. Leaves original matrix intact. Uses GSL; via LU decomposition. Only works for double/complex<double> | |
Matrix< double > | transpose () const |
Returns transpose of matrix. | |
Matrix< double > & | make_identity () |
Constructs a diagonal unit matrix (identity), in place; only for square. | |
Matrix< double > & | zero () |
Sets all elements to zero, in place. | |
Matrix< double > | conj () const |
Returns conjugate of matrix. | |
auto | real () const |
Returns real part of complex matrix (changes type; returns a real matrix) | |
auto | imag () const |
Returns imag part of complex matrix (changes type; returns a real matrix) | |
auto | complex () const |
Converts a real to complex matrix (changes type; returns a complex matrix) | |
Matrix< double > & | conj_in_place () |
Conjugates matrix, in place. | |
Matrix< double > & | mult_elements_by (const Matrix< double > &a) |
Muplitplies all the elements by those of matrix a, in place: M_ij *= a_ij. | |
Matrix< double > & | operator+= (const Matrix< double > &rhs) |
Overload standard operators: do what expected. | |
Matrix< double > & | operator+= (double aI) |
Matrix<T> += T : T assumed to be *Identity! | |
Matrix< double > & | operator-= (const Matrix< double > &rhs) |
Matrix< double > & | operator-= (double aI) |
Matrix<T> -= T : T assumed to be *Identity! | |
Matrix< double > & | operator*= (const double x) |
Matrix< double > & | operator/= (const double x) |
Friends | |
Vector< T > | operator+ (Vector< T > lhs, const Matrix< T > &rhs) |
Vector< T > | operator- (Vector< T > lhs, const Matrix< T > &rhs) |
Vector< T > | operator* (const T x, Vector< T > rhs) |
Vector< T > | operator* (Vector< T > lhs, const T x) |
Vector< T > | operator/ (Vector< T > lhs, const T x) |
Vector< T > | operator* (const Matrix< T > &a, const Vector< T > &b) |
Matrix*Vector multiplication: v_i = sum_j A_ij*B_j. | |
T | operator* (const Vector< T > &a, const Vector< T > &b) |
Inner product: = sum_i a_i*b_i. | |
Matrix< T > | outer_product (const Vector< T > &a, const Vector< T > &b) |
Outer product:M_ij = a_i*b_j. | |
Additional Inherited Members | |
Protected Attributes inherited from LinAlg::Matrix< double > | |
std::size_t | m_rows |
std::size_t | m_cols |
std::vector< double > | m_data |
Vector class (inherits from Matrix)