vector.js
function create2x2(a, b, c, d){
    if (undef(a)) throw new Error("At least one argument must be provided.");

    if (undef(b)){
        // Everything = a
        b = a;
        c = a;
        d = a;
    }
    else{
        // we have a and b
        if(undef(c)){
            c = a;
            d = b;
        }
        else{
            if(undef(d)) throw new Error("Argument 'd' must be provided if 'c' is.");
        }
    }

    return new Vector([[a, b],[c, d]]);
}
function create2x2(a, b, c, d){
    if (undef(a)) throw new Error("At least one argument must be provided.");

    if (undef(b)){
        // Everything = a
        b = a;
        c = a;
        d = a;
    }
    else{
        // we have a and b
        if(undef(c)){
            c = a;
            d = b;
        }
        else{
            if(undef(d)) throw new Error("Argument 'd' must be provided if 'c' is.");
        }
    }

    return new Vector([[a, b],[c, d]]);
}
function create2x2 ( a , b , c , d ) { if ( undef ( a ) ) throw new Error ( "At least one argument must be provided." ) ; if ( undef ( b ) ) { // Everything = a b = a ; c = a ; d = a ; } else { // we have a and b if ( undef ( c ) ) { c = a ; d = b ; } else { if ( undef ( d ) ) throw new Error ( "Argument 'd' must be provided if 'c' is." ) ; } } return new Vector ( [ [ a , b ] , [ c , d ] ] ) ; }
Create a 2D vector by providing one, two, or four values
Create a 2D vector by providing one two or four values