1 / 14

RTK-GPS 測位の基礎と プログラミング (3) Basics of RTK-GPS Positioning and Its Programing

RTK-GPS 測位の基礎と プログラミング (3) Basics of RTK-GPS Positioning and Its Programing. 東京海洋大産学官連携研究員 / 技術コンサルタント 高須 知二  Tomoji TAKASU. 内容. 行列演算ライブラリ BLASS LAPACK C→Fortran 呼び出し法 可変長行列・ベクトル 最小二乗法解法 行列内部表現. 行列演算ライブラリ (1). メリット 実行速度が速い ( 数倍~数 10 倍 ) 信頼性が高い コードを書かなくて良い

benito
Download Presentation

RTK-GPS 測位の基礎と プログラミング (3) Basics of RTK-GPS Positioning and Its Programing

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. RTK-GPS測位の基礎とプログラミング (3)Basics of RTK-GPS Positioning and Its Programing 東京海洋大産学官連携研究員/技術コンサルタント 高須 知二 Tomoji TAKASU

  2. 内容 • 行列演算ライブラリ • BLASS • LAPACK • C→Fortran呼び出し法 • 可変長行列・ベクトル • 最小二乗法解法 • 行列内部表現

  3. 行列演算ライブラリ (1) • メリット実行速度が速い (数倍~数10倍)信頼性が高いコードを書かなくて良い • デメリット使うのが面倒 (使いこなしが大変)make時にライブラリが必要(可搬性)

  4. 行列演算ライブラリ (2) • BLAS基礎行列演算: 代入、内積、ノルム、加減算、乗算、除算 • LAPACK線型方程式(連立一次方程式)最小二乗、固有値分解、特異値分解

  5. BLAS (1) • Level1 : y←ax+y...(ベクトル間) • Level2 : y←aAx+by...(行列-ベクトル) • Level3 : C←aAB+bC...(行列-行列) • 関数名 : xAAAA(x : S=単精度実数, D=倍精度実数C=単精度複素数, Z=倍精度複素数)

  6. BLAS (2) • 主要ルーチンDGEMM : C←aA*B*+bC • プロトタイプDGEMM(char *transa, char *transb, int* m, int *n, int *k, double *alpha, double *a, int *lda, double *b, int *ldb, double * beta, double *c, int *ldc);

  7. LAPACK (1) • ドライバルーチン • 個別ルーチン • 補助ルーチン

  8. LAPACK (2) • DGESV:線形方程式 • DGELS:最小二乗

  9. C→Fortran呼び出し方法 • 関数名置換GEMM→gemm_() (GCC) • 引数: すべてポインタ(参照)渡し。(値渡しはできない) • リンク時オプション: ライブラリ指定-llapack -lblas (GCC)

  10. 可変長行列/ベクトル • 標準C(89){double *a=malloc(sizeof(double)*n*m);...; b=a[i+n*j]; ...free(a);} • ALLOCA (非標準){double *a=alloca(sizeof(double)*n*m);...; b=a[i+n*j]; ...} • C99{double a[n][m];...; a[i][j]; ...}(Row-Major)

  11. 最小二乗法解法 (1) • 正規方程式 • 計画行列QR分解

  12. 最小二乗法解法 (2) • QR分解修正Gram-ShmidtHouseholder変換Givens-Rotation • 逐次改良

  13. 行列内部表現 (1) FORTRAN/MATLAB (BLAS/LAPACK) C Index 1-ORIGIN 0-ORIGIN Memory Order n n m m Column-Major Row-Major Access to Member A[i][j] (a[i+j*n]:Column-Major) A(i,j) (i=1,2,...n,j=1,2,...m) (i=0,1,...n-1,j=0,1,...m-1)

  14. 行列内部表現 (2) • BLAS/LAPACK互換性 • 標準C(89)サポート (可搬性) • メモリ確保用ライブラリ : A=mat(n,m) • Column-Major Order (Fortran形式) • 行列要素参照 : A[i+j*n]

More Related