Examples of Matrix


Examples of eas.math.matrix.Matrix

        return this.getActivationFunction(id).activationPhi(this.getNeuronValue(id));
    }
   
    public NeuralNetworkDoubleBase(final ParCollection params, int neuronsCount) {
        this.pars = params;
        this.neuronVector = new Matrix(1, neuronsCount);
        this.weightMatrix = new Matrix(neuronsCount, neuronsCount);
        this.activationFunctions = new HashMap<>();
        this.inverseWeightMatrix = null;
        this.standardActFct = new ActivationFunctionSigmoid(1.0);
    }
View Full Code Here

Examples of edu.gmu.seor.prognos.unbbayesplugin.cps.Jama.Matrix


  private CoVarMatrix opCoVarMatComponents(CoVarMatrix coVarMatrix,
      CoVarMatrix coVarMatrix2, int Operator) {
    CoVarMatrix res = new CoVarMatrix();
    Matrix one = new Matrix(coVarMatrix.getCoVarMatrix());
    Matrix two = new Matrix(coVarMatrix2.getCoVarMatrix());
    if(Operator == PLUS_OPERATOR){
      res.setCoVarMatrix(one.plus(two).getArray());
    }else if(Operator == MINUS_OPERATOR){
      res.setCoVarMatrix(one.minus(two).getArray());
    }
View Full Code Here

Examples of edu.ucla.sspace.matrix.Matrix

            // pi*D-Inverse.
            DoubleVector v = new DenseVector(vectorLength);
            for (int i = 0; i < v.length(); ++i)
                v.set(i, Math.random());

            Matrix RinvData = (matrix instanceof SparseMatrix)
                ? new RowScaledSparseMatrix((SparseMatrix) matrix, Rinv)
                : new RowScaledMatrix(matrix, Rinv);

            // Make log(matrix.rows()) passes.
            int log = (int) Statistics.log2(vectorLength);
View Full Code Here

Examples of flanagan.math.Matrix

                }
                kk++;
            }

            // invert the above calculated matrix
            Matrix mat = new Matrix(this.weights);
            mat = mat.inverse();
            this.weights = mat.getArrayCopy();
        }
View Full Code Here

