示例#1
0
 public mat turn()
 {
     mat result = new mat(rowCount,lineCount);
     reLine();
     while (it.line!= null)
     {
         while (it.row!= null)
         {
             result.set(it.row.rowId, it.line.lineId,it.row.value);
             it.nextRow();
         }
         it.nextLine();
     }
     return result;
 }
示例#2
0
 static public mat operator *(double value,mat obj)
 {
     mat result = new mat(obj);
     result.reLine();
     while (result.it.line != null)
     {
         while (result.it.row != null)
         {
             result.times(result.it.line.lineId, result.it.row.rowId, value);
             result.it.nextRow();
         }
         result.it.nextLine();
     }
     return result;
 }
示例#3
0
 static public mat operator -(mat obj, mat tar)
 {
     if (tar.rowCount != obj.rowCount || tar.lineCount != obj.lineCount)
         return new mat(0, 0);
     mat result = new mat(obj);
     tar.reLine();
     while (tar.it.line != null)
     {
         while (tar.it.row != null)
         {
             result.add(tar.it.line.lineId, tar.it.row.rowId, -tar.it.row.value);
             tar.it.nextRow();
         }
         tar.it.nextLine();
     }
     return result;
 }
示例#4
0
 static public mat operator *(mat tar,mat obj)
 {
     mat result = new mat(tar.lineCount,obj.rowCount);
     tar.reLine();
     obj.reLine();
     while (tar.it.line!=null)
     {
         for (int i = 0; i < obj.rowCount; i++)
         {
             double sum = 0;
             while (tar.it.row != null)
             {
                 sum += tar.it.row.value * obj.get(tar.it.row.rowId, i);
                 tar.it.nextRow();
             }
             result.set(tar.it.line.lineId, i,sum);
             tar.it.reRow();
         }
         tar.it.nextLine();
     }
     return result;
 }
示例#5
0
 public mat(mat tar)
 {
     baseLine = new lineNode();
     baseLine.lineId = -1;
     it = new iterator();
     it.preline = baseLine;
     it.line = null;
     it.row = null;
     it.prerow = null;
     tar.reLine();
     lineCount = tar.lineCount;
     rowCount = tar.rowCount;
     while (tar.it.line!=null)
     {
         while (tar.it.row != null)
         {
             set(tar.it.line.lineId, tar.it.row.rowId, tar.it.row.value);
             tar.it.nextRow();
         }
         tar.it.nextLine();
     }
 }