static generateDiagonal(size, coefficientFunc) {
        let buf = new Float64Array(size*size*2);
        for (let i = 0; i < size; i++) {
            let k = i*(size+1)*2;
            let v = coefficientFunc(i);
            buf[k] = Complex.realPartOf(v);
            buf[k+1] = Complex.imagPartOf(v);
        }
        return new Matrix(size, size, buf);
    }
Returns a diagonal matrix of the given size, using the given function to generate the diagonal coefficients.
@param {!int} size
@param {!function(!int): (!number|!Complex)} coefficientFunc
@returns {!Matrix}