## Developer Reference

• 2020.2
• 07/15/2020
• Public Content
Contents

# Matrix Arguments

Matrix arguments of the
Intel®
Math Kernel Library
routines can be stored in
either one- or two-dimensional
arrays, using the following storage schemes:
Full storage
is the simplest scheme.
A matrix
A
is stored in a two-dimensional array
a
, with the matrix element
a
ij
stored in the array element
a
(
i
,
j
)
. , where
lda
is the leading dimension of array
a
.
If a matrix is triangular (upper or lower, as specified by the argument
uplo
), only the elements of the relevant triangle are stored; the remaining elements of the array need not be set.
Routines that handle symmetric or Hermitian matrices allow for either the upper or lower triangle of the matrix to be stored in the corresponding elements of the array:
if
uplo
='U'
,
a
ij
is stored as described for
i

j
, other elements of
a
need not be set.
if
uplo
='L',
a
ij
is stored as described for
j

i
, other elements of
a
need not be set.
Packed storage
allows you to store symmetric, Hermitian, or triangular matrices more compactly: the relevant triangle (again, as specified by the argument
uplo
) is packed by columns in a one-dimensional array
ap
:
if
uplo
='U',
a
ij
is stored in
ap
(
i
+
j
(
j
- 1)/2)
for
i

j
if
uplo
='L'
,
a
ij
is stored in
ap
(
i
+ (2*
n
-
j
)*(
j
- 1)/2)
for
j

i
.
In descriptions of LAPACK routines, arrays with packed matrices have names ending in
p
.
Band storage
is as follows: an
m
-by-
n
band matrix with
kl
non-zero sub-diagonals and
ku
non-zero super-diagonals is stored compactly in
a two-dimensional array
ab
with
kl
+
ku
+ 1 rows and
n
columns. Columns of the matrix are stored in the corresponding columns of the array, and diagonals of the matrix are stored in rows of the array
. Thus,
a
ij
is stored in
ab
(
ku
+1+
i
-
j
,
j
) for max(1,
j
-
ku

i

min(
n
,
j
+
kl
).
Use the band storage scheme only when
kl
and
ku
are much less than the matrix size
n
. Although the routines work correctly for all values of
kl
and
ku
, using the band storage is inefficient if your matrices are not really banded.
The band storage scheme is illustrated by the following example, when
```

m

=

n

= 6,

kl

= 2,

ku

= 1```
Array elements marked * are not used by the routines: When a general band matrix is supplied for LU factorization , space must be allowed to store
kl
additional super-diagonals generated by fill-in as a result of row interchanges. This means that the matrix is stored according to the above scheme, but with
kl
+
ku
super-diagonals. Thus,
a
ij
is stored in
ab
(
kl
+
ku
+1+
i
-
j
,
j
)
for
max(1,
j
-
ku

i

min(
n
,
j
+
kl
)
.
The band storage scheme for LU factorization is illustrated by th