1 #ifndef CNTR_FUNCTION_DECL_H 2 #define CNTR_FUNCTION_DECL_H 29 typedef std::complex<T>
cplx;
32 function(
int nt,
int size1 = 1);
34 function(
const function &f);
36 #if __cplusplus >= 201103L 37 function(
function &&f) noexcept;
38 function &
operator=(
function &&f) noexcept;
40 int element_size(
void)
const {
return element_size_; }
44 int nt(
void)
const {
return nt_; }
45 inline cplx *
ptr(
int t) {
return data_ + (t + 1) * element_size_; }
47 return data_ + (t + 1) * element_size_;
52 template<
class EigenMatrix>
54 template <
class EigenMatrix>
56 template <
class EigenMatrix>
58 template <
class EigenMatrix>
59 void get_value(
int tstp, EigenMatrix &M)
const;
61 template<
class EigenMatrix>
75 void print_to_file(
const char *file,
int precision = 16)
const;
79 #if CNTR_USE_HDF5 == 1 82 void write_to_hdf5(hid_t group_id,
const char *groupname)
const;
83 void write_to_hdf5(
const char *filename,
const char *groupname)
const;
88 void read_from_hdf5(
int nt1, hid_t group_id,
const char *groupname);
89 void read_from_hdf5(
int nt1,
const char *filename,
const char *groupname);
111 #endif // CNTR_FUNCTION_DECL_H int size2_
Number of the rows in the Matrix form.
void Bcast_timestep(int tstp, int root)
Broadcast a time step of the function using MPI
const cplx * ptr(int t) const
void resize(int nt, int size1)
Resize the time length and/or matrix dimension of a square-matrix function
function & operator=(const function &f)
Overloaded operator '='. It copies data from an existing function object
void set_constant(cplx *f0)
Set all data to a constant(scalar or matrix) for the function class
int total_size_
Size of the data stored for the function on the real-time axis including ; * size1 * size2 ...
void set_zero(void)
Set all data to zero for the function class
cplx * data_
Pointer to the function in the Matrix form on the real-time axis ( ) ; 'data_+ element_size' corresp...
int size1_
Number of the colums in the Matrix form.
Class function for objects with time on real axis.
void get_value(int tstp, EigenMatrix &M) const
Get matrix value of this function object at a specific time point
void left_multiply(cplx *f, T weight=1.0)
Multiply function values with a matrix-valued function from the left
void read_from_hdf5(hid_t group_id)
Read the function data from a hdf5 file
void incr(function< T > &g, T weight=1.0)
Increase the function object by another function.
void right_multiply(cplx *f, T weight=1.0)
Multiply the function with another matrix-valued function from the right
void set_matrixelement(int tstp, int i1, int i2, EigenMatrix &M, int j1, int j2)
Set a matrix element from an Eigen matrix
void get_matrixelement(int i1, int i2, function< T > &g)
Get a matrix element of the function object
int nt_
Maximum number of the time steps.
void read_from_file(const char *file)
Read the function data from a txt file
void write_to_hdf5(hid_t group_id) const
Write the function data to a hdf5 file
void print_to_file(const char *file, int precision=16) const
Store the function data to a txt file
void set_value(int tstp, EigenMatrix &M)
Set matrix value at a specific time point
void smul(T weight)
Multiply the function with a scalar
const cplx & operator[](int t) const