///////////////////////////////////////////////////////////////////////////
//    Copyright (C) 2011 Wizardry and Steamworks - License: GNU GPLv3    //
///////////////////////////////////////////////////////////////////////////
// calulates the determinant of a matrix m with ord 
// columns.
float wasDeterminant(list m, integer ord) {
    float result = 0;
    integer i = 0;
    integer o = -1;
    do {
        //i * cof (i) - i * cof(i) + i * cof(i) - ...
        list cof = wasMatrixCofactor(m, 0, i, ord);
        if(llGetListLength(cof) == 2) {
            if(o = ~o) {
                result -= llList2Float(m, i) * llList2Float(cof, 0);
                jump next;
            }
            result += llList2Float(m, i) * llList2Float(cof, 0);
            jump next;
        }
        if(llGetListLength(cof) == 0) return llList2Float(m, i);
        if(o = ~o) {
            result -=  llList2Float(m, i) * wasDeterminant(cof, ord-1);
            jump next;
        }
        result +=  llList2Float(m, i) * wasDeterminant(cof, ord-1);
@next;
    } while(++i<ord);
    return result;
}

secondlife/matrices/functions/determinant.txt ยท Last modified: 2022/11/24 07:46 by 127.0.0.1

Access website using Tor Access website using i2p Wizardry and Steamworks PGP Key


For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.