Example usage for java.util Arrays fill

List of usage examples for java.util Arrays fill

Introduction

In this page you can find the example usage for java.util Arrays fill.

Prototype

public static void fill(Object[] a, Object val) 

Source Link

Document

Assigns the specified Object reference to each element of the specified array of Objects.

Usage

From source file:hivemall.model.NewDenseModel.java

public NewDenseModel(int ndims, boolean withCovar) {
    super();//from w  ww . jav a2s  . c o  m
    int size = ndims + 1;
    this.size = size;
    this.weights = new float[size];
    if (withCovar) {
        float[] covars = new float[size];
        Arrays.fill(covars, 1.f);
        this.covars = covars;
    } else {
        this.covars = null;
    }
    this.clocks = null;
    this.deltaUpdates = null;
}

From source file:edu.stevens.cpe.reservior.readout.GradientDecent.java

public GradientDecent(ReservoirNetwork reservoir, MLDataSet trainingSet, double learningRate) {
    this.reservoir = reservoir;
    this.trainingSet = trainingSet;
    this.learningRate = learningRate;
    //this.deltaWeights = new double [reservoir.getReservior().getNeuronCount() * reservoir.getReadout().getNumberOutputs()];
    Arrays.fill(deltaWeights, 0.0);
}

From source file:com.lightboxtechnologies.nsrl.HashRecordProcessorTest.java

@Test(expected = BadDataException.class)
public void processTooManyCols() throws BadDataException {
    final RecordProcessor<HashData> proc = new HashRecordProcessor();
    final String[] cols = new String[9];
    Arrays.fill(cols, "foo");
    proc.process(cols);//from   w w w.j av  a2s .c om
}

From source file:de.tuberlin.uebb.jdae.solvers.OptimalitySolver.java

@Override
public double[] solve(int maxEval, MultivariateDifferentiableVectorFunction f, double[] startValue) {
    final double[] zeros = startValue.clone();
    final double[] ones = startValue.clone();
    Arrays.fill(zeros, 0.0);
    Arrays.fill(ones, 1.0);/*from  w ww .j  ava  2 s. c  o  m*/

    return optim.optimize(new MaxEval(maxEval), new InitialGuess(startValue), new Target(zeros),
            new Weight(ones), new ModelFunction(f), new ModelFunctionJacobian(new JacobianFunction(f)))
            .getPoint();
}

From source file:de.bund.bfr.math.Evaluator.java

public static double[] getFunctionPoints(Map<String, Double> parserConstants, String formula, String varX,
        double[] valuesX) throws ParseException {
    FunctionConf function = new FunctionConf(parserConstants, formula, varX, valuesX);
    double[] result = results.getIfPresent(function);

    if (result != null) {
        return result;
    }/*  w ww  . j a va 2s  . c  o m*/

    Parser parser = new Parser();

    parserConstants.forEach((constant, value) -> parser.setVarValue(constant, value));

    ASTNode f = parser.parse(formula);
    double[] valuesY = new double[valuesX.length];

    Arrays.fill(valuesY, Double.NaN);

    for (int i = 0; i < valuesX.length; i++) {
        parser.setVarValue(varX, valuesX[i]);
        valuesY[i] = parser.evaluate(f);
    }

    results.put(function, valuesY);

    return valuesY;
}

From source file:com.sinosoft.one.mvc.web.impl.mapping.EngineGroupImpl.java

public EngineGroupImpl() {
    LinkedEngine[][] engines = new LinkedEngine[ARRAY_SIZE][];
    Arrays.fill(engines, emptyEngines);
    this.engines = engines;
}

From source file:juicebox.matrix.SymmetricMatrix.java

public void fill(float value) {
    Arrays.fill(data, value);
}

From source file:com.espertech.esper.antlr.ASTUtil.java

private static void dumpAST(PrintWriter printer, Tree ast, int ident) {
    char[] identChars = new char[ident];
    Arrays.fill(identChars, ' ');

    if (ast == null) {
        renderNode(identChars, null, printer);
        return;/*  w ww .j a  va2s .  co m*/
    }
    for (int i = 0; i < ast.getChildCount(); i++) {
        Tree node = ast.getChild(i);
        if (node == null) {
            throw new NullPointerException("Null AST node");
        }
        renderNode(identChars, node, printer);
        dumpAST(printer, node, ident + 2);
    }
}

From source file:hivemall.model.NewSpaceEfficientDenseModel.java

public NewSpaceEfficientDenseModel(int ndims, boolean withCovar) {
    super();// ww  w.ja  v  a2 s  .  c o m
    int size = ndims + 1;
    this.size = size;
    this.weights = new short[size];
    if (withCovar) {
        short[] covars = new short[size];
        Arrays.fill(covars, HalfFloat.ONE);
        this.covars = covars;
    } else {
        this.covars = null;
    }
    this.clocks = null;
    this.deltaUpdates = null;
}

From source file:com.dungnv.streetfood.business.TagsBusiness.java

@Override
public Map<String, String> getMapTagsByName(List<String> listTagName) {
    Map<String, String> map = new HashMap<>();

    Type[] types = new Type[listTagName.size()];
    String[] param = new String[listTagName.size()];
    Arrays.fill(types, StringType.INSTANCE);
    Criteria cri = gettDAO().getSession().createCriteria(Tags.class);
    cri.add(Restrictions.sqlRestriction(
            " lower(" + Tags.NAME + ") in " + QueryUtil.getParameterHolderString(listTagName.size())//
            , StringUtils.trimStringToNewList(listTagName, Boolean.TRUE).toArray(param)//
            , types));/*from   w w w. j a va  2s. c  o m*/

    List<Tags> listTags = cri.list();
    for (Tags tags : listTags) {
        map.put(tags.getName().toLowerCase(), tags.getId().toString());
    }
    for (String tags : listTagName) {
        if (!map.containsKey(tags.trim().toLowerCase())) {
            map.put(tags.trim().toLowerCase(), null);
        }
    }
    return map;
}