Matrix

public class Matrix

This is the Matrix class. This defines matrices, primarily for use in the localizers. However, if matrices and matrix operations are necessary, this class as well as some operations in the MathFunctions class can absolutely be used there as well. It's similar to Mats in OpenCV if you've used them before, but with more limited functionality.

Author

Anyi Lin - 10158 Scott's Bots

Constructors

Link copied to clipboard
public void Matrix()
This creates a new Matrix of width and height 0.
public void Matrix(int rows, int columns)
This creates a new Matrix with a specified width and height.
public void Matrix(Array<Array<double>> setMatrix)
This creates a new Matrix from a 2D matrix of doubles.
public void Matrix(Matrix setMatrix)
This creates a new Matrix from another Matrix.

Properties

Link copied to clipboard
public Array<Array<double>> matrix

Functions

Link copied to clipboard
public boolean add(Matrix input)
This adds a Matrix to this Matrix.
Link copied to clipboard
public static Array<Array<double>> deepCopy(Array<Array<double>> copyMatrix)
This creates a copy of a 2D Array of doubles that references entirely new memory locations from the original 2D Array of doubles, so no issues with mutability.
Link copied to clipboard
public boolean flipSigns()
This multiplies the Matrix by -1, flipping the signs of all the elements within.
Link copied to clipboard
public Array<double> get(int row)
This returns a specified row of the Matrix in the form of an Array of doubles.
public double get(int row, int column)
This returns a specified element of the Matrix as a double.
Link copied to clipboard
public int getColumns()
This returns the number of columns of the Matrix, as determined by the length of the first Array in the 2D Array.
Link copied to clipboard
public Array<Array<double>> getMatrix()
This returns a deep copy of the 2D Array that this Matrix is based on.
Link copied to clipboard
public int getRows()
This returns the number of rows of the Matrix, as determined by the length of the 2D Array.
Link copied to clipboard
public boolean multiply(Matrix input)
This multiplies a Matrix to this Matrix.
public static Matrix multiply(Matrix one, Matrix two)
This multiplies a Matrix to another Matrix.
Link copied to clipboard
public boolean scalarMultiply(double scalar)
This multiplies this Matrix with a scalar.
Link copied to clipboard
public boolean set(int row, Array<double> input)
This sets a row of the Matrix to a copy of a specified Array of doubles.
public boolean set(int row, int column, double input)
This sets a specified element of the Matrix to an input value.
Link copied to clipboard
public boolean setMatrix(Matrix setMatrix)
This sets the 2D Array of this Matrix to a copy of the 2D Array of another Matrix.
public boolean setMatrix(Array<Array<double>> setMatrix)
This sets the 2D Array of this Matrix to a copy of a specified 2D Array.
Link copied to clipboard
public boolean subtract(Matrix input)
This subtracts a Matrix from this Matrix.