Package ca.nengo.model

Examples of ca.nengo.model.StructuralException


  /**
   * @see ca.nengo.model.Network#getOrigin(java.lang.String)
   */
  public Origin getOrigin(String name) throws StructuralException {
    if ( !myExposedOrigins.containsKey(name) ) {
      throw new StructuralException("There is no exposed Origin named " + name);
    }
    return myExposedOrigins.get(name);
  }
View Full Code Here


  /**
   * @see ca.nengo.model.Network#getTermination(java.lang.String)
   */
  public Termination getTermination(String name) throws StructuralException {
    if ( !myExposedTerminations.containsKey(name) ) {
      throw new StructuralException("There is no exposed Termination named " + name);
    }
    return myExposedTerminations.get(name);
  }
View Full Code Here

  /**
   * @see ca.nengo.model.Network#exposeState(ca.nengo.model.Probeable, java.lang.String, java.lang.String)
   */
  public void exposeState(Probeable probeable, String stateName, String name) throws StructuralException {
    if (probeable.listStates().get(stateName) == null) {
      throw new StructuralException("The state " + stateName + " does not exist");
    }

    myProbeables.put(name, probeable);
    myProbeableStates.put(name, stateName);
  }
View Full Code Here

            }

      for (int i = 0; i < n; i++) {
        Node node = myNodeFactory.make("node" + i);
        if ( !(node instanceof NEFNode) ) {
          throw new StructuralException("Nodes must be NEFNodes");
        }
        nodes[i] = (NEFNode) node;

        nodes[i].setMode(SimulationMode.CONSTANT_RATE);
        if ( !nodes[i].getMode().equals(SimulationMode.CONSTANT_RATE) ) {
          throw new StructuralException("Neurons in an NEFEnsemble must support CONSTANT_RATE mode");
        }

        nodes[i].setMode(SimulationMode.DEFAULT);
      }

      float[][] encoders = myEncoderFactory.genVectors(n, dim);
      float[][] evalPoints = getEvalPointFactory().genVectors(getNumEvalPoints(dim), dim);
      NEFEnsemble result = construct(name, nodes, encoders, myApproximatorFactory, evalPoints, radii);

      addDefaultOrigins(result);

      result.setEnsembleFactory(this);

      return result;
    }
    catch(RuntimeException re)
    {
      // a singular gamma matrix can produce a runtime exception.  If this occurs,
      // call make again.
      if(re.getMessage() != null && re.getMessage().equals("Matrix is singular.")) {
        if (attempts<10) {
          return doMake(name,n,radii,attempts+1);
        } else {
          throw new StructuralException("Error creating ensemble: With the given parameters, there is insufficient\nneural activity to construct a decoder (the activity matrix is singular)");
        }
            } else
      {
        System.err.println(re);
        return(null);
View Full Code Here

   * @return New NEFEnsemble with given parameters
   * @throws StructuralException
   */
  protected NEFEnsemble construct(String name, NEFNode[] nodes, float[][] encoders, ApproximatorFactory af, float[][] evalPoints, float[] radii)
      throws StructuralException {
    if (!VisiblyMutableUtils.isValidName(name)) throw new StructuralException("name '"+name+"' must not contain '.' or ':'");
    return new NEFEnsembleImpl(name, nodes, encoders, af, evalPoints, radii);
  }
View Full Code Here

   */
  public DecodedOrigin(Node node, String name, Node[] nodes, String nodeOrigin, Function[] functions, float[][] decoders, int dummy) throws StructuralException {
    checkFunctionDimensions(functions);

    if (!MU.isMatrix(decoders)) {
      throw new StructuralException("Elements of decoders do not all have the same length");
    }

    if (decoders[0].length != functions.length) {
      throw new StructuralException("Number of decoding functions and dimension of decoding vectors must be the same");
    }

    if (decoders.length != nodes.length) {
      throw new StructuralException("Number of decoding vectors and Neurons must be the same");
    }

    myNode = node;
    myName = name;
    myNodes = nodes;
View Full Code Here

  private static void checkFunctionDimensions(Function[] functions) throws StructuralException {
    int dim = functions[0].getDimension();
    for (int i = 1; i < functions.length; i++) {
      if (functions[i].getDimension() != dim) {
        throw new StructuralException("Functions must all have the same input dimension");
      }
    }
  }
View Full Code Here

TOP

Related Classes of ca.nengo.model.StructuralException

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.