总结矩阵arraylist中的元素

时间:2013-07-10 22:47:24

标签: arraylist sparse-matrix

我试图总结一个arraylist中的每个arraylist。我假设你使用get方法。但我不确定如何做到这一点。这就是我到目前为止所拥有的。如箭头所示,我试图在新的arraylist开始之前将arraylist加起来。有任何想法吗?????

    public void sparseCountTimer(ArrayList arraylist)
    {
        double totalRowsCount = 0.0;
        long   totalTime      = 0;

        for (int x = 0; x < iteration; x++)
        {
            long   startTime2     = 0,
                   estimatedTime2 = 0;
            double rowTotal       = 0.0,
                   lastRowTotal   = 0.0;

            for( int i = 0; i < matrixDimension; ++i)
            {
                if (lastRowTotal < rowTotal)
                {
                    lastRowTotal = rowTotal;
                    startTime2 = System.nanoTime(); 
                }
                rowTotal = 0.0;
                for (int j = 0; j < matrixDimension; ++j)
                {
            >>>>>>>>>    rowTotal += arraylist.get(j).get(i);    <<<<<<<<<<<<<<
                }
                estimatedTime2 = System.nanoTime() - startTime2;
            }
            totalRowsCount += lastRowTotal;
            totalTime += estimatedTime2;
        }
    }

0 个答案:

没有答案