Currently, there is a single large class spinw with several large methods / functions - especially spinwave.m.
To make it easier to port to C++ and also to write unit tests for (system tests already exist), this code should be refactored to be more object oriented, and the code split into more modular blocks / methods.