Vector (Matrix matrix) { int size = matrix.getRows(); if (size != getSize()) throw new IllegalArgumentException("size mismatch rows"); double[] result = new double[matrix.getColumns()]; for (int i = 0; i < result.length; i++) result[i] = multiply(matrix.getColumn(i)); return new Vector(result); }