node/dlpa/lib/dlpa.js
function flatten(matrix) {
    const res = [];

    // If the given matrix is not a matrix but a scalar.
    if (!Array.isArray(matrix)) {
        matrix = [
            [matrix]
        ];
    }

    matrix.forEach((row) => {
        // If the given matrix is a vector.
        if (!Array.isArray(row)) {
            row = [row];
        }

        row.forEach((elem) => {
            res.push(elem.real);
            res.push(elem.imag);
        });
    });
    return res;
}
function flatten(matrix) {
    const res = [];

    // If the given matrix is not a matrix but a scalar.
    if (!Array.isArray(matrix)) {
        matrix = [
            [matrix]
        ];
    }

    matrix.forEach((row) => {
        // If the given matrix is a vector.
        if (!Array.isArray(row)) {
            row = [row];
        }

        row.forEach((elem) => {
            res.push(elem.real);
            res.push(elem.imag);
        });
    });
    return res;
}
function flatten ( matrix ) { const res = [ ] ; // If the given matrix is not a matrix but a scalar. if ( ! Array . isArray ( matrix ) ) { matrix = [ [ matrix ] ] ; } matrix . forEach ( ( row ) => { // If the given matrix is a vector. if ( ! Array . isArray ( row ) ) { row = [ row ] ; } row . forEach ( ( elem ) => { res . push ( elem . real ) ; res . push ( elem . imag ) ; } ) ; } ) ; return res ; }
flatten returns a list which flatten the given matrix.
flatten returns a list which flatten the given matrix .