本文整理汇总了C++中eigen::MatrixXcd::rows方法的典型用法代码示例。如果您正苦于以下问题:C++ MatrixXcd::rows方法的具体用法?C++ MatrixXcd::rows怎么用?C++ MatrixXcd::rows使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eigen::MatrixXcd
的用法示例。
在下文中一共展示了MatrixXcd::rows方法的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: operator
//TODO complex values as matrix entries too
//TODO support endomorphisms over Rn too
Expression EigenvectorsCommand::operator()(const QList< Analitza::Expression >& args)
{
Expression ret;
QStringList errors;
const Eigen::MatrixXcd eigeninfo = executeEigenSolver(args, true, errors);
if (!errors.isEmpty()) {
ret.addError(errors.first());
return ret;
}
const int neigenvectors = eigeninfo.rows();
QScopedPointer<Analitza::List> list(new Analitza::List);
for (int j = 0; j < neigenvectors; ++j) {
const Eigen::VectorXcd col = eigeninfo.col(j);
QScopedPointer<Analitza::Vector> eigenvector(new Analitza::Vector(neigenvectors));
for (int i = 0; i < neigenvectors; ++i) {
const std::complex<double> eigenvalue = col(i);
const double realpart = eigenvalue.real();
const double imagpart = eigenvalue.imag();
if (std::isnan(realpart) || std::isnan(imagpart)) {
ret.addError(QCoreApplication::tr("Returned eigenvalue is NaN", "NaN means Not a Number, is an invalid float number"));
return ret;
} else if (std::isinf(realpart) || std::isinf(imagpart)) {
ret.addError(QCoreApplication::tr("Returned eigenvalue is too big"));
return ret;
} else {
bool isonlyreal = true;
if (std::isnormal(imagpart)) {
isonlyreal = false;
}
Analitza::Cn * eigenvalueobj = 0;
if (isonlyreal) {
eigenvalueobj = new Analitza::Cn(realpart);
} else {
eigenvalueobj = new Analitza::Cn(realpart, imagpart);
}
eigenvector->appendBranch(eigenvalueobj);
}
}
list->appendBranch(eigenvector.take());
}
ret.setTree(list.take());
return ret;
}
示例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_at
inline int size_at() const { return coef_iat_ipn.rows(); }