I want to write for myself a library for working with matrices. I think how to ensure that arithmetic operations can be performed on the elements of the matrix.

Are there any Java SE interfaces that declare methods like add() , subtract() , etc.? As I understand it, the Number class does not help with this, and it doesn’t fit much here, because the elements of the matrix will not necessarily be numbers.

    1 answer 1

    I decided to make a simple abstract class Matrix, in it the main methods for operations on matrices. Three classes are inherited from it: IntegerMatrix, DoubleMatrix and MatrixOfElements, where Element provides the necessary opportunity to perform an arithmetic operation on the elements of the matrix.

    • As an example, you can see how OOP is implemented for working with matrices in Commons Math . - enzo