Is there a good tutorial that describes all the possible element-by-element operations and conformability in GAUSS? I understand that they are more extensive than the standard case where the matrices have to be of the same size, but I cannot find a good tutorial on the internet to understand all the possible cases.

Any help would be greatly appreciated.

## 1 Answer

These videos, especially number 3, explain how matrix operations work in GAUSS

1. GAUSS Basics: Intro to Matrices.

2. GAUSS Basics: Matrix Operations.

3. GAUSS Basics: Element by Element Conformability.

Here are some of the main points:

- A scalar is Element-by-Element (ExE) conformable with a vector or matrix of any size.
- A vector or matrix will be ExE conformable of another vector or matrix with the same dimensions.
- A row vector is ExE conformable with a matrix that has the same number of columns as the row vector.
- A row vector is also ExE conformable with any column vector.
- A column vector is ExE conformable with a matrix that has the same number of rows as the column vector.

**1. Scalar with Matrix or Vector**

This is pretty straightforward and probably already known.

//Create a scalar s = 2.5; //Create a 2x2 matrix x = { 4 3, 2 1 }; out = s .* x;

out = 8 6 4 2

**2. Vectors or matrices of the same size**

This is also pretty straightforward and probably already known.

//Create a 2x2 a = { 5 4, 3 9 }; //Create a 2x2 matrix b = { 4 3, 2 1 }; out = a .* b;

out = 20 12 6 9

**3. Row Vectors with a matrix with same number of columns**

Each element of the row vector, `a` will multiply down a column of `b`.

//Create a 1x4 row vector a = { 5 4 3 9 }; //Create a 3x4 matrix b = { 4 3 2 7, 2 1 3 5, 10 9 8 1 }; out = a .* b;

out = 20 12 6 63 10 4 9 45 50 36 24 9

**4. Row Vector with a column vector**

The column vector `b` will be expanded to have as many columns as the row vector, `a`. Then each element of a will multiply down the newly expanded columns of `b`.

//Create a 1x4 row vector a = { 5 4 3 9 }; //Create a 3x1 matrix b = { 4, 2, 10 }; out = a .* b;

out = 20 16 12 36 10 8 6 18 50 40 30 90