亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? matrixtest.cpp

?? GPSTK:做gpS的人都應(yīng)當(dāng)知道這個(gè)東西
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
#include "Vector.hpp"#include "Matrix.hpp"#include "PolyFit.hpp"#include "Stats.hpp"#include <iostream>#include <iomanip>#include <fstream>   // for copyfmt/** * @file MatrixTest.cpp * */using namespace std;int ReadMatrix(gpstk::Matrix<double>& M, string& file){   ifstream infile(file.c_str());   if(!infile) return -1;   enum Type{GEN,LOW,UPT,DIA,SYM,SQU};   string labels[6]={"GEN","LOW","UPT","DIA","SYM","SQU"};   bool dimmed=false;   char ch;   int r=0,c=0,i=0,j=0;   string buffer;   Type type=GEN;   while(infile >> buffer) {      if(buffer[0] == '#') {        // skip to end of line         while(infile.get(ch)) { if(ch=='\n') break; }      }      else {         string::size_type in;         if((in=buffer.find("r=")) != string::npos) {            r = strtol(buffer.substr(in+2).c_str(),0,10);            //cout << "Found r = " << r << endl;            if(type != GEN) c=r;         }         else if((in=buffer.find("c=")) != string::npos) {            c = strtol(buffer.substr(in+2).c_str(),0,10);            //cout << "Found c = " << c << endl;            if(type != GEN) r=c;         }         else if((in=buffer.find("t=")) != string::npos) {            if((in=buffer.find("LOW")) != string::npos) type=LOW;            if((in=buffer.find("UPT")) != string::npos) type=UPT;            if((in=buffer.find("DIA")) != string::npos) type=DIA;            if((in=buffer.find("SYM")) != string::npos) type=SYM;            if((in=buffer.find("SQU")) != string::npos) type=SQU;            //cout << "Found type " << labels[type] << endl;         }         else if(buffer == string(":::")) {            if(r*c == 0) return 0;            M = gpstk::Matrix<double>(r,c,double(0));            dimmed = true;         }         else {            if(!dimmed) continue;            M(i,j) = strtod(buffer.c_str(),0);            j++;            switch(type) {               case LOW: if(j>i) { i++; j=0; } break;               case UPT: if(j>=c) { i++; j=i; } break;               case DIA: i=j; break;               case SYM: M(j-1,i) = M(i,j-1); if(j>i) { i++; j=0; } break;               case SQU: case GEN: default: if(j>=c) { i++; j=0; } break;            }         }      }   }   infile.close();   if(!dimmed) return -2;   return 0;}void VectorTest(void){   cout << "\n -------------- Vector Test ---------------------------------\n";   gpstk::Vector<double> V(10);   V += 3.1415;   cout << "V = " << V << endl;   double dat[10]={1.1,2.2,3.3,4.4,5.5,6.6,7.7,8.8,9.9,10.1};   V = dat;   cout << "V = " << V << endl;   //cout << "Median of V " << median(V) << endl;   cout << "V min " << min(V) << ", max " << max(V) << ", sum " << sum(V) << endl;      // slice is (init,number,stride)   gpstk::VectorSlice<double> Vodd(V,std::slice(0,5,2));   gpstk::ConstVectorSlice<double> Veve(V,std::slice(1,5,2));   cout << "Vodd = " << Vodd << endl;   cout << "Veve = " << Veve << endl;   Vodd[1] = Vodd[3] = 0;   //Veve[1] = Veve[4] = 99; compiler won't let you have Veve as l-value   V[3] = V[7] = 99;    // but you can change V, and that will show in Veve   cout << "Vodd = " << Vodd << endl;   cout << "Veve = " << Veve << endl;   cout << "Minkowski of Vodd and Veve " << Minkowski(Vodd,Veve) << endl;   cout << "dot of Vodd and Veve " << dot(Vodd,Veve) << endl;   cout << "V    = " << V << endl;   cout << "V min " << min(V) << ", max " << max(V) << ", sum " << sum(V) << ", norm " << norm(V) << endl;   gpstk::Vector<double> W=V;   V.zeroTolerance = 1.e-15;   cout << "Zero tolerance for V is " << V.zeroTolerance << endl;   V.zeroTolerance = 1.e-5;   cout << "Zero tolerance for W is " << W.zeroTolerance << endl;   W += V;   cout << "Here is W the usual way :\n";   cout << ' ' << fixed << setfill('.') << setw(8) << setprecision(3) << W << endl;   cout << "Here is W the saved way :\n";   cout << fixed << setfill('.') << setw(8) << setprecision(3);   ofstream savefmt;   savefmt.copyfmt(cout);   for(int i=0; i<W.size(); i++) {      cout.copyfmt(savefmt);      cout << W[i];   }   cout << setfill(' ') << endl;   gpstk::Vector<double> Sum;   Sum = V + W;   cout << "Sum = " << setw(8) << Sum << endl;   gpstk::ConstVectorSlice<double> CVS(V,std::slice(0,V.size(),1));   cout << "CVS = " << setw(13) << CVS << endl;}void MatrixTest1(int argc, char **argv){   cout << "\n -------------- Matrix Test 1 ---------------------------------\n";   gpstk::Matrix<double> MD(2,5);   double dat[10]={1.1,2.2,3.3,4.4,5.5,6.6,7.7,8.8,9.9,10.1};   MD = dat;   cout << "Matrix (" << MD.rows() << "," << MD.cols() << ") from double* :\n" << fixed << setprecision(1) << setw(5) << MD << endl;   string filename(argv[5]);   gpstk::Matrix<double> MF;   int iret=ReadMatrix(MF,filename);   if(iret < 0) {      cerr << "Error: could not open file " << filename << endl;      return;   }   //cout << "Matrix (" << MF.rows() << "," << MF.cols() << ") from file :\n" << fixed << setprecision(1) << setw(7) << MF << endl;      // pick off last column   gpstk::Vector<double> B(MF.colCopy(MF.cols()-1));      // copy all but last column   gpstk::Matrix<double> A(MF,0,0,MF.rows(),MF.cols()-1);   cout << "Partials Matrix (" << A.rows() << "," << A.cols() << ") :\n" << fixed << setprecision(3) << setw(10) << A << endl;   cout << "Data vector (" << B.size() << ") :\n" << fixed << setprecision(3) << setw(10) << B << endl;      // take ATA, then invert   gpstk::Matrix<double> AT,ATA;   AT = transpose(A);   //cout << "Transposed matrix (" << AT.rows() << "," << AT.cols() << ") :\n" << fixed << setprecision(1) << setw(7) << AT << endl;   ATA = AT * A;   //cout << "ATA matrix (" << ATA.rows() << "," << ATA.cols() << ") :\n" << fixed << setprecision(3) << setw(13) << ATA << endl;   gpstk::Matrix<double> Ainv;   try { Ainv=inverse(ATA); }   catch (gpstk::Exception& e) { cout << e << endl; return;}   cout << "Covariance matrix (" << Ainv.rows() << "," << Ainv.cols() << ") :\n" << fixed << setprecision(3) << setw(10) << Ainv << endl;   gpstk::Vector<double> Sol;   Sol = Ainv * AT * B;   cout << "Solution vector (" << Sol.size() << ") :\n" << fixed << setprecision(3) << setw(10) << Sol << endl;   gpstk::Vector<double> Two;   Two = B - A*Sol;   cout << "Residual vector (" << Two.size() << ") :\n" << scientific << setprecision(3) << setw(10) << Two << endl;   Two = Sol + Sol;   cout << "2*Solution vector (" << Two.size() << ") :\n" << fixed << setprecision(3) << setw(10) << Two << endl;   gpstk::Matrix<double> TA;   TA = A + A;   cout << "2*Partials Matrix (" << TA.rows() << "," << TA.cols() << ") :\n" << fixed << setprecision(3) << setw(10) << TA << endl;   int i;   gpstk::Vector<double> c(8),b(7);   gpstk::Matrix<double> W;   for(i=0; i<8; i++) c(i)=3*i;   for(i=0; i<7; i++) b(i)=i+1;   W = outer(c,b);   cout << "Vector c(" << c.size() << ") :\n" << fixed << setprecision(3) << setw(7) << c << endl;   cout << "Vector b(" << b.size() << ") :\n" << fixed << setprecision(3) << setw(7) << b << endl;   cout << "Their outer product (" << W.rows() << "," << W.cols() << ") :\n" << fixed << setprecision(3) << setw(7) << W << endl;   cout << "Their norms " << norm(b) << " and " << norm(c) << " and dot " << dot(c,b) << " and cosine " << cosVec(c,b) << endl;}void MatrixTest2(void){   cout << "\n -------------- Matrix Test 2 ---------------------------------\n";   for(int n=2; n<13; n++) {      double big,small,cond;      gpstk::Matrix<double> MM(n,n),Minv,Prod;      for(int i=0; i<n; i++) {         for(int j=0; j<n; j++) {            MM(i,j) = 1.0/(i+j+1.0);         }      }      cout << "Tough matrix (" << MM.rows() << "," << MM.cols() << ") :\n" << fixed << setprecision(6) << setw(9) << MM << endl;      Minv = inverse(MM);      try { Minv=inverse(MM); }      catch (gpstk::Exception& e) { cout << e << endl; break;}      cond = condNum(MM,big,small);      cout << "Condition number for " << n << " is " << fixed << setprecision(3) << big << "/" << scientific << setprecision(3) << small;      if(small > 0.0) cout << " = " << setprecision(3) << big/small;      cout << endl;      cout << "Inverse matrix (" << Minv.rows() << "," << Minv.cols() << ") :\n" << fixed << setprecision(3) << setw(10+(n>5?n:0)) << Minv << endl;      Prod = Minv * MM;      gpstk::Vector<double>V;      V.zeroTolerance = 1.e-3;      Prod.zeroize();      cout << "Unity matrix (" << Prod.rows() << "," << Prod.cols() << ") ? :\n" << fixed << setprecision(9) << setw(12) << Prod << endl;   }}void MatrixTest3(int argc, char **argv){   cout << "\n -------------- Matrix Test 3 ---------------------------------\n";   cout << "Read and print matrix from file\n";   double cond,big,small;   gpstk::Matrix<double> A,Ainv,P;   for(int i=1; i<argc; i++) {      string filename=argv[i];      cout << "File " << filename;      int iret=ReadMatrix(A,filename);      cout << " (" << iret << ") Matrix(" << A.rows() << "," << A.cols() << ") :\n" << fixed << setprecision(3) << setw(10) << A << endl;      if(A.rows() != A.cols()) {         gpstk::Matrix<double> AT;         AT = gpstk::transpose(A);         A = AT*A;         cout << " ATA Matrix(" << A.rows() << "," << A.cols() << ") :\n" << fixed << setprecision(3) << setw(10) << A << endl;      }      cond = condNum(A,big,small);      cout << "Condition number is " << fixed << setprecision(3) << big << "/" << scientific << setprecision(3) << small;      cout << " = " << fixed << big/small << endl;      try { Ainv=gpstk::inverse(A); }      catch (gpstk::Exception& e) { cout << e << endl; continue;}      cout << "Inverse matrix (" << Ainv.rows() << "," << Ainv.cols() << ") :\n" << fixed << setprecision(3) << setw(10) << Ainv << endl;      P = Ainv * A;      cout << "Unity matrix (" << P.rows() << "," << P.cols() << ") ? :\n" << fixed << setprecision(9) << setw(12) << P << endl;   }}void MatrixTest4(void){   cout << "\n -------------- Matrix Test 4 ---------------------------------\n";   const int N=7; // rows = columns   double mat[N*N]={       // storage by columns      8.317,  6.212,  2.574,  5.317,  2.080, -9.133, -2.755,      0.212,  3.292,  1.574,  1.028,  3.370, -2.077, -2.739,      5.740,  1.574,  1.911,  1.390,  8.544,  8.930,  9.216,      4.317,  1.028,  1.039,  7.126,  4.512,  8.538,  5.226,      -1.109,  7.438,  7.236,  6.783,  0.356, -9.509, -0.109,      0.174,  5.408, -9.503, -6.527, -6.589, -6.375, -7.239,      1.960,  6.592,  9.440,  4.428, -4.531,  5.084,  4.296   };   double dat[N]={ 14.289,  9.284, -1.128,  8.389, -6.929,  4.664,  7.590 };   int i,j;   gpstk::Matrix<double> A(N,N);   gpstk::Vector<double> b(N);   A = mat;   A = transpose(A);   b = dat;   cout << "Matrix A(" << A.rows() << "," << A.cols() << ") :\n" << fixed << setprecision(3) << setw(7) << A << endl;   cout << "Vector b(" << b.size() << ") :\n" << fixed << setprecision(3) << setw(7) << b << endl;   cout << "\nNow solve using SVD\n";   gpstk::SVD<double> Asvd;   gpstk::Matrix<double> U,V;   gpstk::Vector<double> S;   Asvd(A);   U = Asvd.U;   V = Asvd.V;   S = Asvd.S;   cout << "Singular Values (" << S.size() << ") :\n" << fixed << setprecision(3) << setw(7) << S << endl;   cout << "Matrix U(" << U.rows() << "," << U.cols() << ") :\n" << fixed << setprecision(3) << setw(7) << U << endl;   cout << "Matrix V(" << V.rows() << "," << V.cols() << ") :\n" << fixed << setprecision(3) << setw(7) << V << endl;   gpstk::Matrix<double> P,W(A);   W = 0.0;   for(i=0; i<S.size(); i++) W(i,i)=S(i);   P = U * W * transpose(V);   P = P - A;   P.zeroize();   cout << "Difference (" << P.rows() << "," << P.cols() << ") :\n" << scientific << setprecision(3) << setw(10) << P << endl;   cout << "Determinant of A = " << scientific << setprecision(3) << Asvd.det();   double d=1;   for(i=0; i<N; i++) d *= S(i);   cout << " -- Compare to " << scientific << setprecision(3) << d << endl;   gpstk::Vector<double> X(b);   Asvd.backSub(X);   cout << "Solution via backsubstitution (" << X.size() << ") :\n" << fixed << setprecision(3) << setw(7) << X << endl;   S = b-A*X;   cout << "Solution residuals (" << S.size() << ") :\n" << scientific << setprecision(3) << setw(7) << S << endl;   cout << "\nSort in ascending order\n";   Asvd.sort(false);   U = Asvd.U;   V = Asvd.V;   S = Asvd.S;   cout << "Singular Values (" << S.size() << ") :\n" << fixed << setprecision(3) << setw(7) << S << endl;   cout << "Matrix U(" << U.rows() << "," << U.cols() << ") :\n" << fixed << setprecision(3) << setw(7) << U << endl;   cout << "Matrix V(" << V.rows() << "," << V.cols() << ") :\n" << fixed << setprecision(3) << setw(7) << V << endl;   // now chop off the last column of A and repeat   cout << "\n\nNow reduce A by one column and repeat\n";   A = gpstk::Matrix<double>(A,0,0,A.rows(),A.cols()-1);   cout << "Matrix A(" << A.rows() << "," << A.cols() << ") :\n" << fixed << setprecision(3) << setw(7) << A << endl;   Asvd(A);   S = Asvd.S;   U = Asvd.U;   V = Asvd.V;   cout << "Singular Values (" << S.size() << ") :\n" << fixed << setprecision(3) << setw(7) << S << endl;   cout << "Matrix U(" << U.rows() << "," << U.cols() << ") :\n" << fixed << setprecision(3) << setw(7) << U << endl;   cout << "Matrix V(" << V.rows() << "," << V.cols() << ") :\n" << fixed << setprecision(3) << setw(7) << V << endl;   W = A;   W = 0.0;   for(i=0; i<S.size(); i++) W(i,i)=S(i);   P = U * W * transpose(V);   P = P - A;   P.zeroize();   cout << "Difference (" << P.rows() << "," << P.cols() << ") :\n" << scientific << setprecision(3) << setw(10) << P << endl;}void MatrixTest5(void)

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91社区在线播放| 精品美女在线观看| 精品人在线二区三区| 中文字幕日韩av资源站| 青青草伊人久久| 成年人午夜久久久| 欧美成人a∨高清免费观看| 亚洲精品免费在线| 韩国三级中文字幕hd久久精品| 91麻豆国产福利精品| 亚洲精品在线免费播放| 亚洲成在线观看| av一二三不卡影片| 欧美变态口味重另类| 亚洲成在人线免费| 91麻豆精东视频| 国产精品成人免费在线| 国产一区二区久久| 日韩你懂的电影在线观看| 伊人性伊人情综合网| 丰满少妇在线播放bd日韩电影| 日韩欧美亚洲一区二区| 同产精品九九九| 在线视频观看一区| 综合av第一页| 欧美一级高清大全免费观看| 亚洲猫色日本管| 97se亚洲国产综合自在线不卡| 国产亚洲1区2区3区| 国产乱妇无码大片在线观看| 欧美一区二区三区男人的天堂| 亚洲成人中文在线| 欧美性猛片xxxx免费看久爱| 亚洲欧美日韩久久精品| 99久久精品免费看国产| 中文字幕日本乱码精品影院| 成人亚洲精品久久久久软件| 欧美韩国一区二区| 国产91精品一区二区麻豆亚洲| 久久精品视频免费| av在线不卡网| 一区二区三区资源| 欧美在线免费视屏| 日韩黄色小视频| 欧美一区二区三区四区五区| 奇米四色…亚洲| 久久中文字幕电影| 成人动漫精品一区二区| 亚洲色图20p| 欧美精品九九99久久| 男男视频亚洲欧美| 久久你懂得1024| 成人av在线播放网址| 亚洲欧美日韩国产手机在线| 在线观看亚洲专区| 日韩精品成人一区二区三区| 日韩视频在线你懂得| 国产精品亚洲视频| 综合欧美亚洲日本| 欧美一区二区三区电影| 国产精品一品二品| 伊人一区二区三区| 久久亚洲欧美国产精品乐播| 粉嫩绯色av一区二区在线观看| 亚洲婷婷综合久久一本伊一区| 666欧美在线视频| 国产精品一区一区| 亚洲午夜在线电影| 亚洲精品在线观看视频| 在线日韩一区二区| 国产精品一区二区免费不卡 | 久久66热re国产| 国产精品视频看| 91麻豆精品国产91久久久资源速度| 久久99热国产| 一区二区三区色| 精品国产精品网麻豆系列| 91老师片黄在线观看| 久久精品国产第一区二区三区| 欧美国产在线观看| 91麻豆精品国产自产在线观看一区 | 性做久久久久久免费观看| 国产欧美一区二区精品忘忧草 | 国产电影一区二区三区| 亚洲一区在线电影| 国产精品视频观看| 欧美大片一区二区| 欧美日韩综合不卡| 成年人午夜久久久| 国产一区二区三区视频在线播放 | 国产精品另类一区| 欧美成人vps| 欧美日韩精品免费观看视频 | 亚洲国产成人午夜在线一区| 欧美二区乱c少妇| 99久久99久久精品免费观看| 精品一区二区三区免费观看| 一区二区三区免费网站| 欧美激情中文不卡| 精品国产免费久久| 日韩一区二区三区四区| 在线观看网站黄不卡| 成人爱爱电影网址| 国产精品99久久久| 国产毛片精品一区| 久久99在线观看| 三级影片在线观看欧美日韩一区二区| 中文字幕在线不卡视频| 国产欧美视频一区二区| 久久久综合九色合综国产精品| 欧美色综合影院| 欧美亚洲一区二区三区四区| 在线免费视频一区二区| 99免费精品视频| 波多野结衣欧美| 99久久国产免费看| 色婷婷国产精品综合在线观看| 丁香激情综合国产| 不卡的电影网站| heyzo一本久久综合| 不卡视频一二三四| 99久久精品久久久久久清纯| www.色综合.com| 99久久久国产精品| 91福利社在线观看| 精品视频在线视频| 欧美一区二区在线观看| 精品裸体舞一区二区三区| 精品日韩在线观看| 久久婷婷国产综合国色天香 | 国产精品国产三级国产a | 亚洲va韩国va欧美va精品| 日韩二区三区在线观看| 日本伊人色综合网| 国产一区二区三区美女| 成人app软件下载大全免费| 91丝袜国产在线播放| 欧美专区在线观看一区| 欧美日韩国产123区| 欧美精品一区二区三区高清aⅴ | 国产激情一区二区三区桃花岛亚洲| 丁香六月综合激情| 欧美色图天堂网| 精品欧美乱码久久久久久| 久久久99精品免费观看不卡| 国产精品国模大尺度视频| 亚洲自拍另类综合| 免费欧美高清视频| 成人av网站在线| 欧美日韩国产小视频| 久久久精品天堂| 夜夜嗨av一区二区三区网页| 日韩av在线播放中文字幕| 国产乱一区二区| 欧美在线一二三四区| 欧美成人乱码一区二区三区| 一区在线观看视频| 美女精品一区二区| 91丨porny丨国产入口| 欧美成人猛片aaaaaaa| 亚洲日本在线视频观看| 青青草伊人久久| 一本久道中文字幕精品亚洲嫩| 日韩欧美中文一区二区| 国产精品久久福利| 日韩精品电影在线观看| 91香蕉视频mp4| 精品理论电影在线观看| 一区二区免费看| 高清视频一区二区| 在线综合视频播放| 亚洲免费在线观看| 国产激情偷乱视频一区二区三区 | 高潮精品一区videoshd| 欧美日韩美少妇| 国产精品国产三级国产aⅴ中文| 蜜乳av一区二区| 欧美最猛性xxxxx直播| 自拍偷拍国产精品| 韩国精品主播一区二区在线观看| 欧美日韩黄色一区二区| 亚洲天天做日日做天天谢日日欢| 国产成人在线观看| 精品国产凹凸成av人网站| 午夜激情久久久| 在线视频观看一区| 最新中文字幕一区二区三区| 国产精品一级片| 精品国产自在久精品国产| 亚洲成年人影院| 欧美日韩一区久久| 亚洲综合激情小说| 在线免费观看日韩欧美| 亚洲免费av高清| 99国产欧美另类久久久精品| 中文字幕国产一区| 不卡区在线中文字幕| 日韩伦理av电影| 色88888久久久久久影院按摩| 久久欧美一区二区|