当前位置: 首页>>代码示例>>C++>>正文


C++ Matrix3f::colPivHouseholderQr方法代码示例

本文整理汇总了C++中Matrix3f::colPivHouseholderQr方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix3f::colPivHouseholderQr方法的具体用法?C++ Matrix3f::colPivHouseholderQr怎么用?C++ Matrix3f::colPivHouseholderQr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Matrix3f的用法示例。


在下文中一共展示了Matrix3f::colPivHouseholderQr方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main()
{
   Matrix3f A;
   Vector3f b;
   A << 1,2,3,  4,5,6,  7,8,10;
   b << 3, 3, 4;
   cout << "Here is the matrix A:\n" << A << endl;
   cout << "Here is the vector b:\n" << b << endl;
   Vector3f x = A.colPivHouseholderQr().solve(b);
   cout << "The solution is:\n" << x << endl;
}
开发者ID:1165048017,项目名称:convnet-1,代码行数:11,代码来源:TutorialLinAlgExSolveColPivHouseholderQR.cpp

示例2: main

int main(void)
{
cout << endl;
try {
  sql::Driver *driver;
  sql::Connection *con;
  sql::Statement *stmt;
  sql::ResultSet *res;

  /* Create a connection */
  driver = get_driver_instance();
  con = driver->connect("tcp://serverip:port", "username", "###");
  /* Connect to the MySQL test database */
  con->setSchema("PECKHAM_RAW_DATA");
  int i = 0;
  int j = 0;
    Matrix3f A;
    Vector3f b;
  std::string mac_current;
  stmt = con->createStatement();
  res = stmt->executeQuery("SELECT COUNT(MAC_ROUTER), MAC_CLIENT, MAC_ROUTER,AVG(`SIGNAL`), `ROUTERS`.`ROUTER_POSITION_X`,`ROUTERS`.`ROUTER_POSITION_Y`,`ROUTERS`.`ROUTER_POSITION_Z` FROM PECKHAM_RAW_DATA.RAW_PACKET_INFO JOIN PECKHAM_RAW_DATA.ROUTERS ON `ROUTERS`.`ROUTER_MAC` = `RAW_PACKET_INFO`.`MAC_ROUTER` WHERE `RAW_PACKET_INFO`.DT > NOW()-INTERVAL 1 second GROUP BY MAC_CLIENT,MAC_ROUTER ORDER BY MAC_CLIENT");
  while (res->next()) {
      if (i == 0 and j == 0) {
          mac_current = res->getString(2);
          cout<< mac_current <<"|0|"<<j<<"\n";
          client_locations[i].client_data[j].MAC = res->getString(2);
          client_locations[i].client_data[j].DISTANCE = pow ((100/ pow(10,((atof(res->getString(4).c_str()))/10)) ) * (pow ((0.404262661 / (4*3.14159265)),2)),(1/2.9));
          client_locations[i].client_data[j].X = atof(res->getString(5).c_str());
          client_locations[i].client_data[j].Y = atof(res->getString(6).c_str());
          client_locations[i].client_data[j].Z = atof(res->getString(7).c_str());
          j++;
      }
      else{
          if (mac_current == res->getString(2)){
              j++;
              cout<< mac_current <<"|1|"<<j<<"\n";
              client_locations[i].client_data[j].MAC = res->getString(2);
              client_locations[i].client_data[j].DISTANCE = pow ((100/ pow(10,((atof(res->getString(4).c_str()))/10)) ) * (pow ((0.404262661 / (4*3.14159265)),2)),(1/2.9));
              client_locations[i].client_data[j].X = atof(res->getString(5).c_str());
              client_locations[i].client_data[j].Y = atof(res->getString(6).c_str());
              client_locations[i].client_data[j].Z = atof(res->getString(7).c_str());
          }
          else {
              i++;
              j = 0;
              mac_current = res->getString(2);
              cout<< mac_current <<"|2|"<<j<<"\n";
              client_locations[i].client_data[j].MAC = res->getString(2);
              client_locations[i].client_data[j].DISTANCE = pow ((100/ pow(10,((atof(res->getString(4).c_str()))/10)) ) * (pow ((0.404262661 / (4*3.14159265)),2)),(1/2.9));
              client_locations[i].client_data[j].X = atof(res->getString(5).c_str());
              client_locations[i].client_data[j].Y = atof(res->getString(6).c_str());
              client_locations[i].client_data[j].Z = atof(res->getString(7).c_str());
          }
      }
  }
    
    for (i = 0; i <= 50; i++){
        if (client_locations[i].client_data[0].DISTANCE != 0 && client_locations[i].client_data[1].DISTANCE != 0 && client_locations[i].client_data[2].DISTANCE != 0)
        {
            Matrix3f A;
            Vector3f b;
            A << client_locations[i].client_data[0].X,client_locations[i].client_data[0].Y,client_locations[i].client_data[0].Z,  client_locations[i].client_data[1].X,client_locations[i].client_data[1].Y,client_locations[i].client_data[1].Z,  client_locations[i].client_data[2].X,client_locations[i].client_data[2].Y,client_locations[i].client_data[2].Z;
            b << client_locations[i].client_data[0].DISTANCE,client_locations[i].client_data[1].DISTANCE,client_locations[i].client_data[2].DISTANCE;
            Vector3f x = A.colPivHouseholderQr().solve(b);
            cout << "Here is the vector b:\n" << b << endl;
            cout << "The Position for: "<<client_locations[i].client_data[0].MAC<<"\n" << x << endl;
        }
    }
    
  delete res;
  delete stmt;
  delete con;

} catch (sql::SQLException &e) {
  cout << "# ERR: SQLException in " << __FILE__;
  cout << "(" << __FUNCTION__ << ") on line " << __LINE__ << endl;
  cout << "# ERR: " << e.what();
  cout << " (MySQL error code: " << e.getErrorCode();
  cout << ", SQLState: " << e.getSQLState() << " )" << endl;
}

cout << endl;

return EXIT_SUCCESS;
}
开发者ID:jamesbenharris,项目名称:RF-Localization-Research,代码行数:85,代码来源:3D_POS_SOLVER_B1.cpp


注:本文中的Matrix3f::colPivHouseholderQr方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。