class DenseVectorSummarizer extends BaseVectorSummarizer {

    @Override
    public BaseVectorSummarizer visit(Vector vec) {
        if (vec instanceof DenseVector) {
            DenseVector dv = (DenseVector) vec;

            int n = dv.size();

            if (count == 0) {
                init(n);
            }

            count++;

            if (sum.size() >= n) {
                for (int i = 0; i < n; i++) {
                    double value = dv.get(i);
                    if (!Double.isNaN(value)) {
                        if (value < min.get(i)) {
                            min.set(i, value);
                        }

                        if (value > max.get(i)) {
                            max.set(i, value);
                        }

                        if (0 != value) {
                            sum.add(i, value);
                            normL1.add(i, Math.abs(value));
                            squareSum.add(i, value * value);
                            numNonZero.add(i, 1);
                        }
                    }
                }

                if (calculateOuterProduct) {
                    if (outerProduct == null) {
                        outerProduct = dv.outer();
                    } else {
                        for (int i = 0; i < n; i++) {
                            for (int j = 0; j < n; j++) {
                                outerProduct.add(i, j, dv.get(i) * dv.get(j));
                            }
                        }
                    }
                }
                return this;
            } else {
                DenseVectorSummarizer summarizer = new DenseVectorSummarizer(calculateOuterProduct);
                summarizer.visit(vec);
                return VectorSummarizerUtil.merge(summarizer, this);
            }
        } else {
            SparseVectorSummarizer sparseSrt = new SparseVectorSummarizer(calculateOuterProduct);
            sparseSrt.visit(vec);
            return VectorSummarizerUtil.merge(sparseSrt, this);
        }
    }

      DenseVectorSummarizer();
    public  DenseVectorSummarizer(boolean calculateOuterProduction);

}