mrc-ide / covid-sim

This is the COVID-19 CovidSim microsimulation model developed by the MRC Centre for Global Infectious Disease Analysis hosted at Imperial College, London.
GNU General Public License v3.0
1.23k stars 256 forks source link

You can't multiply two vectors to get another vector #424

Closed zebmason closed 4 years ago

zebmason commented 4 years ago

https://github.com/mrc-ide/covid-sim/blob/f6d40d605feeaac0d18ae256875808df42eecf92/src/Geometry/Vector2.cpp#L5

This has no basis in vector algebra so is dangerous

insidedctm commented 4 years ago

The operation results in both components of the Vector2 being squared. I'd guess this is a precursor to doing something like a distance calculation. How is it used in the main code? This should either be renamed or maybe a change to the interface to make it more obvious what the Vector2 operation is actually being used to do.

zebmason commented 4 years ago

The Vector2 class is used to represent both a vector and a diagonal matrix hence the mixed algebra