# Dependencies

There are big problems and there are small problems. Granted, I’m working on a rather small one. Still, I’m struggling to make up my mind.

The thing is that I have my 2d geometry libray that I’m working on. To suppose some of the operations in this library I require some matrix mathematics. To do this kind of map I’ve created some supported matrix classes. Now, I have the problem that the name “Vector” both refers to a geometrical concept, but also as a matrix concept. Now, I need my matrices to operate on my geometrical shapes, But somehow I feel that mathematical concepts like matrices should be designed according to their own inherent logic and not be tied to geometrical concepts. So, a matrix can clearly be multiplied with a vector, but if I at the same time use matrices to perform operations on my vectors then I have dependencies going both ways. That feels bad.

Current solution? I’m making my matrix library independent of my geometrical shapes. I’m also making my geometrical shapes independent from my matrices. Instead I’m creating a third module called transformations that I allow to know both the geometric as well as the matrix domain. This module should give the user a nice interface to work with when it comes to geometrical transformations.

## Code of the Day

Matrix multiplied with a “vector” is a oneliner.

```
/**
* Multiplies this matrix with an array of numbers.
* @param vArray
*/
times(vArray: number[]): number[] {
const newArray = this.elements.map(a => a.reduce((a, v, i) => a + v * vArray[i]));
return newArray;
}
```