This file is indexed.

/usr/share/SuperCollider/HelpSource/Classes/Array2D.schelp is in supercollider-common 1:3.8.0~repack-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
CLASS::Array2D
summary::two-dimensional array
related::Classes/Array
categories::Collections>Ordered

DESCRIPTION::
Represents a two-dimensional array of data. The number of rows and columns is fixed.

note:: It is possible to implement a similar behaviour using an "array-of-arrays" - see the examples towards the bottom of this page for comparison.::

CLASSMETHODS::

method::new
Create an array of the specified size.
code::
a = Array2D.new(3,4);
a[2,2] = 1;
a.postln
::

method::fromArray
Build an Array2D from the supplied array.
code::
a = Array2D.fromArray(3,4, [9,8,7,6,5,4,3,2,1,2,3,4]);
a[2,2] = 1;
a.postln
::

INSTANCEMETHODS::

private::printOn, storeOn

method::at
Get a value from the array.
code::
a.at(2,3);
a[2,3];
::

method::put
Put a value into the array.
code::
a.put(2,3, 72);
a[2,3] = 72;
::

method::colsDo
Iterate over the columns. Each column will be passed to strong::func:: in turn.
code::
a.colsDo(_.postln);
::

method::rowsDo
Iterate over the rows. Each row will be passed to strong::func:: in turn.
code::
a.rowsDo(_.postln);
::

method::colAt
Retrieve a single column.
code::
a.colAt(2);
::

method::rowAt
Retrieve a single row.
code::
a.rowAt(2);
::

method::asArray
Return a flat array containing the elements.
code::
a.postln;
a.asArray.postln;
::
returns:: link::Classes/Array::

EXAMPLES::

code::
// "a" is an array-of-arrays
a = { { 100.0.rand }.dup(100) }.dup(100);
// "b" is an equivalent Array2D, made using the "fromArray" class method
b = Array2D.fromArray(100,100, a.flat);

// Accessing
a[15][22]
b[15, 22]

// Speed comparison 1: random access
bench { 100.do(a[100.rand][100.rand]) }
bench { 100.do(b[100.rand, 100.rand]) }

// Speed comparison 2: iteration
bench { 100.do(a.do { |row| row.do { |item| item * 2 } }) }
bench { 100.do(b.do { |item| item * 2 }) }
::