   # linalg - linear algebra primitives

```include "math.m";

dot         : fn(x, y: array of real)  : real;
norm1, norm2: fn(x: array of real)     : real;
iamax       : fn(x: array of real)     : int;
gemm        : fn(transa, transb: int, # upper case N or T
m, n, k: int, alpha      : real,
a: array of real, lda    : int,
b: array of real, ldb    : int, beta: real,
c: array of real, ldc    : int);
sort        : fn(x: array of real, p: array of int);
```

## Description

These routines implement the basic functions of linear algebra. The standard vector inner product and norms are defined as follows:

```   dot(x, y) = sum(x [i]* y [i])
norm1(x) = sum(fabs(x [i]))
norm2(x) = sqrt(dot(x, x))

```

For the infinity norm, the function iamax(x) computes an integer i such that fabs(x[i]) is maximal. These are all standard BLAS (basic linear algebra subroutines) except that in Inferno they apply only to contiguous (unit stride) vectors.

A = a* A'*B' + *C where the apostrophes indicate an optional transposition. As shown by the work of Kagstrom, Ling, and Van Loan, the other BLAS functionality can be built efficiently on top of gemm.   