Package com.enterprisemath.math.algebra

Examples of com.enterprisemath.math.algebra.Vector


        // calculates first and second central momentum
        double[] m1 = new double[dimension];
        double[] m2 = new double[dimension];
        ObservationIterator<Vector> iterator = observations.getIterator();
        while (iterator.isNextAvailable()) {
            Vector x = iterator.getNext();
            for (int i = 0; i < dimension; ++i) {
                m1[i] += x.getComponent(i);
                m2[i] += x.getComponent(i) * x.getComponent(i);
            }
        }

        for (int i = 0; i < dimension; ++i) {
            m1[i] /= iterator.getNumIterated();
View Full Code Here


        double[] sigma = null;

        // adding values
        ObservationIterator<Vector> iterator = observations.getIterator();
        while (iterator.isNextAvailable()) {
            Vector x = iterator.getNext();
            c0 = -Double.MAX_VALUE;

            for (int j = 0; j < numComponents; ++j) {
                c[j] = Math.log(start.getWeights().get(j)) + start.getComponents().get(j).getLnValue(x);
                if (c[j] > c0)
                    c0 = c[j];
            }

            h = 0;
            for (int j = 0; j < numComponents; ++j) {
                c[j] -= c0;
                if (c[j] > COMP_TRUNC) {
                    c[j] = Math.exp(c[j]);
                    h += c[j];
                }
                else {
                    c[j] = 0;
                }
            }
            //L += Math.log(h) + c0;

            for (int j = 0; j < numComponents; ++j) {
                if (c[j] == 0)
                    continue;
                mi = newMi[j];
                sigma = newSigma[j];
                qmx = c[j] / h;
                newW[j] += qmx;

                for (int k = 0; k < dim; ++k) {
                    mi[k] += x.getComponent(k) * qmx;
                    sigma[k] += x.getComponent(k) * x.getComponent(k) * qmx;
                }
            }
        }

        // finishing
View Full Code Here

        double L = 0;

        // adding values
        ObservationIterator<Vector> iterator = observations.getIterator();
        while (iterator.isNextAvailable()) {
            Vector x = iterator.getNext();
            c0 = -Double.MAX_VALUE;

            for (int j = 0; j < mixture.getNumComponents(); ++j) {
                c[j] = Math.log(mixture.getWeights().get(j)) + mixture.getComponents().get(j).getLnValue(x);
                if (c[j] > c0)
View Full Code Here

        // calculates first and second central momentum
        double[] m1 = new double[dimension];
        double[] m2 = new double[dimension];
        ObservationIterator<Vector> iterator = observations.getIterator();
        while (iterator.isNextAvailable()) {
            Vector x = iterator.getNext();
            for (int i = 0; i < dimension; ++i) {
                m1[i] += x.getComponent(i);
                m2[i] += x.getComponent(i) * x.getComponent(i);
            }
        }

        for (int i = 0; i < dimension; ++i) {
            m1[i] /= iterator.getNumIterated();
View Full Code Here

        double[] sigma = null;

        // adding values
        ObservationIterator<Vector> iterator = observations.getIterator();
        while (iterator.isNextAvailable()) {
            Vector x = iterator.getNext();
            c0 = -Double.MAX_VALUE;

            for (int j = 0; j < numComponents; ++j) {
                c[j] = Math.log(start.getWeights().get(j)) + start.getComponents().get(j).getLnValue(x);
                if (c[j] > c0)
                    c0 = c[j];
            }

            h = 0;
            for (int j = 0; j < numComponents; ++j) {
                c[j] -= c0;
                if (c[j] > COMP_TRUNC) {
                    c[j] = Math.exp(c[j]);
                    h += c[j];
                }
                else {
                    c[j] = 0;
                }
            }
            //L += Math.log(h) + c0;

            for (int j = 0; j < numComponents; ++j) {
                if (c[j] == 0)
                    continue;
                mi = newMi[j];
                sigma = newSigma[j];
                qmx = c[j] / h;
                newW[j] += qmx;

                for (int k = 0; k < dim; ++k) {
                    mi[k] += x.getComponent(k) * qmx;
                    sigma[k] += x.getComponent(k) * x.getComponent(k) * qmx;
                }
            }
        }

        // finishing
View Full Code Here

     */
    private double countLnL(ObservationProvider<Vector> observations, DiagonalNormalDistributionMixture mixture) {
        double res = 0;
        ObservationIterator<Vector> iterator = observations.getIterator();
        while (iterator.isNextAvailable()) {
            Vector x = iterator.getNext();
            res += mixture.getLnValue(x);
        }
        return res;
    }
View Full Code Here

        @Override
        public synchronized Vector getNext() {
            if (next == null) {
                throw new NoSuchElementException("next observation is not available");
            }
            Vector res = next;
            prepareNext();
            numIterated.incrementAndGet();
            return res;
        }
View Full Code Here

        res.setValue(maxZ);

        for (Set<Integer> pb : possibleSols) {
            table.swapBasicVariables(pb);
            if (table.isOptimal()) {
                Vector sol = table.getSolution();
                res.addSolution(sol);
            }
        }

        return res.build();
View Full Code Here

TOP

Related Classes of com.enterprisemath.math.algebra.Vector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.