@@ -397,49 +397,49 @@ bool IOUtils::write_eigen_matrix(const Eigen::Matrix<T, Eigen::Dynamic, Eigen::D
397397
398398// =============================================================================================================
399399
400- template <typename T>
401- bool IOUtils::write_eigen_matrix (const Eigen::Matrix<T, 1 , Eigen::Dynamic>& in, const std::string& sPath , const std::string& sDescription )
402- {
403- Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> matrixName (1 ,in.cols ());
404- matrixName.row (0 )= in;
405- return IOUtils::write_eigen_matrix (matrixName, sPath , sDescription );
406- }
407-
408- // =============================================================================================================
409-
410- template <typename T>
411- bool IOUtils::write_eigen_matrix (const Eigen::Matrix<T, Eigen::Dynamic, 1 >& in, const std::string& sPath , const std::string& sDescription )
412- {
413- Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> matrixName (in.rows (),1 );
414- matrixName.col (0 )= in;
415- return IOUtils::write_eigen_matrix (matrixName, sPath , sDescription );
416- }
417-
418- // =============================================================================================================
419-
420- template <typename T>
421- bool IOUtils::write_eigen_matrix (const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>& in, const std::string& sPath , const std::string& sDescription )
422- {
423- std::ofstream outputFile (sPath );
424- if (outputFile.is_open ())
425- {
426- if (!sDescription .empty ()) {
427- outputFile<<" # Dimensions (rows x cols): " <<in.rows ()<<" x " <<in.cols ()<<" \n " ;
428- outputFile<<" # Description: " <<sDescription <<" \n " ;
429- }
430-
431- for (int row = 0 ; row<in.rows (); row++) {
432- for (int col = 0 ; col<in.cols (); col++)
433- outputFile << in (row, col)<<" " ;
434- outputFile<<" \n " ;
435- }
436- } else {
437- qWarning ()<<" Could not write Eigen element to file! Path does not exist!" ;
438- return false ;
439- }
440-
441- return true ;
442- }
400+ // template<typename T>
401+ // bool IOUtils::write_eigen_matrix(const Eigen::Matrix<T, 1, Eigen::Dynamic>& in, const std::string& sPath, const std::string& sDescription)
402+ // {
403+ // Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> matrixName(1,in.cols());
404+ // matrixName.row(0)= in;
405+ // return IOUtils::write_eigen_matrix(matrixName, sPath, sDescription);
406+ // }
407+
408+ // // =============================================================================================================
409+
410+ // template<typename T>
411+ // bool IOUtils::write_eigen_matrix(const Eigen::Matrix<T, Eigen::Dynamic, 1>& in, const std::string& sPath, const std::string& sDescription)
412+ // {
413+ // Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> matrixName(in.rows(),1);
414+ // matrixName.col(0)= in;
415+ // return IOUtils::write_eigen_matrix(matrixName, sPath, sDescription);
416+ // }
417+
418+ // // =============================================================================================================
419+
420+ // template<typename T>
421+ // bool IOUtils::write_eigen_matrix(const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>& in, const std::string& sPath, const std::string& sDescription)
422+ // {
423+ // std::ofstream outputFile(sPath);
424+ // if(outputFile.is_open())
425+ // {
426+ // if(!sDescription.empty()) {
427+ // outputFile<<"# Dimensions (rows x cols): "<<in.rows()<<" x "<<in.cols()<<"\n";
428+ // outputFile<<"# Description: "<<sDescription<<"\n";
429+ // }
430+
431+ // for(int row = 0; row<in.rows(); row++) {
432+ // for(int col = 0; col<in.cols(); col++)
433+ // outputFile << in(row, col)<<" ";
434+ // outputFile<<"\n";
435+ // }
436+ // } else {
437+ // qWarning()<<"Could not write Eigen element to file! Path does not exist!";
438+ // return false;
439+ // }
440+
441+ // return true;
442+ // }
443443
444444// =============================================================================================================
445445
@@ -523,86 +523,86 @@ bool IOUtils::read_eigen_matrix(Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>
523523
524524// =============================================================================================================
525525
526- template <typename T>
527- bool IOUtils::read_eigen_matrix (Eigen::Matrix<T, 1 , Eigen::Dynamic>& out, const std::string& path)
528- {
529- Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> matrixName;
530- bool bStatus = IOUtils::read_eigen_matrix (matrixName, path);
526+ // template<typename T>
527+ // bool IOUtils::read_eigen_matrix(Eigen::Matrix<T, 1, Eigen::Dynamic>& out, const std::string& path)
528+ // {
529+ // Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> matrixName;
530+ // bool bStatus = IOUtils::read_eigen_matrix(matrixName, path);
531531
532- if (matrixName.rows () > 0 )
533- {
534- out = matrixName.row (0 );
535- }
532+ // if(matrixName.rows() > 0)
533+ // {
534+ // out = matrixName.row(0);
535+ // }
536536
537- return bStatus;
538- }
537+ // return bStatus;
538+ // }
539539
540- // =============================================================================================================
540+ // // =============================================================================================================
541541
542- template <typename T>
543- bool IOUtils::read_eigen_matrix (Eigen::Matrix<T, Eigen::Dynamic, 1 >& out, const std::string& path)
544- {
545- Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> matrixName;
546- bool bStatus = IOUtils::read_eigen_matrix (matrixName, path);
542+ // template<typename T>
543+ // bool IOUtils::read_eigen_matrix(Eigen::Matrix<T, Eigen::Dynamic, 1>& out, const std::string& path)
544+ // {
545+ // Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> matrixName;
546+ // bool bStatus = IOUtils::read_eigen_matrix(matrixName, path);
547547
548- if (matrixName.cols () > 0 )
549- {
550- out = matrixName.col (0 );
551- }
548+ // if(matrixName.cols() > 0)
549+ // {
550+ // out = matrixName.col(0);
551+ // }
552552
553- return bStatus;
554- }
553+ // return bStatus;
554+ // }
555555
556- // =============================================================================================================
556+ // // =============================================================================================================
557557
558- template <typename T>
559- bool IOUtils::read_eigen_matrix (Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>& out, const std::string& path)
560- {
561- std::ifstream inputFile (path);
558+ // template<typename T>
559+ // bool IOUtils::read_eigen_matrix(Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>& out, const std::string& path)
560+ // {
561+ // std::ifstream inputFile(path);
562562
563- if (inputFile.is_open ()) {
564- // Start reading from file
565- std::vector<Eigen::VectorXd> help;
563+ // if(inputFile.is_open()) {
564+ // //Start reading from file
565+ // std::vector<Eigen::VectorXd> help;
566566
567- std::string line;
567+ // std::string line;
568568
569- while (std::getline (inputFile, line)){
570- if (line.find (' #' ) == std::string::npos){
571- std::vector<double > elements;
572- std::stringstream stream{line};
573- std::string element;
569+ // while(std::getline(inputFile, line)){
570+ // if(line.find('#') == std::string::npos){
571+ // std::vector<double> elements;
572+ // std::stringstream stream{line};
573+ // std::string element;
574574
575- stream >> std::ws;
576- while (stream >> element){
577- elements.push_back (std::stod (element));
578- stream >> std::ws;
579- }
575+ // stream >> std::ws;
576+ // while(stream >> element){
577+ // elements.push_back(std::stod(element));
578+ // stream >> std::ws;
579+ // }
580580
581- Eigen::VectorXd x (elements.size ());
581+ // Eigen::VectorXd x (elements.size());
582582
583- for (size_t i = 0 ; i < elements.size (); ++i){
584- x (i) = elements.at (i);
585- }
583+ // for(size_t i = 0; i < elements.size(); ++i){
584+ // x(i) = elements.at(i);
585+ // }
586586
587- help.push_back (std::move (x));
588- }
589- }
587+ // help.push_back(std::move(x));
588+ // }
589+ // }
590590
591- int rows = help.size ();
592- int cols = rows <= 0 ? 0 : help.at (0 ).rows ();
591+ // int rows = help.size();
592+ // int cols = rows <= 0 ? 0 : help.at(0).rows();
593593
594- out.resize (rows, cols);
594+ // out.resize(rows, cols);
595595
596- for (size_t i = 0 ; i < help.size (); i++) {
597- out.row (i) = help[i].transpose ();
598- }
599- } else {
600- qWarning ()<<" IOUtils::read_eigen_matrix - Could not read Eigen element from file! Path does not exist!" ;
601- return false ;
602- }
596+ // for (size_t i = 0; i < help.size(); i++) {
597+ // out.row(i) = help[i].transpose();
598+ // }
599+ // } else {
600+ // qWarning()<<"IOUtils::read_eigen_matrix - Could not read Eigen element from file! Path does not exist!";
601+ // return false;
602+ // }
603603
604- return true ;
605- }
604+ // return true;
605+ // }
606606} // NAMESPACE
607607
608608#endif // IOUTILS_H
0 commit comments