@Anderssmith

Flip matrix is a transpose operation, so a value at row i and column j will be flipped across its diagonal to row j and column i:

FlipMatrix(a_{ij}) = a_{ji}

In numpy, this is typically done with the “T” attribute:

```
In [15]: a = np.arange(12).reshape(3, 4)
In [16]: a
Out[16]:
array([[ 0, 1, 2, 3],
[ 4, 5, 6, 7],
[ 8, 9, 10, 11]])
In [17]: a.T
Out[17]:
array([[ 0, 4, 8],
[ 1, 5, 9],
[ 2, 6, 10],
[ 3, 7, 11]])
```

Mass addition is just the cumulative sum of all the elements in your array:

MassAddition(a) = \sum_{i=1}^{n} a_i

In numpy, this is the sum method (not the `np.cumsum`

method!):

```
In [18]: a = np.arange(12)
In [19]: a
Out[19]: array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11])
In [20]: a.sum()
Out[20]: 66
```

When you do the GH to matrix/array translations, you may need to modify these operations slightly to account for multidimensional data, and ragged arrays.

You will have to deal with multidimensional data if the GH component “branches” the input data to maintain data that is nested multiple times. Numpy’s matrix operations works by default on 2D matrices, so if you have a set of GH branch each containing a list, or a list of lists, then you don’t have to worry about this. But if you nesting data beyond this, then you may have to specify along which axis the operation occurs. So, if you have a GH branch of 2D matrices, you have to specify if each matrix is transposed, or if whole thing is transposed along it’s 3D matrix diagonal. For most operations, you can do this by specifying the “axis” argument in numpy:

Ragged arrays refers to a nested data that don’t have a consistent size. In GH branches and plain python lists, you can nest (for example) a set of lists where each list has a different lenght. So for example, if you represent your geometry as a set of polygons, and the polygons don’t have a fixed number of vertices, you’ll run into this issue. Matrices don’t work with this kind of structure, so numpy will complain when you try to convert such lists into arrays. It’ll still turn it into an array, but will consider your values as `np.objects`

, and not as numbers, and matrix operations won’t work. I think the easiest way to solve this is by padding your data with `np.nan`

or zero values, or by flattening high dimensional data to (at minimum) 2D matrices.