Knowledge

Row- and column-major order

Source 📝

1378:
positions in a one-dimensional array. Of course, deviating from convention probably incurs a cost that increases with the degree of necessary interaction with conventional language features and other code, not only in the form of increased vulnerability to mistakes (forgetting to also invert matrix multiplication order, reverting to convention during code maintenance, etc.), but also in the form of having to actively rearrange elements, all of which have to be weighed against any original purpose such as increasing performance. Running the loop row-wise is preferred in row-major languages like C and vice versa for column-major languages.
31: 1564:, which was to write vectors as rows; for compatibility, transformation matrices would still be stored in vector-major (=row-major) rather than coordinate-major (=column-major) order, and he then used the trick " say that matrices in OpenGL are stored in column-major order". This was really only relevant for presentation, because matrix multiplication was stack-based and could still be interpreted as post-multiplication, but, worse, reality leaked through the C-based 353: 2087: 2322: 194:
index, no grouping order between the dimensions is implied by this. The choice of how to group and order the indices, either by row-major or column-major methods, is thus a matter of convention. The same terminology can be applied to even higher dimensional arrays. Row-major grouping starts from the
2631:
An array-type that specifies a sequence of two or more index-types shall be an abbreviated notation for an array-type specified to have as its index-type the first index-type in the sequence and to have a component-type that is an array-type specifying the sequence of index-types without the first
57:
The difference between the orders lies in which elements of an array are contiguous in memory. In row-major order, the consecutive elements of a row reside next to each other, whereas the same holds true for consecutive elements of a column in column-major order. While the terms allude to the rows
1606:
is typically an expensive operation, some systems provide options to specify individual matrices as being stored transposed. The programmer must then decide whether or not to rearrange the elements in memory, based on the actual usage (including the number of times that the array is reused in a
102:
The terms row-major and column-major stem from the terminology related to ordering objects. A general way to order objects with many attributes is to first group and order them by one attribute, and then, within each such group, group and order them by another attribute, etc. If more than one
1377:
To use column-major order in a row-major environment, or vice versa, for whatever reason, one workaround is to assign non-conventional roles to the indexes (using the first index for the column and the second index for the row), and another is to bypass language syntax by explicitly computing
73:
Data layout is critical for correctly passing arrays between programs written in different programming languages. It is also important for performance when traversing an array because modern CPUs process sequential data more efficiently than nonsequential data. This is primarily due to
216: 66:, respectively. It is also worth noting that matrices, being commonly represented as collections of row or column vectors, using this approach are effectively stored as consecutive vectors or consecutive vector components. Such ways of storing data are referred to as 1845: 2457:
of dimensions (with row-major and column-order just 2 special cases), although the lists of stride values are not necessarily permutations of each other, e.g., in the 2-by-3 example above, the strides are (3,1) for row-major and (1,2) for column-major.
2098: 2660:
From right to left, the rightmost dimension represents columns; the next dimension represents rows. SAS places variables into a multidimensional array by filling all rows in order, beginning at the upper left corner of the array (known as row-major
1530:
Support for multi-dimensional arrays may also be provided by external libraries, which may even support arbitrary orderings, where each dimension has a stride value, and row-major or column-major are just two possible resulting interpretations.
1584:). As a result, many developers will now simply declare that having the column as the first index is the definition of column-major, even though this is clearly not the case with a real column-major language like Fortran. 1560:) for graphics processing. Since "recent mathematical treatments of linear algebra and related fields invariably treat vectors as columns," designer Mark Segal decided to substitute this for the convention in predecessor 2424: 1686: 348:{\displaystyle A=a_{y,x}={\begin{bmatrix}\color {Blue}a_{11}&\color {Blue}a_{12}&\color {Blue}a_{13}\\\color {Orange}a_{21}&\color {Orange}a_{22}&\color {Orange}a_{23}\end{bmatrix}}} 2676: 1370:
row part can even be assigned to an intermediate variable that is then indexed in a separate expression. (No other implications should be assumed, e.g., Fortran is not column-major simply
1771: 759: 729: 664: 629: 599: 499: 694: 564: 534: 469: 434: 404: 2082:{\displaystyle n_{d}+N_{d}\cdot (n_{d-1}+N_{d-1}\cdot (n_{d-2}+N_{d-2}\cdot (\cdots +N_{2}n_{1})\cdots ))=\sum _{k=1}^{d}\left(\prod _{\ell =k+1}^{d}N_{\ell }\right)n_{k}} 1386:
Programming languages or their standard libraries that support multi-dimensional arrays typically have a native row-major or column-major storage order for these arrays.
1833: 1119: 825: 177: 2317:{\displaystyle n_{1}+N_{1}\cdot (n_{2}+N_{2}\cdot (n_{3}+N_{3}\cdot (\cdots +N_{d-1}n_{d})\cdots ))=\sum _{k=1}^{d}\left(\prod _{\ell =1}^{k-1}N_{\ell }\right)n_{k}} 1347: 1309: 1271: 1233: 1195: 1157: 1053: 1015: 977: 939: 901: 863: 1476:, which typically store pointers to elements in the same row contiguously (like row-major order), but not the rows themselves. They are used in (ordered by age): 144: 2611:
Initial values specified for an array are assigned to successive elements of the array in row-major order (final subscript varying most rapidly).
2335: 770:, multidimensional arrays are stored in row-major order, and the array indexes are written  row-first (lexicographical access order): 2472: 2812:
Because Scilab stores arrays in column major format, the elements of a column are adjacent (i.e. a separation of 1) in linear format.
2754: 179:
is in its first row and second column. This convention is carried over to the syntax in programming languages, although often with
2595: 1632: 1064:, arrays are stored in column-major order, while the array indexes are still written row-first (colexicographical access order): 62:, the orders can be generalized to arrays of any dimension by noting that the terms row-major and column-major are equivalent to 1602:, an array stored as row-major but read as column-major (or vice versa) will appear transposed. As actually performing this 1410: 1362:
as in Fortran, almost inevitably implies row-major order for syntactic reasons, so to speak, because it can be rewritten as
83: 1611: 1576:, which unfortunately muddled the convention that the designer sought to adopt, and this was even preserved in the 3107: 1711: 17: 2704: 1485: 1481: 1603: 1504: 1457: 1406: 3057: 1497: 1493: 1437: 735: 705: 640: 605: 575: 475: 2762:(Version 1.4 ed.), Cambridge, UK: MRC Biostatistics Unit, Institute of Public Health, archived from 2570: 2500: 2491:, another way of mapping multidimensional data to a one-dimensional index, useful in tree data structures 1477: 670: 540: 510: 445: 410: 380: 2644: 1580:
that was later added (although this also makes it possible to access coordinates by name instead, e.g.,
1374:
of its notation, and even the above implication could intentionally be circumvented in a new language.)
1519: 1425: 87: 2494: 115: 1587: 1449: 1441: 1390: 767: 2917: 3015: 2988: 1577: 3003:
If the storage order is not specified, then Eigen defaults to storing the entry in column-major.
2849: 2632:
index-type in the sequence and specifying the same component-type as the original specification.
2545: 111:. If two attributes participate in ordering, it is sufficient to name only the major attribute. 2467: 1780: 47: 2963: 2783: 2483: 1542: 1091: 797: 149: 79: 1325: 1287: 1249: 1211: 1173: 1135: 1031: 993: 955: 917: 879: 841: 3036: 2824: 2521: 180: 59: 51: 8: 2763: 2746: 1512: 204: 63: 2871: 2796: 2430: 129: 91: 2896: 2329: 1508: 2717: 3125: 2623: 1068:
Fortran: column-major order (colexicographical access order), one-based indexing
2095:
dimension is contiguous, so that the memory-offset of this element is given by:
1842:
dimension is contiguous, so that the memory-offset of this element is given by:
114:
In the case of arrays, the attributes are the indices along each dimension. For
2503:, the equivalent of turning a matrix into the corresponding column-major vector 1489: 3119: 2325: 1473: 30: 2419:{\textstyle \prod _{\ell =1}^{0}N_{\ell }=\prod _{\ell =d+1}^{d}N_{\ell }=1} 2488: 2477: 1414: 2454: 1546: 1398: 67: 1358:
with multi-step indexing as in C, as opposed to a neutral notation like
2750: 1433: 774:
C: row-major order (lexicographical access order), zero-based indexing
2480:, another difference between array types across programming languages 1599: 1557: 75: 2942: 86:
instructions that operate on vectors of data. In some media such as
1614:
functions are passed flags indicating which arrays are transposed.
1461: 2753:; Lunn, Dave (January 2003), "Formatting of data: S-Plus format", 2437:
is given by the multiplication value in parentheses before index
1622:
The concept generalizes to arrays with more than two dimensions.
1561: 1421: 1061: 34:
Illustration of difference between row- and column-major ordering
3112:, third edition, section 2.2.6 (Addison-Wesley: New York, 1997). 1590:(for Lua) changed from column-major to row-major default order. 3082: 1553: 1453: 1445: 1429: 103:
attribute participates in ordering, the first would be called
1706: 1535: 1394: 2745: 2741: 1681:{\displaystyle N_{1}\times N_{2}\times \cdots \times N_{d}} 1402: 82:. In addition, contiguous access makes it possible to use 1565: 1598:
As exchanging the indices of an array is the essence of
1518:
An alternative approach uses tables of tables, e.g., in
1472:
A typical alternative for dense array storage is to use
766:
Programming languages handle this in different ways. In
118:
in mathematical notation, the first index indicates the
2645:"SAS® 9.4 Language Reference: Concepts, Sixth Edition" 2338: 1381: 250: 2101: 1848: 1783: 1714: 1635: 1467: 1328: 1290: 1252: 1214: 1176: 1138: 1094: 1034: 996: 958: 920: 882: 844: 800: 738: 708: 673: 643: 608: 578: 543: 513: 478: 448: 413: 383: 219: 152: 132: 2650:. SAS Institute Inc. September 6, 2017. p. 573 2497:, a technique for storing sparse matrices in memory 1705:), a given element of this array is specified by a 1503:Even less dense is to use lists of lists, e.g., in 205:
lexicographic and colexicographic (or colex) orders
2418: 2316: 2081: 1827: 1765: 1680: 1341: 1303: 1265: 1227: 1189: 1151: 1113: 1047: 1009: 971: 933: 895: 857: 819: 753: 723: 688: 658: 623: 593: 558: 528: 493: 463: 428: 398: 347: 171: 138: 1617: 1568:because individual elements would be accessed as 3117: 2514: 2453:possible orders for a given array, one for each 2707:(retrieved from Mathworks.co.uk, January 2014). 58:and columns of a two-dimensional array, i.e. a 2943:"11.2 – Matrices and Multi-Dimensional Arrays" 2897:"The Python Standard Library: 8. Data Types" 2825:"Internal array representation in rasdaman" 2473:Comparison of programming languages (array) 1766:{\displaystyle (n_{1},n_{2},\ldots ,n_{d})} 97: 3083:"BLAS (Basic Linear Algebra Subprograms)" 2446:in the right-hand side summations above. 2699: 2697: 2596:"Language Reference Version 4 Release 3" 186:Even though the row is indicated by the 64:lexicographic and colexicographic orders 29: 2735: 27:Array representation in computer memory 14: 3118: 358:could be stored in two possible ways: 2694: 2671: 2669: 1541:Column-major order is the default in 1525: 754:{\displaystyle \color {Orange}a_{23}} 739: 724:{\displaystyle \color {Orange}a_{23}} 709: 674: 659:{\displaystyle \color {Orange}a_{22}} 644: 624:{\displaystyle \color {Orange}a_{22}} 609: 594:{\displaystyle \color {Orange}a_{21}} 579: 544: 514: 494:{\displaystyle \color {Orange}a_{21}} 479: 449: 414: 384: 325: 311: 297: 281: 267: 253: 2571:"Why numbering should start at zero" 2964:"The N-dimensional array (ndarray)" 2677:"Columns, Rows, and Array Majority" 1382:Programming languages and libraries 689:{\displaystyle \color {Blue}a_{13}} 559:{\displaystyle \color {Blue}a_{12}} 529:{\displaystyle \color {Blue}a_{13}} 464:{\displaystyle \color {Blue}a_{12}} 429:{\displaystyle \color {Blue}a_{11}} 399:{\displaystyle \color {Blue}a_{11}} 24: 2666: 1534:Row-major order is the default in 1468:Neither row-major nor column-major 94:faster than nonsequential access. 25: 3137: 2797:"FFTs with multidimensional data" 3110:Volume 1: Fundamental Algorithms 3016:"Column Vectors Vs. Row Vectors" 1612:Basic Linear Algebra Subprograms 1593: 199:index and column-major from the 3108:The Art of Computer Programming 3075: 3050: 3029: 3008: 2981: 2956: 2935: 2910: 2889: 2864: 2842: 2817: 2789: 2773: 122:, and the second indicates the 3062:Torch Package Reference Manual 2710: 2637: 2616: 2588: 2563: 2538: 2230: 2227: 2221: 2186: 2157: 2128: 1995: 1992: 1986: 1957: 1916: 1875: 1822: 1797: 1760: 1715: 1618:Address calculation in general 1420:Column-major order is used in 13: 1: 2850:"Java Language Specification" 2681:www.nv5geospatialsoftware.com 2507: 190:index and the column by the 90:, accessing sequentially is 7: 2501:Vectorization (mathematics) 2461: 2091:In column-major order, the 1389:Row-major order is used in 10: 3142: 3099: 2742:Spiegelhalter et al. (2003 2718:"Multi-dimensional Arrays" 2546:"Arrays and Formatted I/O" 2449:More generally, there are 88:magnetic-tape data storage 50:in linear storage such as 1828:{\displaystyle n_{k}\in } 2756:WinBUGS User Manual 1838:In row-major order, the 1552:A special case would be 46:are methods for storing 2989:"Eigen: Storage orders" 2786:(retrieved March 2010). 2429:For a given order, the 1604:rearrangement in memory 1578:OpenGL Shading Language 1114:{\displaystyle a_{y,x}} 820:{\displaystyle a_{y,x}} 210:For example, the array 172:{\displaystyle a_{1,2}} 126:, e.g., given a matrix 98:Explanation and example 78:which exploits spatial 48:multidimensional arrays 2918:"Vectors and Matrices" 2876:Scala Standard Library 2703:MATLAB documentation, 2624:"ISO/IEC 7185:1990(E)" 2575:E. W. Dijkstra Archive 2468:Array (data structure) 2420: 2399: 2359: 2328:is the multiplicative 2318: 2288: 2256: 2083: 2053: 2021: 1829: 1767: 1688:array with dimensions 1682: 1401:(for C-style arrays), 1343: 1342:{\displaystyle a_{23}} 1305: 1304:{\displaystyle a_{13}} 1267: 1266:{\displaystyle a_{22}} 1229: 1228:{\displaystyle a_{12}} 1191: 1190:{\displaystyle a_{21}} 1153: 1152:{\displaystyle a_{11}} 1115: 1060:On the other hand, in 1049: 1048:{\displaystyle a_{23}} 1011: 1010:{\displaystyle a_{22}} 973: 972:{\displaystyle a_{21}} 935: 934:{\displaystyle a_{13}} 897: 896:{\displaystyle a_{12}} 859: 858:{\displaystyle a_{11}} 821: 755: 725: 690: 660: 625: 595: 560: 530: 495: 465: 430: 400: 349: 173: 140: 35: 2484:Matrix representation 2421: 2373: 2339: 2319: 2262: 2236: 2084: 2027: 2001: 1830: 1777:(zero-based) indices 1768: 1683: 1344: 1306: 1268: 1230: 1192: 1154: 1116: 1050: 1012: 974: 936: 898: 860: 822: 756: 726: 691: 661: 626: 596: 561: 531: 496: 466: 431: 401: 350: 181:indexes starting at 0 174: 141: 80:locality of reference 33: 2780:An Introduction to R 2747:Spiegelhalter, David 2336: 2099: 1846: 1781: 1712: 1633: 1354:Note how the use of 1326: 1288: 1250: 1212: 1174: 1136: 1092: 1032: 994: 956: 918: 880: 842: 798: 736: 706: 671: 641: 606: 576: 541: 511: 476: 446: 411: 381: 217: 150: 130: 52:random access memory 2993:eigen.tuxfamily.org 2784:Section 5.1: Arrays 2705:MATLAB Data Storage 1600:array transposition 1513:Wolfram Mathematica 1069: 775: 370:Column-major order 92:orders of magnitude 2749:; Thomas, Andrew; 2416: 2314: 2079: 1825: 1763: 1678: 1526:External libraries 1339: 1301: 1263: 1225: 1187: 1149: 1111: 1067: 1045: 1007: 969: 931: 893: 855: 817: 773: 751: 750: 721: 720: 686: 685: 656: 655: 621: 620: 591: 590: 556: 555: 526: 525: 491: 490: 461: 460: 426: 425: 396: 395: 345: 339: 336: 322: 308: 292: 278: 264: 203:index, leading to 169: 136: 44:column-major order 36: 3105:Donald E. Knuth, 2526:Peter Lars Dordal 1610:For example, the 1572:or, effectively, 1352: 1351: 1058: 1057: 764: 763: 139:{\displaystyle A} 16:(Redirected from 3133: 3093: 3092: 3090: 3089: 3079: 3073: 3072: 3070: 3068: 3054: 3048: 3047: 3045: 3043: 3033: 3027: 3026: 3024: 3022: 3012: 3006: 3005: 3000: 2999: 2985: 2979: 2978: 2976: 2974: 2960: 2954: 2953: 2951: 2949: 2939: 2933: 2932: 2930: 2928: 2914: 2908: 2907: 2905: 2903: 2893: 2887: 2886: 2884: 2882: 2868: 2862: 2861: 2859: 2857: 2846: 2840: 2839: 2837: 2835: 2821: 2815: 2814: 2809: 2807: 2793: 2787: 2777: 2771: 2770: 2768: 2761: 2739: 2733: 2732: 2730: 2728: 2714: 2708: 2701: 2692: 2691: 2689: 2687: 2673: 2664: 2663: 2657: 2655: 2649: 2641: 2635: 2634: 2628: 2620: 2614: 2613: 2608: 2606: 2600: 2592: 2586: 2585: 2583: 2581: 2567: 2561: 2560: 2558: 2556: 2550:FORTRAN Tutorial 2542: 2536: 2535: 2533: 2532: 2518: 2425: 2423: 2422: 2417: 2409: 2408: 2398: 2393: 2369: 2368: 2358: 2353: 2330:identity element 2323: 2321: 2320: 2315: 2313: 2312: 2303: 2299: 2298: 2297: 2287: 2276: 2255: 2250: 2220: 2219: 2210: 2209: 2182: 2181: 2169: 2168: 2153: 2152: 2140: 2139: 2124: 2123: 2111: 2110: 2088: 2086: 2085: 2080: 2078: 2077: 2068: 2064: 2063: 2062: 2052: 2047: 2020: 2015: 1985: 1984: 1975: 1974: 1953: 1952: 1934: 1933: 1912: 1911: 1893: 1892: 1871: 1870: 1858: 1857: 1834: 1832: 1831: 1826: 1815: 1814: 1793: 1792: 1772: 1770: 1769: 1764: 1759: 1758: 1740: 1739: 1727: 1726: 1687: 1685: 1684: 1679: 1677: 1676: 1658: 1657: 1645: 1644: 1583: 1575: 1571: 1549:(both for C++). 1509:Wolfram Language 1369: 1365: 1361: 1357: 1348: 1346: 1345: 1340: 1338: 1337: 1320: 1310: 1308: 1307: 1302: 1300: 1299: 1282: 1272: 1270: 1269: 1264: 1262: 1261: 1244: 1234: 1232: 1231: 1226: 1224: 1223: 1206: 1196: 1194: 1193: 1188: 1186: 1185: 1168: 1158: 1156: 1155: 1150: 1148: 1147: 1130: 1120: 1118: 1117: 1112: 1110: 1109: 1084: 1077: 1070: 1066: 1054: 1052: 1051: 1046: 1044: 1043: 1026: 1016: 1014: 1013: 1008: 1006: 1005: 988: 978: 976: 975: 970: 968: 967: 950: 940: 938: 937: 932: 930: 929: 912: 902: 900: 899: 894: 892: 891: 874: 864: 862: 861: 856: 854: 853: 836: 826: 824: 823: 818: 816: 815: 790: 783: 776: 772: 760: 758: 757: 752: 749: 748: 730: 728: 727: 722: 719: 718: 695: 693: 692: 687: 684: 683: 665: 663: 662: 657: 654: 653: 630: 628: 627: 622: 619: 618: 600: 598: 597: 592: 589: 588: 565: 563: 562: 557: 554: 553: 535: 533: 532: 527: 524: 523: 500: 498: 497: 492: 489: 488: 470: 468: 467: 462: 459: 458: 435: 433: 432: 427: 424: 423: 405: 403: 402: 397: 394: 393: 367:Row-major order 361: 360: 354: 352: 351: 346: 344: 343: 335: 334: 321: 320: 307: 306: 291: 290: 277: 276: 263: 262: 241: 240: 207:, respectively. 178: 176: 175: 170: 168: 167: 145: 143: 142: 137: 21: 3141: 3140: 3136: 3135: 3134: 3132: 3131: 3130: 3116: 3115: 3102: 3097: 3096: 3087: 3085: 3081: 3080: 3076: 3066: 3064: 3056: 3055: 3051: 3041: 3039: 3035: 3034: 3030: 3020: 3018: 3014: 3013: 3009: 2997: 2995: 2987: 2986: 2982: 2972: 2970: 2962: 2961: 2957: 2947: 2945: 2941: 2940: 2936: 2926: 2924: 2916: 2915: 2911: 2901: 2899: 2895: 2894: 2890: 2880: 2878: 2870: 2869: 2865: 2855: 2853: 2848: 2847: 2843: 2833: 2831: 2823: 2822: 2818: 2805: 2803: 2795: 2794: 2790: 2778: 2774: 2766: 2759: 2744:, p. 17): 2740: 2736: 2726: 2724: 2716: 2715: 2711: 2702: 2695: 2685: 2683: 2675: 2674: 2667: 2653: 2651: 2647: 2643: 2642: 2638: 2626: 2622: 2621: 2617: 2604: 2602: 2598: 2594: 2593: 2589: 2579: 2577: 2569: 2568: 2564: 2554: 2552: 2544: 2543: 2539: 2530: 2528: 2520: 2519: 2515: 2510: 2464: 2445: 2404: 2400: 2394: 2377: 2364: 2360: 2354: 2343: 2337: 2334: 2333: 2308: 2304: 2293: 2289: 2277: 2266: 2261: 2257: 2251: 2240: 2215: 2211: 2199: 2195: 2177: 2173: 2164: 2160: 2148: 2144: 2135: 2131: 2119: 2115: 2106: 2102: 2100: 2097: 2096: 2073: 2069: 2058: 2054: 2048: 2031: 2026: 2022: 2016: 2005: 1980: 1976: 1970: 1966: 1942: 1938: 1923: 1919: 1901: 1897: 1882: 1878: 1866: 1862: 1853: 1849: 1847: 1844: 1843: 1810: 1806: 1788: 1784: 1782: 1779: 1778: 1754: 1750: 1735: 1731: 1722: 1718: 1713: 1710: 1709: 1696: 1672: 1668: 1653: 1649: 1640: 1636: 1634: 1631: 1630: 1620: 1596: 1581: 1573: 1569: 1528: 1470: 1384: 1367: 1363: 1359: 1355: 1333: 1329: 1327: 1324: 1323: 1318: 1295: 1291: 1289: 1286: 1285: 1280: 1257: 1253: 1251: 1248: 1247: 1242: 1219: 1215: 1213: 1210: 1209: 1204: 1181: 1177: 1175: 1172: 1171: 1166: 1143: 1139: 1137: 1134: 1133: 1128: 1099: 1095: 1093: 1090: 1089: 1088: 1082: 1081: 1075: 1074: 1039: 1035: 1033: 1030: 1029: 1024: 1001: 997: 995: 992: 991: 986: 963: 959: 957: 954: 953: 948: 925: 921: 919: 916: 915: 910: 887: 883: 881: 878: 877: 872: 849: 845: 843: 840: 839: 834: 805: 801: 799: 796: 795: 794: 788: 787: 781: 780: 744: 740: 737: 734: 733: 714: 710: 707: 704: 703: 679: 675: 672: 669: 668: 649: 645: 642: 639: 638: 614: 610: 607: 604: 603: 584: 580: 577: 574: 573: 549: 545: 542: 539: 538: 519: 515: 512: 509: 508: 484: 480: 477: 474: 473: 454: 450: 447: 444: 443: 419: 415: 412: 409: 408: 389: 385: 382: 379: 378: 338: 337: 330: 326: 323: 316: 312: 309: 302: 298: 294: 293: 286: 282: 279: 272: 268: 265: 258: 254: 246: 245: 230: 226: 218: 215: 214: 157: 153: 151: 148: 147: 131: 128: 127: 100: 40:row-major order 28: 23: 22: 18:Row-major order 15: 12: 11: 5: 3139: 3129: 3128: 3114: 3113: 3101: 3098: 3095: 3094: 3074: 3049: 3028: 3007: 2980: 2955: 2934: 2909: 2888: 2872:"object Array" 2863: 2841: 2816: 2788: 2772: 2734: 2709: 2693: 2665: 2636: 2615: 2587: 2562: 2537: 2522:"Cache Memory" 2512: 2511: 2509: 2506: 2505: 2504: 2498: 2492: 2486: 2481: 2475: 2470: 2463: 2460: 2441: 2415: 2412: 2407: 2403: 2397: 2392: 2389: 2386: 2383: 2380: 2376: 2372: 2367: 2363: 2357: 2352: 2349: 2346: 2342: 2311: 2307: 2302: 2296: 2292: 2286: 2283: 2280: 2275: 2272: 2269: 2265: 2260: 2254: 2249: 2246: 2243: 2239: 2235: 2232: 2229: 2226: 2223: 2218: 2214: 2208: 2205: 2202: 2198: 2194: 2191: 2188: 2185: 2180: 2176: 2172: 2167: 2163: 2159: 2156: 2151: 2147: 2143: 2138: 2134: 2130: 2127: 2122: 2118: 2114: 2109: 2105: 2076: 2072: 2067: 2061: 2057: 2051: 2046: 2043: 2040: 2037: 2034: 2030: 2025: 2019: 2014: 2011: 2008: 2004: 2000: 1997: 1994: 1991: 1988: 1983: 1979: 1973: 1969: 1965: 1962: 1959: 1956: 1951: 1948: 1945: 1941: 1937: 1932: 1929: 1926: 1922: 1918: 1915: 1910: 1907: 1904: 1900: 1896: 1891: 1888: 1885: 1881: 1877: 1874: 1869: 1865: 1861: 1856: 1852: 1824: 1821: 1818: 1813: 1809: 1805: 1802: 1799: 1796: 1791: 1787: 1762: 1757: 1753: 1749: 1746: 1743: 1738: 1734: 1730: 1725: 1721: 1717: 1692: 1675: 1671: 1667: 1664: 1661: 1656: 1652: 1648: 1643: 1639: 1619: 1616: 1607:computation). 1595: 1592: 1538:(for Python). 1527: 1524: 1474:Iliffe vectors 1469: 1466: 1383: 1380: 1350: 1349: 1336: 1332: 1321: 1316: 1312: 1311: 1298: 1294: 1283: 1278: 1274: 1273: 1260: 1256: 1245: 1240: 1236: 1235: 1222: 1218: 1207: 1202: 1198: 1197: 1184: 1180: 1169: 1164: 1160: 1159: 1146: 1142: 1131: 1126: 1122: 1121: 1108: 1105: 1102: 1098: 1085: 1078: 1056: 1055: 1042: 1038: 1027: 1022: 1018: 1017: 1004: 1000: 989: 984: 980: 979: 966: 962: 951: 946: 942: 941: 928: 924: 913: 908: 904: 903: 890: 886: 875: 870: 866: 865: 852: 848: 837: 832: 828: 827: 814: 811: 808: 804: 791: 784: 762: 761: 747: 743: 731: 717: 713: 701: 697: 696: 682: 678: 666: 652: 648: 636: 632: 631: 617: 613: 601: 587: 583: 571: 567: 566: 552: 548: 536: 522: 518: 506: 502: 501: 487: 483: 471: 457: 453: 441: 437: 436: 422: 418: 406: 392: 388: 376: 372: 371: 368: 365: 356: 355: 342: 333: 329: 324: 319: 315: 310: 305: 301: 296: 295: 289: 285: 280: 275: 271: 266: 261: 257: 252: 251: 249: 244: 239: 236: 233: 229: 225: 222: 183:instead of 1. 166: 163: 160: 156: 135: 99: 96: 70:respectively. 38:In computing, 26: 9: 6: 4: 3: 2: 3138: 3127: 3124: 3123: 3121: 3111: 3109: 3104: 3103: 3084: 3078: 3063: 3059: 3053: 3038: 3032: 3017: 3011: 3004: 2994: 2990: 2984: 2969: 2965: 2959: 2944: 2938: 2923: 2919: 2913: 2898: 2892: 2877: 2873: 2867: 2851: 2845: 2830: 2826: 2820: 2813: 2802: 2798: 2792: 2785: 2781: 2776: 2769:on 2003-05-18 2765: 2758: 2757: 2752: 2748: 2743: 2738: 2723: 2719: 2713: 2706: 2700: 2698: 2682: 2678: 2672: 2670: 2662: 2646: 2640: 2633: 2625: 2619: 2612: 2597: 2591: 2576: 2572: 2566: 2551: 2547: 2541: 2527: 2523: 2517: 2513: 2502: 2499: 2496: 2493: 2490: 2487: 2485: 2482: 2479: 2476: 2474: 2471: 2469: 2466: 2465: 2459: 2456: 2452: 2447: 2444: 2440: 2436: 2433:in dimension 2432: 2427: 2413: 2410: 2405: 2401: 2395: 2390: 2387: 2384: 2381: 2378: 2374: 2370: 2365: 2361: 2355: 2350: 2347: 2344: 2340: 2331: 2327: 2326:empty product 2309: 2305: 2300: 2294: 2290: 2284: 2281: 2278: 2273: 2270: 2267: 2263: 2258: 2252: 2247: 2244: 2241: 2237: 2233: 2224: 2216: 2212: 2206: 2203: 2200: 2196: 2192: 2189: 2183: 2178: 2174: 2170: 2165: 2161: 2154: 2149: 2145: 2141: 2136: 2132: 2125: 2120: 2116: 2112: 2107: 2103: 2094: 2089: 2074: 2070: 2065: 2059: 2055: 2049: 2044: 2041: 2038: 2035: 2032: 2028: 2023: 2017: 2012: 2009: 2006: 2002: 1998: 1989: 1981: 1977: 1971: 1967: 1963: 1960: 1954: 1949: 1946: 1943: 1939: 1935: 1930: 1927: 1924: 1920: 1913: 1908: 1905: 1902: 1898: 1894: 1889: 1886: 1883: 1879: 1872: 1867: 1863: 1859: 1854: 1850: 1841: 1836: 1819: 1816: 1811: 1807: 1803: 1800: 1794: 1789: 1785: 1776: 1755: 1751: 1747: 1744: 1741: 1736: 1732: 1728: 1723: 1719: 1708: 1704: 1700: 1695: 1691: 1673: 1669: 1665: 1662: 1659: 1654: 1650: 1646: 1641: 1637: 1629:-dimensional 1628: 1623: 1615: 1613: 1608: 1605: 1601: 1594:Transposition 1591: 1589: 1585: 1579: 1567: 1563: 1559: 1555: 1550: 1548: 1544: 1539: 1537: 1532: 1523: 1521: 1516: 1514: 1510: 1507:, and in the 1506: 1501: 1499: 1495: 1491: 1487: 1483: 1479: 1475: 1465: 1463: 1459: 1455: 1451: 1447: 1443: 1439: 1435: 1431: 1427: 1423: 1418: 1416: 1412: 1408: 1404: 1400: 1396: 1392: 1387: 1379: 1375: 1373: 1334: 1330: 1322: 1317: 1314: 1313: 1296: 1292: 1284: 1279: 1276: 1275: 1258: 1254: 1246: 1241: 1238: 1237: 1220: 1216: 1208: 1203: 1200: 1199: 1182: 1178: 1170: 1165: 1162: 1161: 1144: 1140: 1132: 1127: 1124: 1123: 1106: 1103: 1100: 1096: 1086: 1079: 1076:y + N_y*(x-1) 1072: 1071: 1065: 1063: 1040: 1036: 1028: 1023: 1020: 1019: 1002: 998: 990: 985: 982: 981: 964: 960: 952: 947: 944: 943: 926: 922: 914: 909: 906: 905: 888: 884: 876: 871: 868: 867: 850: 846: 838: 833: 830: 829: 812: 809: 806: 802: 792: 785: 778: 777: 771: 769: 745: 741: 732: 715: 711: 702: 699: 698: 680: 676: 667: 650: 646: 637: 634: 633: 615: 611: 602: 585: 581: 572: 569: 568: 550: 546: 537: 520: 516: 507: 504: 503: 485: 481: 472: 455: 451: 442: 439: 438: 420: 416: 407: 390: 386: 377: 374: 373: 369: 366: 363: 362: 359: 340: 331: 327: 317: 313: 303: 299: 287: 283: 273: 269: 259: 255: 247: 242: 237: 234: 231: 227: 223: 220: 213: 212: 211: 208: 206: 202: 198: 193: 189: 184: 182: 164: 161: 158: 154: 133: 125: 121: 117: 112: 110: 107:and the last 106: 95: 93: 89: 85: 81: 77: 71: 69: 65: 61: 55: 53: 49: 45: 41: 32: 19: 3106: 3086:. Retrieved 3077: 3065:. Retrieved 3061: 3052: 3040:. Retrieved 3031: 3019:. Retrieved 3010: 3002: 2996:. Retrieved 2992: 2983: 2971:. Retrieved 2967: 2958: 2946:. Retrieved 2937: 2925:. Retrieved 2921: 2912: 2900:. Retrieved 2891: 2879:. Retrieved 2875: 2866: 2854:. Retrieved 2844: 2832:. Retrieved 2829:rasdaman.org 2828: 2819: 2811: 2804:. Retrieved 2800: 2791: 2779: 2775: 2764:the original 2755: 2737: 2725:. Retrieved 2721: 2712: 2684:. Retrieved 2680: 2659: 2652:. Retrieved 2639: 2630: 2618: 2610: 2603:. Retrieved 2590: 2578:. Retrieved 2574: 2565: 2553:. Retrieved 2549: 2540: 2529:. Retrieved 2525: 2516: 2489:Morton order 2478:Index origin 2450: 2448: 2442: 2438: 2434: 2428: 2092: 2090: 1839: 1837: 1774: 1702: 1698: 1693: 1689: 1626: 1624: 1621: 1609: 1597: 1586: 1551: 1540: 1533: 1529: 1517: 1502: 1471: 1419: 1388: 1385: 1376: 1371: 1353: 1059: 765: 357: 209: 200: 196: 191: 187: 185: 146:, the entry 123: 119: 113: 108: 104: 101: 72: 56: 43: 39: 37: 3021:12 November 2927:12 November 2902:18 November 2856:13 February 2806:25 November 2801:Scilab Wiki 2751:Best, Nicky 2654:18 November 2605:13 November 2555:19 November 2455:permutation 1399:Objective-C 76:CPU caching 68:AoS and SoA 3088:2015-05-16 3042:6 February 2998:2017-11-23 2948:6 February 2727:9 November 2580:2 February 2531:2021-04-10 2508:References 2495:CSR format 2324:where the 1434:GNU Octave 1366:, and the 2968:SciPy.org 2406:ℓ 2379:ℓ 2375:∏ 2366:ℓ 2345:ℓ 2341:∏ 2295:ℓ 2282:− 2268:ℓ 2264:∏ 2238:∑ 2225:⋯ 2204:− 2190:⋯ 2184:⋅ 2155:⋅ 2126:⋅ 2060:ℓ 2033:ℓ 2029:∏ 2003:∑ 1990:⋯ 1961:⋯ 1955:⋅ 1947:− 1928:− 1914:⋅ 1906:− 1887:− 1873:⋅ 1817:− 1795:∈ 1745:… 1666:× 1663:⋯ 1660:× 1647:× 1558:OpenGL ES 1547:Armadillo 1411:Speakeasy 782:x + N_x*y 201:rightmost 3120:Category 3058:"Tensor" 3037:"Tensor" 2852:. Oracle 2462:See also 2332:, i.e., 1462:Rasdaman 364:Address 197:leftmost 116:matrices 3100:Sources 2973:3 April 2922:Wolfram 2686:31 July 2661:order). 1562:IRIS GL 1422:Fortran 1372:because 1073:Address 1062:Fortran 779:Address 3126:Arrays 2834:29 May 2431:stride 1625:For a 1554:OpenGL 1505:Python 1496:, and 1460:, and 1458:Yorick 1454:Scilab 1446:S-PLUS 1430:MATLAB 1413:, and 1407:Pascal 1360:A(i,j) 1319:A(2,3) 1281:A(1,3) 1243:A(2,2) 1205:A(1,2) 1167:A(2,1) 1129:A(1,1) 1083:A(y,x) 1080:Access 786:Access 192:second 124:column 60:matrix 3067:8 May 2881:1 May 2767:(PDF) 2760:(PDF) 2722:Julia 2648:(PDF) 2627:(PDF) 2601:. IBM 2599:(PDF) 2093:first 1707:tuple 1701:=1... 1588:Torch 1556:(and 1543:Eigen 1536:NumPy 1498:Swift 1494:Scala 1438:Julia 1087:Value 793:Value 188:first 109:minor 105:major 3069:2016 3044:2016 3023:2017 2975:2016 2950:2016 2929:2017 2904:2017 2883:2016 2858:2016 2836:2022 2808:2017 2729:2020 2688:2024 2656:2017 2607:2017 2582:2017 2557:2016 1840:last 1545:and 1490:.Net 1478:Java 1403:PL/I 84:SIMD 42:and 1773:of 1582:M.y 1566:API 1520:Lua 1511:of 1486:CLI 1426:IDL 1415:SAS 1395:C++ 1364:(A) 120:row 3122:: 3060:. 3001:. 2991:. 2966:. 2920:. 2874:. 2827:. 2810:. 2799:. 2782:, 2720:. 2696:^ 2679:. 2668:^ 2658:. 2629:. 2609:. 2573:. 2548:. 2524:. 2451:d! 2426:. 1835:. 1522:. 1515:. 1500:. 1492:, 1482:C# 1480:, 1464:. 1456:, 1452:, 1448:, 1444:, 1440:, 1436:, 1432:, 1428:, 1424:, 1417:. 1409:, 1405:, 1335:23 1315:6 1297:13 1277:5 1259:22 1239:4 1221:12 1201:3 1183:21 1163:2 1145:11 1125:1 1041:23 1021:5 1003:22 983:4 965:21 945:3 927:13 907:2 889:12 869:1 851:11 831:0 746:23 716:23 700:5 681:13 651:22 635:4 616:22 586:21 570:3 551:12 521:13 505:2 486:21 456:12 440:1 421:11 391:11 375:0 332:23 318:22 304:21 288:13 274:12 260:11 54:. 3091:. 3071:. 3046:. 3025:. 2977:. 2952:. 2931:. 2906:. 2885:. 2860:. 2838:. 2731:. 2690:. 2584:. 2559:. 2534:. 2443:k 2439:n 2435:k 2414:1 2411:= 2402:N 2396:d 2391:1 2388:+ 2385:d 2382:= 2371:= 2362:N 2356:0 2351:1 2348:= 2310:k 2306:n 2301:) 2291:N 2285:1 2279:k 2274:1 2271:= 2259:( 2253:d 2248:1 2245:= 2242:k 2234:= 2231:) 2228:) 2222:) 2217:d 2213:n 2207:1 2201:d 2197:N 2193:+ 2187:( 2179:3 2175:N 2171:+ 2166:3 2162:n 2158:( 2150:2 2146:N 2142:+ 2137:2 2133:n 2129:( 2121:1 2117:N 2113:+ 2108:1 2104:n 2075:k 2071:n 2066:) 2056:N 2050:d 2045:1 2042:+ 2039:k 2036:= 2024:( 2018:d 2013:1 2010:= 2007:k 1999:= 1996:) 1993:) 1987:) 1982:1 1978:n 1972:2 1968:N 1964:+ 1958:( 1950:2 1944:d 1940:N 1936:+ 1931:2 1925:d 1921:n 1917:( 1909:1 1903:d 1899:N 1895:+ 1890:1 1884:d 1880:n 1876:( 1868:d 1864:N 1860:+ 1855:d 1851:n 1823:] 1820:1 1812:k 1808:N 1804:, 1801:0 1798:[ 1790:k 1786:n 1775:d 1761:) 1756:d 1752:n 1748:, 1742:, 1737:2 1733:n 1729:, 1724:1 1720:n 1716:( 1703:d 1699:k 1697:( 1694:k 1690:N 1674:d 1670:N 1655:2 1651:N 1642:1 1638:N 1627:d 1574:M 1570:M 1488:/ 1484:/ 1450:R 1442:S 1397:/ 1393:/ 1391:C 1368:A 1356:A 1331:a 1293:a 1255:a 1217:a 1179:a 1141:a 1107:x 1104:, 1101:y 1097:a 1037:a 1025:A 999:a 987:A 961:a 949:A 923:a 911:A 885:a 873:A 847:a 835:A 813:x 810:, 807:y 803:a 789:A 768:C 742:a 712:a 677:a 647:a 612:a 582:a 547:a 517:a 482:a 452:a 417:a 387:a 341:] 328:a 314:a 300:a 284:a 270:a 256:a 248:[ 243:= 238:x 235:, 232:y 228:a 224:= 221:A 165:2 162:, 159:1 155:a 134:A 20:)

Index

Row-major order

multidimensional arrays
random access memory
matrix
lexicographic and colexicographic orders
AoS and SoA
CPU caching
locality of reference
SIMD
magnetic-tape data storage
orders of magnitude
matrices
indexes starting at 0
lexicographic and colexicographic (or colex) orders
C
Fortran
C
C++
Objective-C
PL/I
Pascal
Speakeasy
SAS
Fortran
IDL
MATLAB
GNU Octave
Julia
S

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.