Package stallone.api.doubles

Examples of stallone.api.doubles.IDoubleArray


*/
public class ArrayElementDivide //implements IMatrixSum
{
    public IDoubleArray divideToNewDense(final IDoubleArray a, final IDoubleArray b)
    {
        IDoubleArray target = a.copy();
        divideDense(a,b,target);
        return target;
    }
View Full Code Here


        return target;
    }

    public IDoubleArray divideToNewSparse(final IDoubleArray a, final IDoubleArray b)
    {
        IDoubleArray target = a.copy();
        divideSparse(a,b,target);
        return target;
    }
View Full Code Here

        if (args.length == 0)
        {
            System.out.println("Usage: TransitionMatrixSplitter <T-matrix> <split-state> <p1> <k1> <k2>");
        }

        IDoubleArray T_old = doublesNew.fromFile(args[0]);
        int split_state = str.toInt(args[1]);
        double p1 = str.toDouble(args[2]);
        double k1 = str.toDouble(args[3]);
        double k2 = str.toDouble(args[4]);

        TransitionMatrixSplitter tms = new TransitionMatrixSplitter(T_old);
        IDoubleArray T_split = tms.splitForLifetimes(split_state, p1, k1, k2);
    }
View Full Code Here

        int i1 = 0, i2 = 0; // left window
        int j1 = 0, j2 = 0; // right window
        double sum = 0; // sum of products
        double count = 0; // number of products

        IDoubleArray cumdata = cumulate(data);

        double maxtime = time.get(time.size() - 1);
        // as long as there is enough space:
        while (maxtime - time.get(i1) >= tau)
        {
            // move end of left window
            i2 = i1;
            while (time.get(i2) - time.get(i1) <= averageWidth && i2 < time.size())
            {
                i2++;
                if (i2 >= time.size())
                {
                    break;
                }
            }

            // move beginning of right window
            while (time.get(j1) - time.get(i1) < tau
                    && maxtime - time.get(j1) >= tau)
            {
                j1++;
                if (j1 >= time.size())
                {
                    break;
                }
            }

            // move end of right window
            j2 = j1;
            if (j2 < time.size())
            {
                while (time.get(j2) - time.get(j1) <= averageWidth && j2 < time.size())
                {
                    j2++;
                    if (j2 >= time.size())
                    {
                        break;
                    }
                }
            }

            /*
            if (tau == 103247)
            {
                System.out.println("("+i1+","+i2+")\t("+j1+","+j2+")");
            }
            */

            // update autocorrelation
            double x1 = (cumdata.get(i2)-cumdata.get(i1))/(i2-i1);
            double x2 = (cumdata.get(j2)-cumdata.get(j1))/(j2-j1);
            sum += x1*x2;
            count += 1;

            // shift left window
            i1++;
View Full Code Here

     * @param data
     * @return the autocorrelations of the data on the tau grid specified
     */
    public IDoubleArray correlate(IDoubleArray time, IDoubleArray data)
    {
        IDoubleArray res = doublesNew.array(lagtimes.size());

        for (int i = 0; i < res.size(); i++)
        {
            res.set(i, correlate(time, data, lagtimes.get(i), averageWidths.get(i)));
        }

        return res;
    }
View Full Code Here

     * @param X A data sequence.
     */
    @Override
    final public void computeTransform()
    {
        IDoubleArray Cov = moments.getCov();
        IEigenvalueDecomposition evd = alg.evd(Cov);
        this.eval = evd.getEvalNorm();
        this.evec = evd.getRightEigenvectorMatrix().viewReal();
    }
View Full Code Here

     * @param x
     */
    @Override
    public IDoubleArray transform(IDoubleArray x)
    {
        IDoubleArray out = doublesNew.array(dimOut);
        transform(x, out);
        return out;
    }   
View Full Code Here

        System.out.println();
    }
   
    public static void main(String[] args)
    {
        IDoubleArray Fnet = doublesNew.array(new double[][]{
                                 {0.00000000e+00,   7.71791768e-03,   3.08716707e-03,   0.00000000e+000.00000000e+00},
                                 {0.00000000e+00,   0.00000000e+00,   5.14527845e-04,   0.00000000e+007.20338983e-03},
                                 {0.00000000e+00,   0.00000000e+00,   0.00000000e+00,   0.00000000e+003.60169492e-03},
                                 {0.00000000e+00,   4.33680869e-19,   0.00000000e+00,   0.00000000e+000.00000000e+00},
                                 {0.00000000e+00,   0.00000000e+00,   0.00000000e+00,   0.00000000e+000.00000000e+00}});
View Full Code Here

        {
            in = doublesNew.array(in.getArray());
        }
       
        // subtract mean
        IDoubleArray x = alg.subtract(in, moments.getMean());
       
        // make a row
        if (x.rows() > 1)
            x = alg.transposeToNew(x);
       
        IDoubleArray y = alg.product(x, evec);
        int d = Math.min(in.size(),out.size());
        for (int i=0; i<d; i++)
            out.set(i, y.get(i));
    }
View Full Code Here

     * @param time
     * @param data
     */
    public void add(IDoubleArray time, IDoubleArray data)
    {
        IDoubleArray c = correlate(time, data);
        for (int i = 0; i < c.size(); i++)
        {
            if (!Double.isNaN(c.get(i)))
            {
                correlation.set(i, correlation.get(i) + data.size() * c.get(i));
                weights.set(i, weights.get(i) + data.size());
            }
        }

        sum += doubles.sum(data);
View Full Code Here

TOP

Related Classes of stallone.api.doubles.IDoubleArray

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.