m=this.copy(m); var f1=0, temp=0, tms=m.length, v=1; this.iDF=1; for(var col=0; col<tms-1; col++){ if(typeof m[col][col]!="number") { console.warn("non-numeric entry found in a numeric matrix: m[" + col + "][" + col + "]=" + m[col][col]); } v=1; var stop_loop=0; while((m[col][col] == 0) && !stop_loop){ if (col+v>=tms){ this.iDF=0; stop_loop=1; }else{ for(var r=0; r<tms; r++){ temp=m[col][r]; m[col][r]=m[col+v][r]; m[col+v][r]=temp; } v++; this.iDF*=-1; } } for(var row=col+1; row<tms; row++){ if(typeof m[row][col]!="number"){ console.warn("non-numeric entry found in a numeric matrix: m[" + row + "][" + col + "]=" + m[row][col]); } if(typeof m[col][row]!="number"){ console.warn("non-numeric entry found in a numeric matrix: m[" + col + "][" + row + "]=" + m[col][row]); } if(m[col][col]!=0){ var f1=(-1)* m[row][col]/m[col][col]; for (var i=col; i<tms; i++){ m[row][i]=f1*m[col][i]+m[row][i]; } } } } return m; // Array