Package com.numb3r3.common.db.berkeleydb

Examples of com.numb3r3.common.db.berkeleydb.BerkeleyDBMatrix


        return new InMemoryJBlasMatrix(DoubleMatrix.eye(n), null);
    }

    @Override
    public Pair getDims() {
        return new Pair(this.getRowsNum(), this.getColumnsNum());
    }
View Full Code Here


    public InMemoryJBlasMatrix(final int rowNum, final int colNum,
                               final ErrorProcessor errorProcessor) {
        if (errorProcessor != null) {
            this.errorProcessor = errorProcessor;
        } else {
            this.errorProcessor = new SystemErrorProcessor();
        }

        if (rowNum == 0 && colNum == 0) {
            throw new UnsupportedOperationException(
                    "Matrix should have more than zero elements.");
View Full Code Here

    public InMemoryJBlasMatrix(DoubleMatrix matrix,
                               final ErrorProcessor errorProcessor) {
        if (errorProcessor != null) {
            this.errorProcessor = errorProcessor;
        } else {
            this.errorProcessor = new SystemErrorProcessor();
        }
        this.doubleMatrix = matrix;
    }
View Full Code Here

        double part1 = Math.exp(-0.5 * k * Math.log(2 * Math.PI));

        double part2 = Math.pow(det, -0.5);

        Matrix dev = value.sub(mu);

        double part3 = Math.exp(-0.5
                * (dev.transpose().product(cox.inverse())).dot(dev));
        return part1 * part2 * part3;

    }
View Full Code Here

        double part1 = Math.exp(-0.5 * k * Math.log(2 * Math.PI));

        double part2 = Math.pow(det, -0.5);

        Matrix dev = value.sub(mu);

        double part3 = Math.exp(-0.5 * (dev.transpose().product(inv)).dot(dev));
        return part1 * part2 * part3;

    }
View Full Code Here

        else
            return PhiInverse(y, delta, mid, hi);
    }

    public static Matrix oneCox(int k) {
        Matrix cox = InMemoryJBlasMatrix.eye(k);

        return null;
    }
View Full Code Here

        return null;
    }

    public static Matrix sample(Matrix mu, Matrix Sigma) {
        Matrix values = InMemoryJBlasMatrix.randn(mu.getRowsNum());
        return mu.add(Sigma.product(values));
    }
View Full Code Here

        return distance;
    }

    public static void main(String[] args) {
        // 2.1, 3.5, 8. , 9.5
        Matrix x = InMemoryJBlasMatrix.randn(4);
        x.put(0, 0, 2.1);
        x.put(1, 0, 3.5);
        x.put(2, 0, 8.0);
        x.put(3, 0, 9.5);

        Matrix mu = InMemoryJBlasMatrix.zeros(4);
        mu.put(0, 0, 2.0);
        mu.put(1, 0, 3.0);
        mu.put(2, 0, 8.0);
        mu.put(3, 0, 10.0);

        Matrix Sigma = InMemoryJBlasMatrix.eye(4);
        Sigma.put(0, 0, 2.3);
        Sigma.put(1, 1, 1.5);
        Sigma.put(2, 2, 1.7);
        Sigma.put(3, 3, 2.0);

        System.out.println("Det: " + Sigma.det());
        System.out.println("Normal density: " + Gaussian.mphi(x, mu, Sigma));
        // System.out.println("PDF: " + Gaussian.pdf());

        double y = 0.1;
        double mean = 1.5;
View Full Code Here

    public InMemoryJBlasMatrix() {

    }

    public static Matrix arrayMatrix(double[] arrays) {
        Matrix m = InMemoryJBlasMatrix.zeros(arrays.length);
        for (int i = 0; i < arrays.length; i++) {
            m.put(i, 0, arrays[i]);
        }
        return m;
    }
View Full Code Here

        else
            return -1;
    }

    private Matrix createSubMatrix(int excluding_row, int excluding_col) {
        Matrix mat = new InMemoryJBlasMatrix(this.getRowsNum() - 1,
                this.getColumnsNum() - 1, this.errorProcessor);
        int r = -1;
        for (int i = 0; i < this.getRowsNum(); i++) {
            if (i == excluding_row)
                continue;
            r++;
            int c = -1;
            for (int j = 0; j < this.getColumnsNum(); j++) {
                if (j == excluding_col)
                    continue;
                mat.put(r, ++c, this.get(i, j));
            }
        }
        return mat;
    }
View Full Code Here

TOP

Related Classes of com.numb3r3.common.db.berkeleydb.BerkeleyDBMatrix

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.