* @param columns number of columns of the resulting matrix
* @return a matrix with dimensions rows * columns whose diagonal elements are filled by x
*/
public static ComplexDoubleMatrix diag(ComplexDoubleMatrix x, int rows, int columns) {
if (x.length > rows || x.length > columns) {
throw new SizeException("Length of diagonal matrix must be larger than both rows and columns.");
}
ComplexDoubleMatrix m = new ComplexDoubleMatrix(rows, columns);
for (int i = 0; i < x.length; i++)