Examples of flash.swf.types.Matrix

    DefineShapeBuilder builder = new DefineShapeBuilder(shape, graphicContext, draw, fill);

    DefineShape ds3 = (DefineShape)builder.build();
    defineTags.defineShape3(ds3);

    Matrix matrix;

    if (isGradient)
    {
      double originX = graphicContext.getPen().getX();
      double originY = graphicContext.getPen().getY();
View Full Code Here

Examples of gov.sandia.cognition.math.matrix.Matrix

    final int N = 100;

    final double[] a = {0.9d, 0.9d};
    final double[] sigma2 = {Math.pow(0.2d, 2), Math.pow(1.2d, 2)};
    final double sigma_y2 = Math.pow(0.3d, 2);
    Matrix modelCovariance1 = MatrixFactory.getDefault().copyArray(
        new double[][] {{Math.pow(0.2d, 2)}});
    Matrix modelCovariance2 = MatrixFactory.getDefault().copyArray(
        new double[][] {{Math.pow(1.2d, 2)}});
    Matrix measurementCovariance = MatrixFactory.getDefault().copyArray(
        new double[][] {{Math.pow(0.3d, 2)}});
    LinearDynamicalSystem model1 = new LinearDynamicalSystem(
        MatrixFactory.getDefault().copyArray(new double[][] {{0.9d}}),
        MatrixFactory.getDefault().copyArray(new double[][] {{1}}),
        MatrixFactory.getDefault().copyArray(new double[][] {{1}})
      );
    LinearDynamicalSystem model2 = new LinearDynamicalSystem(
        MatrixFactory.getDefault().copyArray(new double[][] {{0.9d}}),
        MatrixFactory.getDefault().copyArray(new double[][] {{1}}),
        MatrixFactory.getDefault().copyArray(new double[][] {{1}})
      );
    KalmanFilter trueKf1 = new KalmanFilter(model1, modelCovariance1, measurementCovariance);
    KalmanFilter trueKf2 = new KalmanFilter(model2, modelCovariance2, measurementCovariance);

    final UnivariateGaussian prior = new UnivariateGaussian(0d, sigma_y2);
    final UnivariateGaussian s1Likelihood = prior;
    final UnivariateGaussian s2Likelihood = s1Likelihood;
   
    Vector initialClassProbs = VectorFactory.getDefault()
            .copyArray(new double[] { 0.7d, 0.3d });
    Matrix classTransProbs = MatrixFactory.getDefault().copyArray(
                new double[][] { { 0.7d, 0.7d },
                    { 0.3d, 0.3d } });
   
    DlmHiddenMarkovModel dlmHmm = new DlmHiddenMarkovModel(
        Lists.newArrayList(trueKf1, trueKf2),
View Full Code Here

Examples of lejos.util.Matrix

  private static final float AXLE_TRACK = 16.0f;
 
  public static void main(String[] args) throws InterruptedException {
    UltrasonicSensor sonic = new UltrasonicSensor(SensorPort.S1);
    Random rand = new Random();
    Matrix a = new Matrix(new double[][]{{1}}); // Position is only changed by control
    Matrix b = new Matrix(new double[][]{{1}}); // Velocity is in cm/sec
    Matrix c = new Matrix(new double[][]{{1}}); // Measurement is in cm
    Matrix q = new Matrix(new double[][]{{4}}); // Ultrasonic sensor noise factor
    Matrix r = new Matrix(new double[][]{{9}}); // Movement noise factor
    Matrix state = new Matrix(new double[][]{{100}}); // Start one meter from the wall
    Matrix covariance = new Matrix(new double[][]{{100}}); // Big error
    Matrix control = new Matrix(1,1);
    Matrix measurement = new Matrix(1,1);
   
    //RConsole.openBluetooth(0);
    //System.setOut(new PrintStream(RConsole.openOutputStream()));
   
    // Create the pilot
    DifferentialPilot pilot = new DifferentialPilot(
        TYRE_DIAMETER, AXLE_TRACK, Motor.B, Motor.C, true);
   
    //Create the filter
    KalmanFilter filter = new KalmanFilter(a,b,c,q,r);
   
    // Set the initial state 
    filter.setState(state, covariance);

    // Loop 100 times setting velocity, reading the range and updating the filter
    for(int i=0;i<100;i++) {
      // Generate a random velocity -20 to +20cm/sec
      double velocity = (rand.nextInt(41) - 20);
     
      // Adjust velocity so we keep in range
      double position = filter.getMean().get(0, 0);
      if (velocity < 0 && position < 20) velocity = -velocity;
      if (velocity > 0 && position > 220) velocity = -velocity;
     
      control.set(0, 0, velocity);
      System.out.println("Velocity: " + (int) velocity);

      // Move the robot
      pilot.setMoveSpeed((float) Math.abs(velocity));
      if (velocity > 0) pilot.backward();
      else pilot.forward();
      Thread.sleep(1000);
      pilot.stop();
     
      // Take a reading
      float range = sonic.getRange();
      System.out.println("Range: " + (int) range);
      measurement.set(0,0, (double) range);
     
      // Update the state
      try {
        filter.update(control, measurement);
      } catch(Exception e) {
View Full Code Here

Examples of lipstone.joshua.parser.types.Matrix

   
    do {
      if (current.getCarType() == ConsType.CONS_CELL)
        current.replaceCar(preProcess((ConsCell) current.getCar()));
      if (current.getCarType() == ConsType.OBJECT && ((String) current.getCar()).startsWith("{[")) {
        currentEqn.matrices.add(new Matrix((String) current.getCar()));
        current.replaceCar(new ConsCell("{M" + (currentEqn.matrices.size() - 1) + "}", ConsType.OBJECT));
      }
    } while (!((current = current.getNextConsCell()).isNull())); //This steps current forward while checking for nulls
    current = input;
   
View Full Code Here

Examples of math.Matrix

   * Returns the momentum of inertia tensor corresponding to a homgenuously
   * filled sphere of the given radius and mass.
   */
  public static Matrix getSphereInertialTensor(double m, double r) {
    double momentum = 0.4f * m * r * r;
    return new Matrix(new double[][] { { momentum, 0, 0 },
        { 0, momentum, 0 }, { 0, 0, momentum } });
  }
View Full Code Here

Examples of mephi.cybernetics.dhcn.common.data.Matrix

    public IResultSolver execute(DataTask task)
    {
        System.out.println("SolverDataMatrixMultNum");
        DataMatrixMultNumTask currentTask = (DataMatrixMultNumTask) task;
        DataTaskSolver tasks = new DataTaskSolver();
        Matrix matrix = currentTask.getMatrix();
        Double num    = currentTask.getNum();
        for(int i = 0; i < matrix.getCountVector(); i++)
        {
            DataVectorMultNumTask newTask = new DataVectorMultNumTask(matrix.getMatrixVector(i), num, -1, i, Config.NODE_SOLVER);
            tasks.addTask(newTask);
        }
        return tasks;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.