public Matrix multiply(Matrix matrix) { // Text if compatible, and if so
											// return the matrix product.
		if (this.cols == matrix.rows) {
			Matrix result = new Matrix(this.rows, matrix.cols);
			for (int i = 0; i < result.rows; i++) {
				for (int j = 0; j < result.cols; j++) {
					float value = 0;
					for (int index = 0; index < this.cols; index++) {
						value += this.get(i, index) * matrix.get(index, j);
					}
					result.set(i, j, value);
				}
			}
			return result;
		} else {
			try {
				throw new Exception("Attempted to multiply incompatible matrices.");
			} catch (Exception e) {
				e.printStackTrace();
			}
			return null;
		}
	}