本文整理汇总了C++中eigen::MatrixXcd::cols方法的典型用法代码示例。如果您正苦于以下问题:C++ MatrixXcd::cols方法的具体用法?C++ MatrixXcd::cols怎么用?C++ MatrixXcd::cols使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eigen::MatrixXcd
的用法示例。
在下文中一共展示了MatrixXcd::cols方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mult_dirac
void BasicOperator::mult_dirac(const Eigen::MatrixXcd& matrix,
Eigen::MatrixXcd& reordered,
const size_t index) const {
const vec_pdg_Corr op_Corr = global_data->get_lookup_corr();
const size_t rows = matrix.rows();
const size_t cols = matrix.cols();
const size_t col = cols/4;
if( (rows != reordered.rows()) || (cols != reordered.cols()) ){
std::cout << "Error! In BasicOperator::mult_dirac: size of matrix and "
"reordered must be equal" << std::endl;
exit(0);
}
for(const auto& dirac : op_Corr[index].gamma){
if(dirac != 4){
for(size_t block = 0; block < 4; block++){
reordered.block(0, block * col, rows, col) =
gamma[dirac].value[block] *
matrix.block(0, gamma[dirac].row[block]*col, rows, col);
}
}
}
}
示例2: fix_phase
//fix phase of eigensystem and store phase of first entry of each eigenvector
void fix_phase(Eigen::MatrixXcd& V, Eigen::MatrixXcd& V_fix, std::vector<double>& phase) {
const int V3 = pars -> get_int("V3");
//helper variables:
//Number of eigenvectors
int n_ev;
//negative imaginary
std::complex<double> i_neg (0,-1);
//tmp factor and phase
std::complex<double> fac (1.,1.);
double tmp_phase = 0;
//get sizes right, resize if necessary
n_ev = V.cols();
if (phase.size() != n_ev) phase.resize(n_ev);
if (V_fix.cols() != n_ev) V_fix.resize(3*V3,n_ev);
//loop over all eigenvectors of system
for (int n = 0; n < n_ev; ++n) {
tmp_phase = std::arg(V(0,n));
phase.at(n) = tmp_phase;
fac = std::exp(i_neg*tmp_phase);
//Fix phase of eigenvector with negative polar angle of first entry
V_fix.col(n) = fac * V.col(n);
}
}
示例3: main
int main(int argc, char ** argv) {
// initialize parameters /////////////////////////////////////////////////////
Parameters p;
#ifdef DEBUG
cout << "Memory usage of p: " << sizeof(p) << " bytes." << endl;
Eigen::MatrixXcd H = p.Ham();
cout << "size of Hamiltonian: " << H.rows() << "x" << H.cols() << endl;
cout << "Hamiltonian: " << H << endl;
cout << "Second element of Hamiltonian: " << p.Ham(0,1) << endl;
#endif
// propagate /////////////////////////////////////////////////////////////////
return 0;
}
示例4: trafo_ev
// TODO: work on interface with eigenvector class
// transform matrix of eigenvectors with gauge array
Eigen::MatrixXcd GaugeField::trafo_ev(const Eigen::MatrixXcd &eig_sys) {
const ssize_t dim_row = eig_sys.rows();
const ssize_t dim_col = eig_sys.cols();
Eigen::MatrixXcd ret(dim_row, dim_col);
if (omega.shape()[0] == 0)
build_gauge_array(1);
// write_gauge_matrices("ev_trafo_log.bin",Omega);
for (ssize_t nev = 0; nev < dim_col; ++nev) {
for (ssize_t vol = 0; vol < dim_row; ++vol) {
int ind_c = vol % 3;
Eigen::Vector3cd tmp =
omega[0][ind_c].adjoint() * (eig_sys.col(nev)).segment(ind_c, 3);
(ret.col(nev)).segment(ind_c, 3) = tmp;
} // end loop nev
} // end loop vol
return ret;
}
示例5: size_pn
inline int size_pn() const { return coef_iat_ipn.cols(); }