// Matrix Computation Engine // matrix class : made by mass@math.skku.ac.kr import java.sql.*; import java.io.*; import java.util.*; public class matrix { public int rows; public int cols; public float[][] element; public String option; public float determinant; public matrix(int m,int n) { rows=m; cols=n; element=new float[rows][cols]; option=""; determinant=0; } public void inputMatrix(int row, int col, float values) { this.element[row][col]=values; } public void inputMatrix(int row, int col, String values) { if(values==null) values="0"; this.element[row][col]=Float.parseFloat(values); } public void DBMatrixInput(String name) throws Exception { Class.forName("postgresql.Driver"); Connection conn=DriverManager.getConnection("jdbc:postgresql://203.252.47.50/matrix","mass","8Tidsha"); Statement stmt=conn.createStatement(); // ÀÌÁ¦ ½ÇÁ¤º¸¸¦ ²ø¾î¿ÀÀÚ, String query="select * from "+name; ResultSet rs=stmt.executeQuery(query); for(int i=0;i= first_inside && i <= second_inside && j >= first_inside && j <= second_inside) this.element[i][j]=num; else if((i > first_block && i < second_block) || (j > first_block && j < second_block)) this.element[i][j]=nn-num; else this.element[i][j]=num; num++; } if(n%4==0) return; switch_row[0]=nmiddle; switch_row[1]=0; last_switch_column=0; for(i=0; i < nmiddle; i++) { if(i==first_block || i==second_block) { osl=1-osl; continue; } swap(second_block, i, second_block, nminus-i); swap(i, first_block, nminus-i, first_block); swap(i, second_block, nminus-i, second_block); swap(i, switch_row[osl], nminus-i, switch_row[osl]); } for(i=first_block+1; i < second_block; i++) { swap(first_block, i, second_block, i); swap(i, first_block, i, second_block); } swap(first_block, nmiddle, second_block, nmiddle); swap(last_switch_column, first_block, last_switch_column, second_block); } public void randint(int lb,int range) throws Exception { int i,j; Random ran; ran=new Random(); try { for(i=0;irows || row2>rows) { throw new Exception("matrix : Out of Rows."); } for(i=0;irows) { throw new Exception("matrix : Out of Rows."); } for(i=0;irows || source>rows) { throw new Exception("matrix : Row Bound Over Setting"); } rowscalar(source,scalar); for(i=0;i