0-based indexing

Definition: Indexing (an array) beginning with 0.

Note: That is, an array A with n items is accessed as A[0], A[1], ..., A[n-1].

one-based indexing

Definition: Indexing (an array) beginning with 1.

Note: That is, an array A with n items is accessed as A[1], A[2], ..., A[n].

lower triangular matrix

Definition: A matrix that is only defined at (i,j) when i ≥ j.

Note: For example

 

j

i

1

-

-

-

7

7

-

-

1

0

1

-

1

9

5

4

It may be more compactly represented in an array by storing entry (i,j) in location

 i(i-1)/2 + j (one-based indexing).

 

upper triangular matrix

Definition: A matrix that is only defined at (i,j) when i ≤ j.

 

 

 

Note: For example

 

j

i

1

7

7

6

-

9

1

1

-

-

8

8

-

-

-

1

It may be more compactly represented in an array by storing entry (i,j) in location n(i-1) + j - i(i-1)/2 = (2n-i)(i-1)/2 + j one-based indexing.

 

strictly upper triangular matrix

Definition: A matrix that is only defined at (i,j) when i < j.

Note: For example

 

j

i

-

7

7

6

-

-

1

1

-

-

-

8

-

-

-

-

It may be more compactly represented in an array by storing entry (i,j) in location n(i-1) + j - i(i-1)/2 - i = (2n-i)(i-1)/2 - i + j (one-based indexing).

 

strictly lower triangular matrix

 

Definition: A matrix that is only defined at (i,j) when i > j.

 

 

 

Note: For example

 

j

i

-

-

-

-

7

-

-

-

1

0

-

-

1

9

5

-

It may be more compactly represented in an array by storing entry (i,j) in location (i-1)(i-2)/2 + j (one-based indexing).