/** * Sets the values of the given list as weights in the synapse layer * * @param list The list of weights * @return Boolean indicating if the operation succeeded */ public boolean setWeightVector(Vector<Double> list) { this.checker.init("setWeightVector"); this.checker.addCheck(list != null, "The given list of weights is null."); this.checker.addCheck(list.size() > 0, "The given list of weights is empty."); if (this.checker.isSecure()) { if (list != null) { int offset = 0; for (SynapseLayer synlayer : this.synapse_layers) for (Synapse synapse : synlayer.synapses) synapse.weight = list.get(offset++).doubleValue(); } else System.err.println( "ERROR: Tried to set the network's weights by providing a null pointer instead of the weight list."); return true; } return false; }