Matrix () { double[] result = new double[vector.getSize()]; for (int i = 0, w = 0; w < width; w++) { for (int h = 0; h < height; h++, i++) { result[i] = get(w, h); } } //noinspection SuspiciousNameCombination return new Matrix(height, width, result); }