Help us understand the problem. What is going on with this article?

Row-major orderとColumn-major order

More than 3 years have passed since last update.

参考: Wikipedia: Row-major_order

行列を配列に格納するときにどのような順番に格納するかとしてRow-major orderとColumn-major orderの2種類があります。

たとえばこのような行列があったとき

Column-major orderとRow-major orderではそれぞれ以下のように配列に格納されます。

Address Column-major order Row-major order
0 a11 a11
1 a21 a12
2 a12 a13
3 a22 a21
4 a13 a22
5 a23 a23

Row-major order は C/C++/Objective-C (for C-style arrays), Mathematica, PL/I, Pascal, Speakeasy, SAS, and C#/CLI/.Net などで使われています。
Column-major order は Fortran, OpenGL and OpenGL ES, MATLAB, GNU Octave, S-Plus, R, Julia, Rasdaman, Scilab などで使われています。

並び順の異なる行列ライブラリ間でデータをやりとりする場合等は、気をつけましょう。

niusounds
iOSエンジニアLv1。AndroidはLv10くらい。
http://www.niusounds.com
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした