Package com.numb3r3.common.math

Examples of com.numb3r3.common.math.Matrix


    }

    @Override
    public Matrix div(Matrix other) {
        if (this.isSameDim(other)) {
            Matrix dump = new InMemoryJBlasMatrix(this.getData().div(
                    (DoubleMatrix) other.getData()), errorProcessor);
            return dump;
        } else {
            errorProcessor
                    .error("the two matrices should have same dimensions.");
View Full Code Here


    }

    @Override
    public Matrix div(double scalar) {
        if (!Utils.isZero(scalar)) {
            Matrix dump = this.dup();
            ((DoubleMatrix) dump.getData()).divi(scalar);
            return dump;
        } else {
            errorProcessor
                    .error("the operation is illegal. (the division should not to be zero)");
            return null;
View Full Code Here

    }

    @Override
    public Matrix not() {
        Matrix dump = this.dup();
        ((DoubleMatrix) dump.getData()).noti();
        return dump;
    }
View Full Code Here

        this.getData().truthi();
    }

    @Override
    public Matrix truth() {
        Matrix dump = this.dup();
        ((DoubleMatrix) dump.getData()).truthi();
        return dump;
    }
View Full Code Here

        this.getData().selecti((DoubleMatrix) where.getData());
    }

    @Override
    public Matrix select(final Matrix where) {
        Matrix dump = this.dup();
        ((DoubleMatrix) dump.getData()).select((DoubleMatrix) where.getData());
        return dump;
    }
View Full Code Here

        return this.getData().sum();
    }

    @Override
    public Matrix rsum() {
        Matrix matrix = new InMemoryJBlasMatrix(this.getRowsNum(), 1,
                errorProcessor);
        for (int i = 0; i < this.getRowsNum(); i++) {
            matrix.put(i, 0, this.rsum(i));
        }
        return matrix;
    }
View Full Code Here

        }
    }

    @Override
    public Matrix csum() {
        Matrix matrix = new InMemoryJBlasMatrix(1, this.getColumnsNum(),
                errorProcessor);
        for (int j = 0; j < this.getColumnsNum(); j++) {
            matrix.put(0, j, this.csum(j));
        }
        return matrix;
    }
View Full Code Here

        return this.getData().mean();
    }

    @Override
    public Matrix rmean() {
        Matrix matrix = this.rsum();
        matrix.divi(this.getColumnsNum());
        return matrix;
    }
View Full Code Here

        return this.rsum(row) / this.getColumnsNum();
    }

    @Override
    public Matrix cmean() {
        Matrix matrix = this.csum();
        matrix.divi(this.getRowsNum());
        return matrix;
    }
View Full Code Here

        return matrix;
    }

    @Override
    public Matrix cstd() {
        Matrix mean = this.cmean();
        Matrix std = zeros(1, this.getColumnsNum());
        for (int i = 0; i < this.getRowsNum(); i++) {
            for (int j = 0; j < this.getColumnsNum(); j++) {
                double value = this.get(i, j);
                double old = std.get(0, j);
                std.put(0, j, old + (value - mean.get(0, j))
                        * (value - mean.get(0, j)));
            }
        }
        std.divi(this.getRowsNum());
        for (int j = 0; j < this.getColumnsNum(); j++) {
            double value = Math.sqrt(std.get(0, j));
            std.put(0, j, value);
        }
        return std;
    }
View Full Code Here

TOP

Related Classes of com.numb3r3.common.math.Matrix

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.