LoginSignup
0
0

More than 5 years have passed since last update.

MATLAB > TriRep > Error: 入力の三角形分割は、有限の正の値を含まなければなりません。Inf、NaN、0、または、負の入力は許可されません。 > MATLABとScipyのインデックス始まりの違い (1と0)

Last updated at Posted at 2017-11-19
動作環境
GeForce GTX 1070 (8GB)
ASRock Z170M Pro4S [Intel Z170chipset]
Ubuntu 16.04 LTS desktop amd64
TensorFlow v1.2.1
cuDNN v5.1 for Linux
CUDA v8.0
Python 3.5.2
IPython 6.0.0 -- An enhanced Interactive Python.
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)
scipy v0.19.1
geopandas v0.3.0
MATLAB R2017b (Home Edition)

MATLABの処理においてdelaunayの処理をScipyのDelaunay()の結果に置き換えてみた。
(Scipyの結果をファイル読込みする)。

>> [x0,tri0]=getIcosNodes_load(4,0);

tri =

     3     2     7     1
     2     3     6     1
     4     3     6     2
     3    10     6     1
    11     7     2     5
     7     2     5     1
     8    12     6    10
     4    12     6     8
     4     8     6     3
     8    10     6     3
     5     2     6     1
     3    11     9     1
     3     7    11     1
     7     5    11     1
    11     5     9     1
     6    12     4     2
     3     4     7     2
     8     4     7     3
    11     4     2     7
     3     7     9    11


tri =

     7    11     5     1
     7    10     3     1
     7     0     5     4
     7     2     6     8
     7    10     4     1
     7     5     4     1
     7     0     5     9
     7    11     3     1
     7    10     3     6
     7    11     5     9
     7     0     2     8
     7    10     4     8
     7    10     6     8
     7     0     2     9
     7     0     4     8

エラー: TriRep
入力の三角形分割は、有限の正の値を含まなければなりません。InfNaN0、または、負の入力は許可されません。

一つ目のtriがMATLABの結果。
二つ目のtriがScipyの結果。

Scipyの結果には0が入るためか、上記のエラーになる。

Scipy(あるいはPython)のインデックスは0始まり。

MATLABは下記を見ると1始まりなのだろう。
https://jp.mathworks.com/help/matlab/math/matrix-indexing.html

4 行目の 2 列目の要素にアクセスするには、次のように指定します。

A(4,2)
ans =
14

Scipyの処理においてインデックスに1を足すことでエラーは出なくなった。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0