CPD Results

The following document contains the results of PMD's CPD 6.13.0.

Duplications

File Line
org/mklab/tool/control/system/continuous/DerivativeSystem.java 18
org/mklab/tool/control/system/discrete/UnitLeadSystem.java 24
  public DerivativeSystem() {
    super();
    setAutoSize(false);
  }

  /**
   * @see org.mklab.tool.control.system.SystemOperator#setInputSize(int)
   */
  @Override
  public void setInputSize(final int size) {
    if (size < 0) {
      return;
    }

    super.setInputSize(size);
    super.setOutputSize(size);

    if (getStateSize() != size) {
      setStateSize(size);
      super.setInitialState(new DoubleMatrix(size, 1));
      setLinearSystem(LinearSystemFactory.createLinearSystem(new DoubleMatrix(new double[][]{{0,1},{-1,0}}), new DoubleMatrix(new double[][]{{0},{1}}), new DoubleMatrix(new double[][]{{0,1}}), new DoubleMatrix(new double[][]{{0}}), new DoubleMatrix(new double[][]{{1,0},{0,0}})));
    }
  }

  /**
   * @see org.mklab.tool.control.system.SystemOperator#setOutputSize(int)
   */
  @Override
  public void setOutputSize(final int size) {
    if (size < 0) {
      return;
    }

    super.setInputSize(size);
    super.setOutputSize(size);

    if (getStateSize() != size) {
      setStateSize(size);
      super.setInitialState(new DoubleMatrix(size, 1));
      setLinearSystem(LinearSystemFactory.createLinearSystem(new DoubleMatrix(new double[][]{{0,1},{-1,0}}), new DoubleMatrix(new double[][]{{0},{1}}), new DoubleMatrix(new double[][]{{0,1}}), new DoubleMatrix(new double[][]{{0}}), new DoubleMatrix(new double[][]{{1,0},{0,0}})));
    }
  }

  /**
   * @see org.mklab.tool.control.system.continuous.BaseContinuousExplicitDynamicSystem#setInitialState(org.mklab.nfc.matrix.Matrix)
   */
  @Override
  public void setInitialState(Matrix initialState) {
    super.setInitialState(initialState);

    final int size = initialState.length();

    if (getStateSize() != size) {
      setStateSize(size);
      setLinearSystem(LinearSystemFactory.createLinearSystem(new DoubleMatrix(new double[][]{{0,1},{-1,0}}), new DoubleMatrix(new double[][]{{0},{1}}), new DoubleMatrix(new double[][]{{0,1}}), new DoubleMatrix(new double[][]{{0}}), new DoubleMatrix(new double[][]{{1,0},{0,0}})));
    }

    setInputSize(initialState.length());
    setOutputSize(initialState.length());
  }


}
File Line
org/mklab/tool/control/system/AdjacencyMatrixUtil.java 613
org/mklab/tool/control/system/AdjacencyMatrixUtil.java 689
    } else if (system.getLinearSystem().isProper() == false) {

      // A取得
      matrix[1][2] = new ConstantSystem(linearSystem.getA());
      if (linearSystem.hasVariableA()) {
        //        ((ConstantSystem)matrix[1][2]).setExpression("A_" + linearSystem.getTag()); //$NON-NLS-1$
        ((ConstantSystem)matrix[1][2]).setExpression(linearSystem.getTag() + "_A"); //$NON-NLS-1$
      } else {
        final Matrix value = linearSystem.getA();
        ((ConstantSystem)matrix[1][2]).setExpression(toMmString(value, format));
      }
      ((ConstantSystem)matrix[1][2]).setTag(linearSystem.getTag());
      ((ConstantSystem)matrix[1][2]).setVariable(linearSystem.hasVariableA());

      // B取得
      matrix[0][2] = new ConstantSystem(linearSystem.getB());
      if (linearSystem.hasVariableB()) {
        //        ((ConstantSystem)matrix[0][2]).setExpression("B_" + linearSystem.getTag()); //$NON-NLS-1$
        ((ConstantSystem)matrix[0][2]).setExpression(linearSystem.getTag() + "_B"); //$NON-NLS-1$
      } else {
        final Matrix value = linearSystem.getB();
        ((ConstantSystem)matrix[0][2]).setExpression(toMmString(value, format));
      }
      ((ConstantSystem)matrix[0][2]).setTag(linearSystem.getTag());
      ((ConstantSystem)matrix[0][2]).setVariable(linearSystem.hasVariableB());

      // C取得
      matrix[1][3] = new ConstantSystem(linearSystem.getC());
      if (linearSystem.hasVariableC()) {
        //        ((ConstantSystem)matrix[1][3]).setExpression("C_" + linearSystem.getTag()); //$NON-NLS-1$
        ((ConstantSystem)matrix[1][3]).setExpression(linearSystem.getTag() + "_C"); //$NON-NLS-1$
      } else {
        final Matrix value = linearSystem.getC();
        ((ConstantSystem)matrix[1][3]).setExpression(toMmString(value, format));
      }
      ((ConstantSystem)matrix[1][3]).setTag(linearSystem.getTag());
      ((ConstantSystem)matrix[1][3]).setVariable(linearSystem.hasVariableC());

      // D取得
      final Matrix value = linearSystem.getD();
      if (value.isZero()) {
        matrix[0][3] = ZeroSystem.getInstance();
      } else {
        matrix[0][3] = new ConstantSystem(linearSystem.getD());
        if (linearSystem.hasVariableD()) {
          //        ((ConstantSystem)matrix[0][3]).setExpression("D_" + linearSystem.getTag()); //$NON-NLS-1$
          ((ConstantSystem)matrix[0][3]).setExpression(linearSystem.getTag() + "_D"); //$NON-NLS-1$
        } else {
File Line
org/mklab/tool/control/ImproperLinearSystem.java 348
org/mklab/tool/control/ProperLinearSystem.java 442
            string.append("  "); //$NON-NLS-1$
          }
        }
      }

      string.append("["); //$NON-NLS-1$
      for (int column = 0; column < getSubSystemSize(); column++) {
        final String format = "%" + columnLengthes[column] + "s"; //$NON-NLS-1$ //$NON-NLS-2$
        string.append(String.format(format, this.getSymbolicCMatrix()[row][column]));
        if (column != getSubSystemSize() - 1) {
          string.append("  "); //$NON-NLS-1$
        }
      }

      if (0 < getStateSize()) {
        string.append("|"); //$NON-NLS-1$
      }

      for (int column = 0; column < getInputPortSize(); column++) {
        final String format = "%" + columnLengthes[column + getSubSystemSize()] + "s"; //$NON-NLS-1$ //$NON-NLS-2$
        string.append(String.format(format, this.getSymbolicDMatrix()[row][column]));
        if (column != getInputPortSize() - 1) {
          string.append("  "); //$NON-NLS-1$
        }
      }
      string.append("]"); //$NON-NLS-1$

      if (withInputOutput && row < symbolicInput.length) {
        string.append("[" + symbolicInput[row] + "]"); //$NON-NLS-1$ //$NON-NLS-2$
        if (row == getInputPortSize() / 2) {
          if (isContinuous()) {
            string.append("(t)"); //$NON-NLS-1$
          } else {
            string.append("(k)"); //$NON-NLS-1$
          }
        }
      }

      string.append(lineSeparator);
    }

    if (withInputOutput && symbolicOutput.length < symbolicInput.length) {
      final int lengthTolastLineSeparator = string.lastIndexOf(lineSeparator, string.length() - lineSeparator.length() - 1) + lineSeparator.length();
      final int widthOfInputVector = (1 + symbolicInput[0].length() + 1);
      int spaceLength = (string.length() - lengthTolastLineSeparator) - 2 - widthOfInputVector;
      if (getOutputPortSize() - 1 == getInputPortSize() / 2) {
        spaceLength -= 3;
      }
      final String format = "%" + spaceLength + "s"; //$NON-NLS-1$ //$NON-NLS-2$

      for (int i = 0; i < symbolicInput.length - symbolicOutput.length; i++) {
        string.append(String.format(format, "")); //$NON-NLS-1$
        final int row = symbolicOutput.length + i;
        string.append("[" + symbolicInput[row] + "]"); //$NON-NLS-1$ //$NON-NLS-2$

        if (row == getInputPortSize() / 2) {
          if (isContinuous()) {
            string.append("(t)"); //$NON-NLS-1$
          } else {
            string.append("(k)"); //$NON-NLS-1$
          }
        }
        string.append(lineSeparator);
      }
    }

    return string.toString();
  }
File Line
org/mklab/tool/control/WeierstrassForm.java 318
org/mklab/tool/control/WeierstrassForm.java 508
  private NumericalMatrix<?>[] blockDiagonaliize(final NumericalMatrix<?> A, final NumericalMatrix<?> E, double tolerance) {
    int zeroCount = 0;

    for (int i = 1; i <= E.getColumnSize(); i++) {
      if (E.getElement(i, i).isZero(tolerance)) {
        zeroCount = i - 1;
        break;
      }
    }

    final NumericalMatrix<?> A11 = (NumericalMatrix<?>)A.getSubMatrix(1, zeroCount, 1, zeroCount);
    final NumericalMatrix<?> A12 = (NumericalMatrix<?>)A.getSubMatrix(1, zeroCount, 1 + zeroCount, A.getColumnSize());
    final NumericalMatrix<?> A22 = (NumericalMatrix<?>)A.getSubMatrix(1 + zeroCount, A.getColumnSize(), 1 + zeroCount, A.getColumnSize());

    final NumericalMatrix<?> E11 = (NumericalMatrix<?>)E.getSubMatrix(1, zeroCount, 1, zeroCount);
    final NumericalMatrix<?> E12 = (NumericalMatrix<?>)E.getSubMatrix(1, zeroCount, 1 + zeroCount, E.getColumnSize());
    final NumericalMatrix<?> E22 = (NumericalMatrix<?>)E.getSubMatrix(1 + zeroCount, E.getColumnSize(), 1 + zeroCount, E.getColumnSize());

    if (zeroCount == 0) {
      this.BDL = upperTriInverse(A22);
      this.BDR = (NumericalMatrix<?>)A.createUnit();
      NumericalMatrix<?> bA = (NumericalMatrix<?>)A22.createUnit();
      //NumericalMatrixOperator<?> bE = (NumericalMatrixOperator<?>)upperTriInverse(A22).multiply(E22);
      NumericalMatrix<?> bE = (NumericalMatrix<?>)A22.leftDivide(E22);
      return new NumericalMatrix[] {bA, bE};
    } else if (zeroCount == A.getColumnSize()) {
      this.BDL = upperTriInverse(E11);
      this.BDR = (NumericalMatrix<?>)A.createUnit();
      //NumericalMatrixOperator<?> bA = (NumericalMatrixOperator<?>)upperTriInverse(E11).multiply(A11);
      NumericalMatrix<?> bA = (NumericalMatrix<?>)E11.leftDivide(A11);
      NumericalMatrix<?> bE = (NumericalMatrix<?>)E22.createUnit();
      return new NumericalMatrix[] {bA, bE};
    } else {
      int m = A11.getColumnSize();
      int n = A22.getColumnSize();

      final NumericalMatrix<?> blockMatrix = (NumericalMatrix<?>)A.createZero(m * n, m * n);
File Line
org/mklab/tool/control/system/sink/UserDefinedContinuousSink.java 86
org/mklab/tool/control/system/source/UserDefinedDiscreteSource.java 74
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setSystemClass(java.lang.Class)
   */
  public void setSystemClass(final Class<?> klass) {
    this.systemKlass = klass;
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#getSystemClass()
   */
  public Class<?> getSystemClass() {
    return this.systemKlass;
  }

  /**
   * システムの出力方程式を定義したメソッドを設定します。
   * 
   * @param method システムの出力方程式を定義したメソッド
   * @throws SecurityException メソッドにアクセスする権利が無い場合
   */
  public void setOutputFunction(Method method) throws SecurityException {
    this.outputFunction = method;
    this.outputFunction.setAccessible(true);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setInitializeFunction(java.lang.reflect.Method)
   */
  public void setInitializeFunction(final Method method) throws SecurityException {
    this.initializeFunction = method;
    this.initializeFunction.setAccessible(true);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setUpdateFunction(java.lang.reflect.Method)
   */
  public void setUpdateFunction(final Method method) throws SecurityException {
    this.updateFunction = method;
    this.updateFunction.setAccessible(true);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
   */
  public Object getParameterValue(String name) throws NoSuchParameterException {
    return ParameterUtil.getValue(this.systemKlass, name);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#getParameterNames()
   */
  public Set<String> getParameterNames() throws NoSuchParameterException {
    return ParameterUtil.getParameterNames(this.systemKlass);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setParameterValue(java.lang.String, java.lang.Object)
   */
  public void setParameterValue(String name, Object value) throws NoSuchParameterException {
    ParameterUtil.setValue(this.systemKlass, name, value);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#containParameter(java.lang.String)
   */
  public boolean containParameter(String name) {
    return ParameterUtil.contains(this.systemKlass, name);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#update()
   */
  public void update() throws ParameterException {
    try {
      this.updateFunction.invoke(this.obj);
    } catch (IllegalArgumentException e) {
      throw new ParameterException(e);
    } catch (IllegalAccessException e) {
      throw new ParameterException(e);
    } catch (InvocationTargetException e) {
      throw new ParameterException(e.getTargetException());
    } catch (Exception e) {
      throw new ParameterException(e);
    }
  }

  /**
   * @see org.mklab.tool.control.system.discrete.BaseDiscreteStaticSystem#initialize()
   */
  @Override
  public void initialize() {
    super.initialize();
    try {
      if (this.initializeFunction != null) {
        this.initializeFunction.invoke(this.obj);
      }
    } catch (IllegalArgumentException e) {
      throw new RuntimeException(e);
    } catch (IllegalAccessException e) {
      throw new RuntimeException(e);
    } catch (InvocationTargetException e) {
      throw new RuntimeException(e.getTargetException());
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
}
File Line
org/mklab/tool/control/WeierstrassForm.java 434
org/mklab/tool/control/WeierstrassForm.java 554
      this.BDL.setSubMatrix(1, m, m + 1, m + n, invE11.multiply(BDL12));
      this.BDL.setSubMatrix(m + 1, m + n, m + 1, m + n, upperTriInverse(A22));

      NumericalMatrix<?> bA = (NumericalMatrix<?>)A.clone();
      //bA.setSubMatrix(1, A11.getRowSize(), 1, A11.getColumnSize(), upperTriInverse(E11).multiply(A11));
      bA.setSubMatrix(1, A11.getRowSize(), 1, A11.getColumnSize(), E11.leftDivide(A11));
      bA.setSubMatrix(1, A11.getRowSize(), 1 + A11.getColumnSize(), A.getColumnSize(), A12.createZero());
      bA.setSubMatrix(1 + A11.getRowSize(), A.getRowSize(), 1, A11.getColumnSize(), A12.transpose().createZero());
      bA.setSubMatrix(1 + A11.getRowSize(), A.getRowSize(), 1 + A11.getColumnSize(), A.getColumnSize(), A22.createUnit());

      NumericalMatrix<?> bE = (NumericalMatrix<?>)E.clone();
      bE.setSubMatrix(1, A11.getRowSize(), 1, A11.getColumnSize(), E11.createUnit());
      bE.setSubMatrix(1, A11.getRowSize(), 1 + A11.getColumnSize(), A.getColumnSize(), A12.createZero());
      bE.setSubMatrix(1 + A11.getRowSize(), A.getRowSize(), 1, A11.getColumnSize(), A12.transpose().createZero());
      //bE.setSubMatrix(1 + A11.getRowSize(), A.getRowSize(), 1 + A11.getColumnSize(), A.getColumnSize(), upperTriInverse(A22).multiply(E22));
      bE.setSubMatrix(1 + A11.getRowSize(), A.getRowSize(), 1 + A11.getColumnSize(), A.getColumnSize(), A22.leftDivide(E22));

      return new NumericalMatrix[] {bA, bE};
    }
  }
File Line
org/mklab/tool/control/system/discrete/UserDefinedDiscreteDynamicSystem.java 135
org/mklab/tool/control/system/sink/UserDefinedContinuousSink.java 100
org/mklab/tool/control/system/source/UserDefinedDiscreteSource.java 88
  }

  /**
   * システムの出力方程式を定義したメソッドを設定します。
   * 
   * @param method システムの出力方程式を定義したメソッド
   * @throws SecurityException メソッドにアクセスする権利が無い場合
   */
  public void setOutputFunction(Method method) throws SecurityException {
    this.outputFunction = method;
    this.outputFunction.setAccessible(true);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setInitializeFunction(java.lang.reflect.Method)
   */
  public void setInitializeFunction(final Method method) throws SecurityException {
    this.initializeFunction = method;
    this.initializeFunction.setAccessible(true);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setUpdateFunction(java.lang.reflect.Method)
   */
  public void setUpdateFunction(final Method method) throws SecurityException {
    this.updateFunction = method;
    this.updateFunction.setAccessible(true);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
   */
  public Object getParameterValue(String name) throws NoSuchParameterException {
    return ParameterUtil.getValue(this.systemKlass, name);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#getParameterNames()
   */
  public Set<String> getParameterNames() throws NoSuchParameterException {
    return ParameterUtil.getParameterNames(this.systemKlass);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setParameterValue(java.lang.String, java.lang.Object)
   */
  public void setParameterValue(String name, Object value) throws NoSuchParameterException {
    ParameterUtil.setValue(this.systemKlass, name, value);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#containParameter(java.lang.String)
   */
  public boolean containParameter(String name) {
    return ParameterUtil.contains(this.systemKlass, name);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#update()
   */
  public void update() throws ParameterException {
    try {
      this.updateFunction.invoke(this.obj);
    } catch (IllegalArgumentException e) {
      throw new ParameterException(e);
    } catch (IllegalAccessException e) {
      throw new ParameterException(e);
    } catch (InvocationTargetException e) {
      throw new ParameterException(e.getTargetException());
    } catch (Exception e) {
      throw new ParameterException(e);
    }
  }

  /**
   * @see org.mklab.tool.control.system.discrete.BaseDiscreteStaticSystem#initialize()
   */
  @Override
  public void initialize() {
    super.initialize();
    try {
      if (this.initializeFunction != null) {
        this.initializeFunction.invoke(this.obj);
      }
    } catch (IllegalArgumentException e) {
      throw new RuntimeException(e);
    } catch (IllegalAccessException e) {
      throw new RuntimeException(e);
    } catch (InvocationTargetException e) {
      throw new RuntimeException(e.getTargetException());
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
File Line
org/mklab/tool/control/system/discrete/UserDefinedDiscreteStaticSystem.java 113
org/mklab/tool/control/system/sink/UserDefinedContinuousSink.java 108
org/mklab/tool/control/system/source/UserDefinedDiscreteSource.java 96
  public void setOutputFunction(final Method method) throws SecurityException {
    this.outputFunction = method;
    this.outputFunction.setAccessible(true);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setInitializeFunction(java.lang.reflect.Method)
   */
  public void setInitializeFunction(final Method method) throws SecurityException {
    this.initializeFunction = method;
    this.initializeFunction.setAccessible(true);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setUpdateFunction(java.lang.reflect.Method)
   */
  public void setUpdateFunction(final Method method) throws SecurityException {
    this.updateFunction = method;
    this.updateFunction.setAccessible(true);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
   */
  public Object getParameterValue(String name) throws NoSuchParameterException {
    return ParameterUtil.getValue(this.systemKlass, name);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#getParameterNames()
   */
  public Set<String> getParameterNames() throws NoSuchParameterException {
    return ParameterUtil.getParameterNames(this.systemKlass);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setParameterValue(java.lang.String, java.lang.Object)
   */
  public void setParameterValue(String name, Object value) throws NoSuchParameterException {
    ParameterUtil.setValue(this.systemKlass, name, value);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#containParameter(java.lang.String)
   */
  public boolean containParameter(String name) {
    return ParameterUtil.contains(this.systemKlass, name);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#update()
   */
  public void update() throws ParameterException {
    try {
      this.updateFunction.invoke(this.obj);
    } catch (IllegalArgumentException e) {
      throw new ParameterException(e);
    } catch (IllegalAccessException e) {
      throw new ParameterException(e);
    } catch (InvocationTargetException e) {
      throw new ParameterException(e.getTargetException());
    } catch (Exception e) {
      throw new ParameterException(e);
    }
  }

  /**
   * @see org.mklab.tool.control.system.discrete.BaseDiscreteStaticSystem#initialize()
   */
  @Override
  public void initialize() {
    super.initialize();
    try {
      if (this.initializeFunction != null) {
        this.initializeFunction.invoke(this.obj);
      }
    } catch (IllegalArgumentException e) {
      throw new RuntimeException(e);
    } catch (IllegalAccessException e) {
      throw new RuntimeException(e);
    } catch (InvocationTargetException e) {
      throw new RuntimeException(e.getTargetException());
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
}
File Line
org/mklab/tool/control/system/discrete/UserDefinedDiscreteDynamicSystem.java 143
org/mklab/tool/control/system/discrete/UserDefinedDiscreteStaticSystem.java 113
  public void setOutputFunction(Method method) throws SecurityException {
    this.outputFunction = method;
    this.outputFunction.setAccessible(true);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setInitializeFunction(java.lang.reflect.Method)
   */
  public void setInitializeFunction(final Method method) throws SecurityException {
    this.initializeFunction = method;
    this.initializeFunction.setAccessible(true);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setUpdateFunction(java.lang.reflect.Method)
   */
  public void setUpdateFunction(final Method method) throws SecurityException {
    this.updateFunction = method;
    this.updateFunction.setAccessible(true);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
   */
  public Object getParameterValue(String name) throws NoSuchParameterException {
    return ParameterUtil.getValue(this.systemKlass, name);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#getParameterNames()
   */
  public Set<String> getParameterNames() throws NoSuchParameterException {
    return ParameterUtil.getParameterNames(this.systemKlass);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setParameterValue(java.lang.String, java.lang.Object)
   */
  public void setParameterValue(String name, Object value) throws NoSuchParameterException {
    ParameterUtil.setValue(this.systemKlass, name, value);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#containParameter(java.lang.String)
   */
  public boolean containParameter(String name) {
    return ParameterUtil.contains(this.systemKlass, name);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#update()
   */
  public void update() throws ParameterException {
    try {
      this.updateFunction.invoke(this.obj);
    } catch (IllegalArgumentException e) {
      throw new ParameterException(e);
    } catch (IllegalAccessException e) {
      throw new ParameterException(e);
    } catch (InvocationTargetException e) {
      throw new ParameterException(e.getTargetException());
    } catch (Exception e) {
      throw new ParameterException(e);
    }
  }

  /**
   * @see org.mklab.tool.control.system.discrete.BaseDiscreteStaticSystem#initialize()
   */
  @Override
  public void initialize() {
    super.initialize();
    try {
      if (this.initializeFunction != null) {
        this.initializeFunction.invoke(this.obj);
      }
    } catch (IllegalArgumentException e) {
      throw new RuntimeException(e);
    } catch (IllegalAccessException e) {
      throw new RuntimeException(e);
    } catch (InvocationTargetException e) {
      throw new RuntimeException(e.getTargetException());
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
File Line
org/mklab/tool/control/system/continuous/IntegratorSystem.java 33
org/mklab/tool/control/system/discrete/UnitDelaySystem.java 33
  public IntegratorSystem() {
    super();
    setAutoSize(false);
  }

  /**
   * @see org.mklab.tool.control.system.SystemOperator#setInputSize(int)
   */
  @Override
  public void setInputSize(final int size) {
    if (size < 0) {
      return;
    }

    super.setInputSize(size);
    super.setOutputSize(size);

    if (getStateSize() != size) {
      setStateSize(size);
      super.setInitialState(new DoubleMatrix(size, 1));
      setLinearSystem(LinearSystemFactory.createLinearSystem(new DoubleMatrix(size, size), DoubleMatrix.unit(size, size), DoubleMatrix.unit(size, size), new DoubleMatrix(size, size)));
    }
  }

  /**
   * @see org.mklab.tool.control.system.SystemOperator#setOutputSize(int)
   */
  @Override
  public void setOutputSize(final int size) {
    if (size < 0) {
      return;
    }

    super.setInputSize(size);
    super.setOutputSize(size);

    if (getStateSize() != size) {
      setStateSize(size);
      super.setInitialState(new DoubleMatrix(size, 1));
      setLinearSystem(LinearSystemFactory.createLinearSystem(new DoubleMatrix(size, size), DoubleMatrix.unit(size, size), DoubleMatrix.unit(size, size), new DoubleMatrix(size, size)));
    }
  }

  /**
   * @see org.mklab.tool.control.system.continuous.BaseContinuousExplicitDynamicSystem#setInitialState(org.mklab.nfc.matrix.Matrix)
   */
  @Override
  public void setInitialState(Matrix initialState) {
    super.setInitialState(initialState);

    final int size = initialState.length();

    if (getStateSize() != size) {
      setStateSize(size);
      setLinearSystem(LinearSystemFactory.createLinearSystem(new DoubleMatrix(size, size), DoubleMatrix.unit(size, size), DoubleMatrix.unit(size, size), new DoubleMatrix(size, size)));
    }

    setInputSize(initialState.length());
    setOutputSize(initialState.length());
  }

}
File Line
org/mklab/tool/control/system/graph/NodeEquation.java 48
org/mklab/tool/control/system/graph/NodeIdentityFunctionEquation.java 48
  public NodeEquation(final BlockSystem blockSystem, final SystemOperator[][] matrix, final Matrix[] nodeTmpValue, final List<Integer> minimumNode) {
    this.blockSystem = blockSystem;
    this.nodeSize = nodeTmpValue.length;
    this.matrix = matrix;
    this.nodeTmpValue = nodeTmpValue;
    this.minimumNode = minimumNode;
  }

  /**
   * @see org.mklab.nfc.nleq.NonLinearFunction#eval(org.mklab.nfc.matrix.NumericalMatrix)
   */
  public DoubleMatrix eval(final NumericalMatrix<DoubleNumber> x) throws SolverStopException {
    Matrix[] xx = new Matrix[this.nodeSize];

    // 次数最小ノードの値を1個のベクトルから分離します。
    int offset = 0;
    for (int i : this.minimumNode) {
      int n = this.nodeTmpValue[i - 1].length();
      xx[i - 1] = x.getSubVector(offset + 1, offset + n);
      offset = offset + n;
    }

    Matrix[] nodeValue = new Matrix[this.nodeSize];

    SystemOperator[][] matrixLocal = new SystemOperator[this.nodeSize][this.nodeSize];
    Matrix[] nodeTmpValueLocal = new Matrix[this.nodeSize];
    for (int row = 0; row < this.nodeSize; row++) {
      for (int column = 0; column < this.nodeSize; column++) {
        matrixLocal[row][column] = this.matrix[row][column];
      }

      nodeTmpValueLocal[row] = this.nodeTmpValue[row];
    }

    // 与えられた次数最小ノードの値を用いて、自身を含む各ノードの値を計算します。
    calcNonMinimumNodeValues(nodeValue, xx, matrixLocal, nodeTmpValueLocal);

    // 次数最小ノードの値を1個のベクトルに結合します。
    DoubleMatrix newX = new DoubleMatrix(0, 1);
    for (int i : this.minimumNode) {
      newX = (DoubleMatrix)newX.appendDown(xx[i - 1].subtract(nodeValue[i - 1]));
File Line
org/mklab/tool/signal/Xcorr.java 45
org/mklab/tool/signal/Xcorr.java 99
    int xm = X.getRowSize();
    int xn = X.getColumnSize();
    int m = 2 * xm - 1;
    Matrix c = x.createZero(m, xn * xn);

    for (int i = 1; i <= xn; i++) {
      Matrix tmp = X.getSubMatrix(xm, 1, i, i).conjugate();
      ((NumericalMatrix<?>)tmp).setElement(m, 0);
      for (int j = 1; j <= i; j++) {
        List<Matrix> temp = Filter.filter(X.getSubMatrix(1, X.getRowSize(), j, j), x.createUnit(1), tmp);
        Matrix cc = temp.get(0);
        int k1 = (i - 1) * xn + j;
        int k2 = (j - 1) * xn + i;
        c.setSubMatrix(1, c.getRowSize(), k2, k2, cc.transpose());
        if (i != j) {
          c.setSubMatrix(1, c.getRowSize(), k1, k1, c.getSubMatrix(m, 1, k2, k2).conjugate());
        }
      }
    }

    c = c.getSubMatrix(1, c.getRowSize(), 1, 1);

    if (x_.getRowSize() == 1) {
      c = c.transpose();
    }

    return c;

  }
File Line
org/mklab/tool/control/system/discrete/UserDefinedDiscreteDynamicSystem.java 161
org/mklab/tool/control/system/discrete/UserDefinedDiscreteStaticSystem.java 131
org/mklab/tool/control/system/sink/UserDefinedContinuousSink.java 126
org/mklab/tool/control/system/source/UserDefinedContinuousSource.java 144
org/mklab/tool/control/system/source/UserDefinedDiscreteSource.java 114
    this.updateFunction.setAccessible(true);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
   */
  public Object getParameterValue(String name) throws NoSuchParameterException {
    return ParameterUtil.getValue(this.systemKlass, name);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#getParameterNames()
   */
  public Set<String> getParameterNames() throws NoSuchParameterException {
    return ParameterUtil.getParameterNames(this.systemKlass);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setParameterValue(java.lang.String, java.lang.Object)
   */
  public void setParameterValue(String name, Object value) throws NoSuchParameterException {
    ParameterUtil.setValue(this.systemKlass, name, value);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#containParameter(java.lang.String)
   */
  public boolean containParameter(String name) {
    return ParameterUtil.contains(this.systemKlass, name);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#update()
   */
  public void update() throws ParameterException {
    try {
      this.updateFunction.invoke(this.obj);
    } catch (IllegalArgumentException e) {
      throw new ParameterException(e);
    } catch (IllegalAccessException e) {
      throw new ParameterException(e);
    } catch (InvocationTargetException e) {
      throw new ParameterException(e.getTargetException());
    } catch (Exception e) {
      throw new ParameterException(e);
    }
  }

  /**
   * @see org.mklab.tool.control.system.discrete.BaseDiscreteStaticSystem#initialize()
   */
  @Override
  public void initialize() {
    super.initialize();
    try {
      if (this.initializeFunction != null) {
        this.initializeFunction.invoke(this.obj);
      }
    } catch (IllegalArgumentException e) {
      throw new RuntimeException(e);
    } catch (IllegalAccessException e) {
      throw new RuntimeException(e);
    } catch (InvocationTargetException e) {
      throw new RuntimeException(e.getTargetException());
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
File Line
org/mklab/tool/control/system/sink/UserDefinedContinuousSink.java 76
org/mklab/tool/control/system/sink/UserDefinedDiscreteSink.java 76
      this.outputFunction.invoke(this.obj, new Double(t), u);
    } catch (IllegalArgumentException e) {
      throw new SolverStopException(e);
    } catch (IllegalAccessException e) {
      throw new SolverStopException(e);
    } catch (InvocationTargetException e) {
      throw new SolverStopException(e.getTargetException());
    }

    return new DoubleMatrix(getInputSize(), 1);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setSystemClass(java.lang.Class)
   */
  public void setSystemClass(final Class<?> klass) {
    this.systemKlass = klass;
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#getSystemClass()
   */
  public Class<?> getSystemClass() {
    return this.systemKlass;
  }

  /**
   * システムの出力方程式を定義したメソッドを設定します。
   * 
   * @param method システムの出力方程式を定義したメソッド
   * @throws SecurityException メソッドにアクセスする権利が無い場合
   */
  public void setOutputFunction(Method method) throws SecurityException {
    this.outputFunction = method;
    this.outputFunction.setAccessible(true);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setInitializeFunction(java.lang.reflect.Method)
   */
  public void setInitializeFunction(final Method method) throws SecurityException {
    this.initializeFunction = method;
    this.initializeFunction.setAccessible(true);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setUpdateFunction(java.lang.reflect.Method)
   */
  public void setUpdateFunction(final Method method) throws SecurityException {
    this.updateFunction = method;
    this.updateFunction.setAccessible(true);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
   */
  public Object getParameterValue(String name) throws NoSuchParameterException {
    return ParameterUtil.getValue(this.systemKlass, name);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#getParameterNames()
   */
  public Set<String> getParameterNames() throws NoSuchParameterException {
    return ParameterUtil.getParameterNames(this.systemKlass);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setParameterValue(java.lang.String, java.lang.Object)
   */
  public void setParameterValue(String name, Object value) throws NoSuchParameterException {
    ParameterUtil.setValue(this.systemKlass, name, value);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#containParameter(java.lang.String)
   */
  public boolean containParameter(String name) {
    return ParameterUtil.contains(this.systemKlass, name);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#update()
   */
  public void update() throws ParameterException {
    try {
File Line
org/mklab/tool/control/system/continuous/UserDefinedContinuousStaticSystem.java 83
org/mklab/tool/control/system/source/UserDefinedDiscreteSource.java 66
      return (Matrix)this.outputFunction.invoke(this.object, new Double(t));
    } catch (IllegalArgumentException e) {
      throw new SolverStopException(e);
    } catch (IllegalAccessException e) {
      throw new SolverStopException(e);
    } catch (InvocationTargetException e) {
      throw new SolverStopException(e.getTargetException());
    }
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setSystemClass(java.lang.Class)
   */
  public void setSystemClass(final Class<?> klass) {
    this.systemKlass = klass;
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#getSystemClass()
   */
  public Class<?> getSystemClass() {
    return this.systemKlass;
  }

  /**
   * システムの出力方程式を定義したメソッドを設定します。
   * 
   * @param method システムの出力方程式を定義したメソッド
   * @throws SecurityException メソッドにアクセスする権利が無い場合
   */
  public void setOutputFunction(Method method) throws SecurityException {
    this.outputFunction = method;
    this.outputFunction.setAccessible(true);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setInitializeFunction(java.lang.reflect.Method)
   */
  public void setInitializeFunction(final Method method) throws SecurityException {
    this.initializeFunction = method;
    this.initializeFunction.setAccessible(true);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setUpdateFunction(java.lang.reflect.Method)
   */
  public void setUpdateFunction(final Method method) throws SecurityException {
    this.updateFunction = method;
    this.updateFunction.setAccessible(true);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
   */
  public Object getParameterValue(String name) throws NoSuchParameterException {
    return ParameterUtil.getValue(this.systemKlass, name);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#getParameterNames()
   */
  public Set<String> getParameterNames() throws NoSuchParameterException {
    return ParameterUtil.getParameterNames(this.systemKlass);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setParameterValue(java.lang.String, java.lang.Object)
   */
  public void setParameterValue(String name, Object value) throws NoSuchParameterException {
    ParameterUtil.setValue(this.systemKlass, name, value);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#containParameter(java.lang.String)
   */
  public boolean containParameter(String name) {
    return ParameterUtil.contains(this.systemKlass, name);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#update()
   */
  public void update() throws ParameterException {
    try {
      this.updateFunction.invoke(null);
File Line
org/mklab/tool/control/Ltifr.java 39
org/mklab/tool/control/Ltifr.java 131
  public static NumericalMatrix<?> ltifr(final Matrix A, final Matrix B, final Matrix s_) {
    String message;
    if ((message = Abcdchk.abcdchk(A, B)).length() > 0) {
      throw new IllegalArgumentException(message);
    }

    NumericalMatrix<?> ss;
    if (s_.getRowSize() > s_.getColumnSize()) {
      ss = (NumericalMatrix<?>)s_.transpose();
    } else {
      ss = (NumericalMatrix<?>)s_.clone();
    }

    final int stateSize = A.getRowSize();
    final int inputSize = B.getColumnSize();

    NumericalScalar<?> unit = ((NumericalMatrix<?>)A).getElement(1, 1);
    final NumericalMatrix<?> cA = (NumericalMatrix<?>)A.toComplex();

    final NumericalMatrix<?> G = (NumericalMatrix<?>)cA.createZero(stateSize * ss.getRowSize(), inputSize * ss.getColumnSize());
    final int size = Math.max(ss.getRowSize(), ss.getColumnSize()); // length(s)
    final NumericalScalar<?> epsilon = unit.getMachineEpsilon();

    for (int i = 1; i <= size; i++) {
      final NumericalScalar<?> s = ss.getElement(i);
      NumericalMatrix<?> sI_A = (NumericalMatrix<?>)(A.createUnit().multiply(s).subtract(A));
File Line
org/mklab/tool/control/system/source/RampSource.java 116
org/mklab/tool/control/system/source/StepSource.java 116
  }

  /**
   * 遅れ時間を設定します。
   * 
   * @param delayTime 遅れ時間
   */
  public void setDelayTime(final double delayTime) {
    this.delayTime = delayTime;
  }

  /**
   * 遅れ時間を返します。
   * 
   * @return 遅れ時間
   */
  public double getDelayTime() {
    return this.delayTime;
  }

  /**
   * @see org.mklab.nfc.ode.PiecewiseContinuousAlgebraicSystem#getPiece(double, org.mklab.nfc.matrix.Matrix)
   */
  @SuppressWarnings("boxing")
  public List<Integer> getPiece(final double t,  final Matrix u) {
    if (t >= this.delayTime) {
      return new ArrayList<>(Arrays.asList(new Integer[] {1}));
    }
    return new ArrayList<>(Arrays.asList(new Integer[] {0}));
  }

  /**
   * @see org.mklab.nfc.ode.PiecewiseContinuousAlgebraicSystem#getDiscontinuousPoint(double, org.mklab.nfc.matrix.Matrix, double, org.mklab.nfc.matrix.Matrix)
   */
  public double getDiscontinuousPoint(final double t1, final Matrix u1, final double t2, final Matrix u2) {
    final List<Integer> piece1 = getPiece(t1, u1);
    final List<Integer> piece2 = getPiece(t2, u2);

    if (piece1.equals(piece2)) {
      return Double.NaN;
    }

    return this.delayTime;
  }

  /**
   * @see org.mklab.tool.control.system.parameter.StringExternalizable#getString(java.lang.String)
   */
  public String getString(String key) {
    return Messages.getString(key);
  }

  /**
   * @see org.mklab.tool.control.system.SystemOperator#equals(java.lang.Object)
   */
  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (!super.equals(o)) {
      return false;
    }
    if (o == null) {
      return false;
    }
    if (o.getClass() != getClass()) {
      return false;
    }
File Line
org/mklab/tool/matrix/Funm.java 70
org/mklab/tool/matrix/Funm.java 117
    for (int k = 1; k <= n - 1; k++) {
      for (int i = 1; i <= n - k; i++) {
        int j = i + k;
        Scalar<?> s = T.getElement(i, j).multiply(F.getElement(j, j).subtract(F.getElement(i, i)));
        if (k > 1) {
          Matrix tp = T.getSubMatrix(i, i, i + 1, j - 1).multiply(F.getSubMatrix(i + 1, j - 1, j, j)).subtract(F.getSubMatrix(i, i, i + 1, j - 1).multiply(T.getSubMatrix(i + 1, j - 1, j, j)));
          s = s.add(((NumericalMatrix<?>)tp).getElement(1));
        }
        Scalar<?> d = T.getElement(j, j).subtract(T.getElement(i, i));

        if (((NumericalScalar<?>)d).abs().isLessThanOrEquals(tolerance)) {
          System.err.println(Messages.getString("Funm.0")); //$NON-NLS-1$
File Line
org/mklab/tool/control/Dhinf.java 122
org/mklab/tool/control/Hinf.java 50
      throw new IllegalArgumentException(Messages.getString("Dhinf.1")); //$NON-NLS-1$
    }

    Matrix A = G.getSubMatrix(1, n, 1, n);
    Matrix B1 = G.getSubMatrix(1, n, n + 1, n + mw);
    Matrix B2 = G.getSubMatrix(1, n, n + mw + 1, CG);

    Matrix C1 = G.getSubMatrix(n + 1, n + pz, 1, n);
    Matrix D11 = G.getSubMatrix(n + 1, n + pz, n + 1, n + mw);
    Matrix D12 = G.getSubMatrix(n + 1, n + pz, n + mw + 1, CG);

    Matrix C2 = G.getSubMatrix(n + pz + 1, RG, 1, n);
    Matrix D21 = G.getSubMatrix(n + pz + 1, RG, n + 1, n + mw);
    Matrix D22 = G.getSubMatrix(n + pz + 1, RG, n + mw + 1, CG);

    B1 = B1.divide(gamma);
    D11 = D11.divide(gamma);
    D21 = D21.divide(gamma);

    NumericalScalar<?> tmp = ((NumericalMatrix<?>)D11).maxSingularValue();
    if (tmp.isGreaterThanOrEquals(1)) {
File Line
org/mklab/tool/control/ImproperLinearSystem.java 486
org/mklab/tool/control/ProperLinearSystem.java 369
            string.append("        "); //$NON-NLS-1$
          }
        }
      }

      string.append("["); //$NON-NLS-1$
      for (int column = 0; column < getSubSystemSize(); column++) {
        final String format = "%" + columnLengthes[column] + "s"; //$NON-NLS-1$ //$NON-NLS-2$
        string.append(String.format(format, this.getSymbolicAMatrix()[row][column]));
        if (column != getSubSystemSize() - 1) {
          string.append("  "); //$NON-NLS-1$
        }
      }
      string.append("|"); //$NON-NLS-1$

      for (int column = 0; column < getInputPortSize(); column++) {
        final String format = "%" + columnLengthes[column + getSubSystemSize()] + "s"; //$NON-NLS-1$ //$NON-NLS-2$
        string.append(String.format(format, this.getSymbolicBMatrix()[row][column]));
        if (column != getInputPortSize() - 1) {
          string.append("  "); //$NON-NLS-1$
        }
      }
      string.append("]"); //$NON-NLS-1$

      if (withInputOutput) {
        string.append("[" + symbolicState[row] + "]"); //$NON-NLS-1$ //$NON-NLS-2$
        if (row == getSubSystemSize() / 2) {
          if (isContinuous()) {
            string.append("(t)"); //$NON-NLS-1$
          } else {
            string.append("(k)"); //$NON-NLS-1$
          }
        }
      }

      string.append(lineSeparator);
    }

    return string.toString();
  }
File Line
org/mklab/tool/control/Dinitial.java 246
org/mklab/tool/control/Initial.java 252
    List<Matrix> yx = dinitial(A, B, C, D, x0, T);
    DoubleMatrix Y = (DoubleMatrix)yx.get(0);
    DoubleMatrix X = (DoubleMatrix)yx.get(1);

    int outputSize = C.getRowSize();
    String[] yy = new String[outputSize];
    for (int i = 1; i <= outputSize; i++) {
      if (outputSize == 1) {
        yy[i - 1] = "y";
      } else {
        yy[i - 1] = "y" + i;
      }
    }

    gnuplot.createCanvas(2, 1);
    Canvas canvas1 = gnuplot.getCanvas(0, 0);
    canvas1.setGridVisible(true);
    canvas1.setXLabel("t [sec]");
    canvas1.setYLabel("y");
    canvas1.plot(T, Y, yy);

    int stateSize = A.getRowSize();
    String[] xx = new String[stateSize];
    for (int i = 1; i <= stateSize; i++) {
      xx[i - 1] = "x" + i;
    }

    Canvas canvas2 = gnuplot.getCanvas(1, 0);
    canvas2.setGridVisible(true);
    canvas2.setXLabel("t [sec]");
    canvas2.setYLabel("x");
    canvas2.plot(T, X, xx);
    return gnuplot;
  }

}
File Line
org/mklab/tool/control/Dinitial.java 143
org/mklab/tool/control/Initial.java 142
    List<Matrix> yx = dinitial(g, x0, T);
    DoubleMatrix Y = (DoubleMatrix)yx.get(0);
    Canvas canvas = gnuplot.createCanvas();
    canvas.setGridVisible(true);
    canvas.setXLabel("t [sec]");
    canvas.setYLabel("y");
    canvas.plot(T, Y, new String[] {"y"});
    return gnuplot;
  }

  /**
   * @param numerator 分子多項式の係数
   * @param denominator 分母多項式の係数
   * @param x0 初期状態
   * @param T 評価する時刻
   * @return Gnuplot
   * @throws IOException gnuplotプロセスを起動できない場合
   */
  public static Gnuplot plot(Matrix numerator, Matrix denominator, Matrix x0, DoubleMatrix T) throws IOException {
    Gnuplot gp = new Gnuplot();
    return plot(gp, numerator, denominator, x0, T);
  }

  /**
   * @param gnuplot gnuplot
   * @param numerator 分子多項式の係数
   * @param denominator 分母多項式の係数
   * @param x0 初期状態
   * @param T 評価する時刻
   * @return Gnuplot
   */
  public static Gnuplot plot(Gnuplot gnuplot, Matrix numerator, Matrix denominator, Matrix x0, DoubleMatrix T) {
    RationalPolynomial g = Tf2tfn.tf2tfn(numerator, denominator);
    return plot(gnuplot, g, x0, T);
  }

  /**
   * @param G 伝達関数行列
   * @param x0 初期状態
   * @param T 評価する時刻
   * @return Gnuplot
   * @throws IOException gnuplotプロセスを起動できない場合
   */
  public static Gnuplot plot(RationalPolynomialMatrix G, Matrix x0, DoubleMatrix T) throws IOException {
    Gnuplot gp = new Gnuplot();
    return plot(gp, G, x0, T);
  }

  /**
   * @param gnuplot gnuplot
   * @param G 伝達関数行列
   * @param x0 初期状態
   * @param T 評価する時刻
   * @return Gnuplot
   */
  @SuppressWarnings("nls")
  public static Gnuplot plot(Gnuplot gnuplot, RationalPolynomialMatrix G, Matrix x0, DoubleMatrix T) {
    List<Matrix> yx = dinitial(G, x0, T);
File Line
org/mklab/tool/control/system/continuous/UserDefinedContinuousStaticSystem.java 91
org/mklab/tool/control/system/sink/UserDefinedContinuousSink.java 86
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setSystemClass(java.lang.Class)
   */
  public void setSystemClass(final Class<?> klass) {
    this.systemKlass = klass;
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#getSystemClass()
   */
  public Class<?> getSystemClass() {
    return this.systemKlass;
  }

  /**
   * システムの出力方程式を定義したメソッドを設定します。
   * 
   * @param method システムの出力方程式を定義したメソッド
   * @throws SecurityException メソッドにアクセスする権利が無い場合
   */
  public void setOutputFunction(Method method) throws SecurityException {
    this.outputFunction = method;
    this.outputFunction.setAccessible(true);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setInitializeFunction(java.lang.reflect.Method)
   */
  public void setInitializeFunction(final Method method) throws SecurityException {
    this.initializeFunction = method;
    this.initializeFunction.setAccessible(true);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setUpdateFunction(java.lang.reflect.Method)
   */
  public void setUpdateFunction(final Method method) throws SecurityException {
    this.updateFunction = method;
    this.updateFunction.setAccessible(true);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
   */
  public Object getParameterValue(String name) throws NoSuchParameterException {
    return ParameterUtil.getValue(this.systemKlass, name);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#getParameterNames()
   */
  public Set<String> getParameterNames() throws NoSuchParameterException {
    return ParameterUtil.getParameterNames(this.systemKlass);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setParameterValue(java.lang.String, java.lang.Object)
   */
  public void setParameterValue(String name, Object value) throws NoSuchParameterException {
    ParameterUtil.setValue(this.systemKlass, name, value);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#containParameter(java.lang.String)
   */
  public boolean containParameter(String name) {
    return ParameterUtil.contains(this.systemKlass, name);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#update()
   */
  public void update() throws ParameterException {
    try {
      this.updateFunction.invoke(null);
File Line
org/mklab/tool/control/Ramp.java 346
org/mklab/tool/control/Step.java 344
    DoubleMatrix X = (DoubleMatrix)tmp.get(1);

    int outputSize = C.getRowSize();
    String[] yy = new String[outputSize];
    for (int i = 1; i <= outputSize; i++) {
      if (outputSize == 1) {
        yy[i - 1] = "y"; //$NON-NLS-1$
      } else {
        yy[i - 1] = "y" + i; //$NON-NLS-1$
      }
    }

    gnuplot.createCanvas(2, 1);
    Canvas canvas1 = gnuplot.getCanvas(0, 0);
    canvas1.setGridVisible(true);
    canvas1.setXLabel("t [sec]"); //$NON-NLS-1$
    canvas1.setYLabel("y"); //$NON-NLS-1$
    canvas1.setTitle("Step response"); //$NON-NLS-1$
    canvas1.plot(T, Y, yy);

    int stateSize = A.getRowSize();
    String[] xx = new String[stateSize];
    for (int i = 1; i <= stateSize; i++) {
      xx[i - 1] = "x" + i; //$NON-NLS-1$
    }

    Canvas canvas2 = gnuplot.getCanvas(1, 0);
    canvas2.setGridVisible(true);
    canvas2.setTitle(""); //$NON-NLS-1$
    canvas2.setXLabel("t [sec]"); //$NON-NLS-1$
    canvas2.setYLabel("x"); //$NON-NLS-1$
    canvas2.plot(T, X, xx);
    return gnuplot;
  }

}
File Line
org/mklab/tool/control/Dinitial.java 200
org/mklab/tool/control/Initial.java 203
    List<Matrix> yx = dinitial(G, x0, T);
    DoubleMatrix Y = (DoubleMatrix)yx.get(0);
    int outputSize = G.getRowSize();
    String[] yy = new String[outputSize];
    for (int i = 1; i <= outputSize; i++) {
      if (outputSize == 1) {
        yy[i - 1] = "y";
      } else {
        yy[i - 1] = "y" + i;
      }
    }
    Canvas canvas = gnuplot.createCanvas();
    canvas.setGridVisible(true);
    canvas.setXLabel("t [sec]");
    canvas.setYLabel("y");
    canvas.plot(T, Y, yy);
    return gnuplot;
  }

  /**
   * @param A A行列
   * @param B B行列
   * @param C C行列
   * @param D D行列
   * @param x0 初期状態
   * @param T 評価する時刻
   * @return Gnuplot
   * @throws IOException gnuplotプロセスを起動できない場合
   */
  public static Gnuplot plot(Matrix A, Matrix B, Matrix C, Matrix D, Matrix x0, DoubleMatrix T) throws IOException {
    Gnuplot gp = new Gnuplot();
    return plot(gp, A, B, C, D, x0, T);
  }

  /**
   * @param gnuplot gnuplot
   * @param A A行列
   * @param B B行列
   * @param C C行列
   * @param D D行列
   * @param x0 初期状態
   * @param T 評価する時刻
   * @return Gnuplot
   */
  @SuppressWarnings("nls")
  public static Gnuplot plot(Gnuplot gnuplot, Matrix A, Matrix B, Matrix C, Matrix D, Matrix x0, DoubleMatrix T) {
    List<Matrix> yx = dinitial(A, B, C, D, x0, T);
File Line
org/mklab/tool/control/system/continuous/UserDefinedContinuousStaticSystem.java 91
org/mklab/tool/control/system/sink/UserDefinedDiscreteSink.java 86
org/mklab/tool/control/system/source/UserDefinedDiscreteSource.java 74
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setSystemClass(java.lang.Class)
   */
  public void setSystemClass(final Class<?> klass) {
    this.systemKlass = klass;
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#getSystemClass()
   */
  public Class<?> getSystemClass() {
    return this.systemKlass;
  }

  /**
   * システムの出力方程式を定義したメソッドを設定します。
   * 
   * @param method システムの出力方程式を定義したメソッド
   * @throws SecurityException メソッドにアクセスする権利が無い場合
   */
  public void setOutputFunction(Method method) throws SecurityException {
    this.outputFunction = method;
    this.outputFunction.setAccessible(true);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setInitializeFunction(java.lang.reflect.Method)
   */
  public void setInitializeFunction(final Method method) throws SecurityException {
    this.initializeFunction = method;
    this.initializeFunction.setAccessible(true);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setUpdateFunction(java.lang.reflect.Method)
   */
  public void setUpdateFunction(final Method method) throws SecurityException {
    this.updateFunction = method;
    this.updateFunction.setAccessible(true);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
   */
  public Object getParameterValue(String name) throws NoSuchParameterException {
    return ParameterUtil.getValue(this.systemKlass, name);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#getParameterNames()
   */
  public Set<String> getParameterNames() throws NoSuchParameterException {
    return ParameterUtil.getParameterNames(this.systemKlass);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setParameterValue(java.lang.String, java.lang.Object)
   */
  public void setParameterValue(String name, Object value) throws NoSuchParameterException {
    ParameterUtil.setValue(this.systemKlass, name, value);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#containParameter(java.lang.String)
   */
  public boolean containParameter(String name) {
    return ParameterUtil.contains(this.systemKlass, name);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#update()
   */
  public void update() throws ParameterException {
    try {
File Line
org/mklab/tool/control/Dimpulse.java 170
org/mklab/tool/control/Dstep.java 169
    List<Matrix> yx = dimpulse(g, seriesSize);
    DoubleMatrix Y = (DoubleMatrix)yx.get(0);
    Canvas canvas = gnuplot.createCanvas();
    canvas.setGridVisible(true);
    canvas.setXLabel("k");
    canvas.setYLabel("y");
    canvas.plot(DoubleMatrix.series(1, seriesSize, 1), Y, new String[] {"y"});
    return gnuplot;
  }

  /**
   * @param numerator 分子多項式の係数
   * @param denominator 分母多項式の係数
   * @param seriesSize 応答の個数
   * @return Gnuplot
   * @throws IOException gnuplotプロセスを起動できない場合
   */
  public static Gnuplot plot(Matrix numerator, Matrix denominator, int seriesSize) throws IOException {
    Gnuplot gp = new Gnuplot();
    return plot(gp, numerator, denominator, seriesSize);
  }

  /**
   * 単位インパルス応答をプロットする
   * 
   * @param gnuplot gnuplot
   * @param numerator 分子多項式の係数
   * @param denominator 分母多項式の係数
   * @param seriesSize 応答の個数
   * @return Gnuplot
   */
  public static Gnuplot plot(Gnuplot gnuplot, Matrix numerator, Matrix denominator, int seriesSize) {
    RationalPolynomial g = Tf2tfn.tf2tfn(numerator, denominator);
    return plot(gnuplot, g, seriesSize);
  }

  /**
   * @param G 伝達関数行列
   * @param inputNumber 入力番号
   * @param seriesSize 応答の個数
   * @return Gnuplot
   * @throws IOException gnuplotプロセスを起動できない場合
   */
  public static Gnuplot plot(RationalPolynomialMatrix G, int inputNumber, int seriesSize) throws IOException {
    Gnuplot gp = new Gnuplot();
    return plot(gp, G, inputNumber, seriesSize);
  }

  /**
   * 単位インパルス応答をプロットする
   * 
   * @param gnuplot gnuplot
   * @param G 伝達関数行列
   * @param inputNumber 入力番号
   * @param seriesSize 応答の個数
   * @return Gnuplot
   */
  @SuppressWarnings("nls")
  public static Gnuplot plot(Gnuplot gnuplot, RationalPolynomialMatrix G, int inputNumber, int seriesSize) {
File Line
org/mklab/tool/control/ImproperLinearSystem.java 452
org/mklab/tool/control/ProperLinearSystem.java 335
      if (withInputOutput) {
        if (isContinuous()) {
          if (getSubSystemSize() == 1) {
            string.append("d/dt"); //$NON-NLS-1$
          } else if (getSubSystemSize() == 2) {
            if (row == 0) {
              string.append("d/"); //$NON-NLS-1$
            } else {
              string.append("dt"); //$NON-NLS-1$
            }
          } else {
            if (row == getSubSystemSize() / 2 - 1) {
              string.append("d "); //$NON-NLS-1$
            } else if (row == getSubSystemSize() / 2) {
              string.append("--"); //$NON-NLS-1$
            } else if (row == getSubSystemSize() / 2 + 1) {
              string.append("dt"); //$NON-NLS-1$
            } else {
              string.append("  "); //$NON-NLS-1$
            }
          }
        }

        string.append("[" + symbolicState[row] + "]"); //$NON-NLS-1$ //$NON-NLS-2$
        if (row == getSubSystemSize() / 2) {
          if (isContinuous()) {
            string.append("(t)="); //$NON-NLS-1$
          } else {
            string.append("(k+1)="); //$NON-NLS-1$
          }
        } else {
          if (isContinuous()) {
            string.append("    "); //$NON-NLS-1$
          } else {
            string.append("        "); //$NON-NLS-1$
File Line
org/mklab/tool/control/system/BlockSystem.java 312
org/mklab/tool/control/system/BlockSystem.java 349
        if (nodeTmpValue[row].isZero()) {
          for (int k = 0; k < rowSize; k++) {
            final SystemOperator systemInRow = matrix[k][row];
            final SystemOperator systemInColumn = matrix[k][column];

            if (systemInRow == ZeroSystem.getInstance()) {
              continue;
            }

            if (AdjacencyMatrixUtil.isAllZeroInRow(matrix, row, column) == false) {
              continue;
            }

            if (systemInRow instanceof ConstantSystem && systemInColumn instanceof ConstantSystem) {
              matrix[k][column] = ((ConstantSystem)systemInColumn).add(((ConstantSystem)systemInRow).multiply(gainSystem));
            } else {
              final SystemOperator contractedSystem;
              if (systemInRow instanceof ConstantSystem) {
                contractedSystem = ((ConstantSystem)systemInRow).multiply(gainSystem);
              } else {
                contractedSystem = AdjacencyMatrixUtil.multiplyGain((LinearSystemOperator)systemInRow, gain1);
              }

              if (contractedSystem.hasDirectFeedthrough()) {
                matrix[k][column] = contractedSystem;
              } else {
                nodeTmpValue[k] = nodeTmpValue[k].add(calcOutputOfNonDirectFeedthroughSystem(contractedSystem));
                matrix[k][column] = ZeroSystem.getInstance();
              }
            }
File Line
org/mklab/tool/control/FrequencyResponse.java 104
org/mklab/tool/control/FrequencyResponse.java 144
  private NumericalMatrix<?> getResponseForNonProperSystem(final NumericalMatrix<?> s, final int inputNumber) {
    final Matrix a = this.system.getA();
    final Matrix b = this.system.getB();
    final Matrix c = this.system.getC();
    final Matrix d = this.system.getD();
    final Matrix e = this.system.getE();

    // Balance A
    final BalancedDecomposition<? extends NumericalMatrix<?>> ta = ((NumericalMatrix<?>)a).balancedDecompose();
    final Matrix t = ta.getD();
    final Matrix a1 = ta.getB();
    final Matrix b1 = t.leftDivide(b);
    final Matrix c1 = c.multiply(t);
    final Matrix e1 = t.leftDivide(e).multiply(t);

    final HessenbergDecomposition<? extends NumericalMatrix<?>> qa = ((NumericalMatrix<?>)a1).hessenbergDecompose();
    final Matrix q = qa.getQ();
    final Matrix a2 = qa.getH();
    final Matrix b2 = q.conjugateTranspose().multiply(b1.getColumnVector(inputNumber));
File Line
org/mklab/tool/control/Ltifr.java 86
org/mklab/tool/control/Ltifr.java 179
  public static List<NumericalMatrix<?>> getResponse(final Matrix A, final Matrix B, final NumericalMatrix<?> s_) {
    String message;
    if ((message = Abcdchk.abcdchk(A, B)).length() > 0) {
      throw new IllegalArgumentException(message);
    }

    NumericalMatrix<?> ss;
    if (s_.getRowSize() > s_.getColumnSize()) {
      ss = (NumericalMatrix<?>)s_.transpose();
    } else {
      ss = (NumericalMatrix<?>)s_.clone();
    }

    NumericalScalar<?> unit = ((NumericalMatrix<?>)A).getElement(1, 1);

    final int size = Math.max(ss.getRowSize(), ss.getColumnSize()); // length(s)
    final NumericalScalar<?> epsilon = unit.getMachineEpsilon();

    final List<NumericalMatrix<?>> G = new ArrayList<>();

    for (int i = 1; i <= size; i++) {
      final NumericalScalar<?> s = ss.getElement(i);
      NumericalMatrix<?> sI_A = (NumericalMatrix<?>)(A.createUnit().multiply(s).subtract(A));
File Line
org/mklab/tool/control/WeierstrassForm.java 183
org/mklab/tool/control/WeierstrassForm.java 197
        if (!blockFlag) {
          NumericalScalar<?> q1e1 = tE.getElement(j, j + 1);
          NumericalScalar<?> q1e2 = tE.getElement(j + 1, j + 1);
          NumericalMatrix<?> Q1 = givens(q1e1, q1e2, tolerance);
          this.TL.setSubMatrix(j, j + 1, 1, this.TL.getColumnSize(), Q1.multiply(this.TL.getSubMatrix(j, j + 1, 1, this.TL.getColumnSize())));
          tE.setSubMatrix(j, j + 1, j, tE.getColumnSize(), Q1.multiply(tE.getSubMatrix(j, j + 1, j, tE.getColumnSize())));
          tA.setSubMatrix(j, j + 1, j, tA.getColumnSize(), Q1.multiply(tA.getSubMatrix(j, j + 1, j, tA.getColumnSize())));

          NumericalScalar<?> z1a1 = tA.getElement(j + 1, j + 1);
File Line
org/mklab/tool/control/Dhinf.java 65
org/mklab/tool/control/Dhinf.java 122
org/mklab/tool/control/Hinf.java 50
      throw new IllegalArgumentException(Messages.getString("Dhinf.0")); //$NON-NLS-1$
    }

    Matrix A = G.getSubMatrix(1, n, 1, n);
    Matrix B1 = G.getSubMatrix(1, n, n + 1, n + mw);
    Matrix B2 = G.getSubMatrix(1, n, n + mw + 1, CG);

    Matrix C1 = G.getSubMatrix(n + 1, n + pz, 1, n);
    Matrix D11 = G.getSubMatrix(n + 1, n + pz, n + 1, n + mw);
    Matrix D12 = G.getSubMatrix(n + 1, n + pz, n + mw + 1, CG);

    Matrix C2 = G.getSubMatrix(n + pz + 1, RG, 1, n);
    Matrix D21 = G.getSubMatrix(n + pz + 1, RG, n + 1, n + mw);
    Matrix D22 = G.getSubMatrix(n + pz + 1, RG, n + mw + 1, CG);
File Line
org/mklab/tool/control/Dimpulse.java 231
org/mklab/tool/control/Dstep.java 230
    int outputSize = G.getRowSize();
    String[] yy = new String[outputSize];
    for (int i = 1; i <= outputSize; i++) {
      if (outputSize == 1) {
        yy[i - 1] = "y";
      } else {
        yy[i - 1] = "y" + i;
      }
    }
    Canvas canvas = gnuplot.createCanvas();
    canvas.setGridVisible(true);
    canvas.setXLabel("k");
    canvas.setYLabel("y");
    canvas.plot(DoubleMatrix.series(1, seriesSize, 1), Y, yy);
    return gnuplot;
  }

  /**
   * @param A A行列
   * @param B B行列
   * @param C C行列
   * @param D D行列
   * @param inputNumber 入力番号
   * @param seriesSize 応答の個数
   * @return Gnuplot
   * @throws IOException gnuplotプロセスを起動できない場合
   */
  public static Gnuplot plot(Matrix A, Matrix B, Matrix C, Matrix D, int inputNumber, int seriesSize) throws IOException {
    Gnuplot gp = new Gnuplot();
    return plot(gp, A, B, C, D, inputNumber, seriesSize);
  }

  /**
   * 単位インパルス応答をプロットする
   * 
   * @param gnuplot gnuplot
   * @param A A行列
   * @param B B行列
   * @param C C行列
   * @param D D行列
   * @param inputNumber 入力番号
   * @param seriesSize 応答の個数
   * @return Gnuplot
   */
  @SuppressWarnings("nls")
  public static Gnuplot plot(Gnuplot gnuplot, Matrix A, Matrix B, Matrix C, Matrix D, int inputNumber, int seriesSize) {
File Line
org/mklab/tool/control/system/continuous/UserDefinedContinuousDynamicSystem.java 123
org/mklab/tool/control/system/discrete/UserDefinedDiscreteStaticSystem.java 105
  }

  /**
   * システムの出力方程式を定義したメソッドを設定します。
   * 
   * @param method システムの出力方程式を定義したメソッド
   * @throws SecurityException メソッドにアクセスする権利が無い場合
   */
  public void setOutputFunction(final Method method) throws SecurityException {
    this.outputFunction = method;
    this.outputFunction.setAccessible(true);
  }

  /**
   * {@inheritDoc}
   */
  public void setInitializeFunction(final Method method) throws SecurityException {
    this.initializeFunction = method;
    this.initializeFunction.setAccessible(true);
  }

  /**
   * {@inheritDoc}
   */
  public void setUpdateFunction(final Method method) throws SecurityException {
    this.updateFunction = method;
    this.updateFunction.setAccessible(true);
  }

  /**
   * {@inheritDoc}
   */
  public Object getParameterValue(String name) throws NoSuchParameterException {
    return ParameterUtil.getValue(this.systemKlass, name);
  }

  /**
   * {@inheritDoc}
   */
  public Set<String> getParameterNames() throws NoSuchParameterException {
    return ParameterUtil.getParameterNames(this.systemKlass);
  }

  /**
   * {@inheritDoc}
   */
  public void setParameterValue(String name, Object value) throws NoSuchParameterException {
    ParameterUtil.setValue(this.systemKlass, name, value);
  }
   
  /**
   * {@inheritDoc}
   */
  public boolean containParameter(String name) {
    return ParameterUtil.contains(this.systemKlass, name);
  }

  /**
   * {@inheritDoc}
   */
  public void update() throws ParameterException {
    try {
      this.updateFunction.invoke(this.object);
File Line
org/mklab/tool/control/system/discontinuous/CoulombViscousFriction.java 111
org/mklab/tool/control/system/discontinuous/DeadZone.java 128
        pieces.add(0);
      } else {
        pieces.add(1);
      }
    }

    return pieces;
  }

  /**
   * @see org.mklab.nfc.ode.PiecewiseContinuousAlgebraicSystem#getDiscontinuousPoint(double, org.mklab.nfc.matrix.Matrix, double, org.mklab.nfc.matrix.Matrix)
   */
  @SuppressWarnings("boxing")
  public double getDiscontinuousPoint(final double t1, final Matrix u1, final double t2, final Matrix u2) {
    final List<Integer> pieces1 = getPiece(t1, u1);
    final List<Integer> pieces2 = getPiece(t2, u2);

    if (pieces1.equals(pieces2)) {
      return Double.NaN;
    }

    final int number = PiecewiseUtil.getDistinctPiece(pieces1, pieces2);
    final int piece1 = pieces1.get(number - 1);
    final int piece2 = pieces2.get(number - 1);

    final boolean fromZeroToOne = piece1 == 0 && piece2 == 1;
    final boolean fromOneToZero = piece1 == 1 && piece2 == 0;

    final double uu1 = ((DoubleMatrix)u1).getDoubleElement(number);
    final double uu2 = ((DoubleMatrix)u2).getDoubleElement(number);

    if (fromZeroToOne || fromOneToZero) {
      return t1 + (-uu1) / (uu2 - uu1) * (t2 - t1);
File Line
org/mklab/tool/control/system/continuous/UserDefinedContinuousStaticSystem.java 105
org/mklab/tool/control/system/discrete/UserDefinedDiscreteDynamicSystem.java 135
  }

  /**
   * システムの出力方程式を定義したメソッドを設定します。
   * 
   * @param method システムの出力方程式を定義したメソッド
   * @throws SecurityException メソッドにアクセスする権利が無い場合
   */
  public void setOutputFunction(Method method) throws SecurityException {
    this.outputFunction = method;
    this.outputFunction.setAccessible(true);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setInitializeFunction(java.lang.reflect.Method)
   */
  public void setInitializeFunction(final Method method) throws SecurityException {
    this.initializeFunction = method;
    this.initializeFunction.setAccessible(true);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setUpdateFunction(java.lang.reflect.Method)
   */
  public void setUpdateFunction(final Method method) throws SecurityException {
    this.updateFunction = method;
    this.updateFunction.setAccessible(true);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
   */
  public Object getParameterValue(String name) throws NoSuchParameterException {
    return ParameterUtil.getValue(this.systemKlass, name);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#getParameterNames()
   */
  public Set<String> getParameterNames() throws NoSuchParameterException {
    return ParameterUtil.getParameterNames(this.systemKlass);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setParameterValue(java.lang.String, java.lang.Object)
   */
  public void setParameterValue(String name, Object value) throws NoSuchParameterException {
    ParameterUtil.setValue(this.systemKlass, name, value);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#containParameter(java.lang.String)
   */
  public boolean containParameter(String name) {
    return ParameterUtil.contains(this.systemKlass, name);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#update()
   */
  public void update() throws ParameterException {
    try {
      this.updateFunction.invoke(null);
File Line
org/mklab/tool/control/system/math/AbsoluteFunction.java 57
org/mklab/tool/control/system/math/SignumFunction.java 60
        pieces.add(1);
      }
    }

    return pieces;
  }

  /**
   * @see org.mklab.nfc.ode.PiecewiseContinuousAlgebraicSystem#getDiscontinuousPoint(double, org.mklab.nfc.matrix.Matrix, double, org.mklab.nfc.matrix.Matrix)
   */
  public double getDiscontinuousPoint(final double t1, final Matrix u1, final double t2, final Matrix u2) {
    final List<Integer> pieces1 = getPiece(t1, u1);
    final List<Integer> pieces2 = getPiece(t2, u2);

    if (pieces1.equals(pieces2)) {
      return Double.NaN;
    }

    final int number = PiecewiseUtil.getDistinctPiece(pieces1, pieces2);

    final double uu1 = ((DoubleMatrix)u1).getDoubleElement(number);
    final double uu2 = ((DoubleMatrix)u2).getDoubleElement(number);

    return t1 + (0 - uu1) / (uu2 - uu1) * (t2 - t1);
  }

  /**
   * @see org.mklab.tool.control.system.SystemOperator#setInputSize(int)
   */
  @Override
  public void setInputSize(final int size) {
    super.setInputSize(size);
    super.setOutputSize(size);
  }

  /**
   * @see org.mklab.tool.control.system.SystemOperator#setOutputSize(int)
   */
  @Override
  public void setOutputSize(final int size) {
    super.setInputSize(size);
    super.setOutputSize(size);
  }
}
File Line
org/mklab/tool/control/system/continuous/UserDefinedContinuousDynamicSystem.java 131
org/mklab/tool/control/system/discrete/UserDefinedDiscreteDynamicSystem.java 143
org/mklab/tool/control/system/sink/UserDefinedContinuousSink.java 108
org/mklab/tool/control/system/source/UserDefinedDiscreteSource.java 96
  public void setOutputFunction(final Method method) throws SecurityException {
    this.outputFunction = method;
    this.outputFunction.setAccessible(true);
  }

  /**
   * {@inheritDoc}
   */
  public void setInitializeFunction(final Method method) throws SecurityException {
    this.initializeFunction = method;
    this.initializeFunction.setAccessible(true);
  }

  /**
   * {@inheritDoc}
   */
  public void setUpdateFunction(final Method method) throws SecurityException {
    this.updateFunction = method;
    this.updateFunction.setAccessible(true);
  }

  /**
   * {@inheritDoc}
   */
  public Object getParameterValue(String name) throws NoSuchParameterException {
    return ParameterUtil.getValue(this.systemKlass, name);
  }

  /**
   * {@inheritDoc}
   */
  public Set<String> getParameterNames() throws NoSuchParameterException {
    return ParameterUtil.getParameterNames(this.systemKlass);
  }

  /**
   * {@inheritDoc}
   */
  public void setParameterValue(String name, Object value) throws NoSuchParameterException {
    ParameterUtil.setValue(this.systemKlass, name, value);
  }
   
  /**
   * {@inheritDoc}
   */
  public boolean containParameter(String name) {
    return ParameterUtil.contains(this.systemKlass, name);
  }

  /**
   * {@inheritDoc}
   */
  public void update() throws ParameterException {
    try {
      this.updateFunction.invoke(this.object);
File Line
org/mklab/tool/control/system/continuous/UserDefinedContinuousDynamicSystem.java 131
org/mklab/tool/control/system/continuous/UserDefinedContinuousStaticSystem.java 113
org/mklab/tool/control/system/discrete/UserDefinedDiscreteStaticSystem.java 113
  public void setOutputFunction(final Method method) throws SecurityException {
    this.outputFunction = method;
    this.outputFunction.setAccessible(true);
  }

  /**
   * {@inheritDoc}
   */
  public void setInitializeFunction(final Method method) throws SecurityException {
    this.initializeFunction = method;
    this.initializeFunction.setAccessible(true);
  }

  /**
   * {@inheritDoc}
   */
  public void setUpdateFunction(final Method method) throws SecurityException {
    this.updateFunction = method;
    this.updateFunction.setAccessible(true);
  }

  /**
   * {@inheritDoc}
   */
  public Object getParameterValue(String name) throws NoSuchParameterException {
    return ParameterUtil.getValue(this.systemKlass, name);
  }

  /**
   * {@inheritDoc}
   */
  public Set<String> getParameterNames() throws NoSuchParameterException {
    return ParameterUtil.getParameterNames(this.systemKlass);
  }

  /**
   * {@inheritDoc}
   */
  public void setParameterValue(String name, Object value) throws NoSuchParameterException {
    ParameterUtil.setValue(this.systemKlass, name, value);
  }
   
  /**
   * {@inheritDoc}
   */
  public boolean containParameter(String name) {
    return ParameterUtil.contains(this.systemKlass, name);
  }

  /**
   * {@inheritDoc}
   */
  public void update() throws ParameterException {
    try {
      this.updateFunction.invoke(this.object);
File Line
org/mklab/tool/matrix/Funm.java 51
org/mklab/tool/matrix/Funm.java 100
  public static NumericalMatrix<?> funm(Matrix A, ComplexFunction fun) {
    int n = A.getRowSize();
    SchurDecomposition<? extends NumericalMatrix<?>> temp = ((NumericalMatrix<?>)A).schurDecompose();
    Matrix Qr = temp.getU();
    Matrix Tr = temp.getT();

    List<Matrix> tmp = Rsf2csf.rsf2csf(Qr, Tr);
    NumericalMatrix<?> Q = (NumericalMatrix<?>)tmp.get(0);
    NumericalMatrix<?> T = (NumericalMatrix<?>)tmp.get(1);

    NumericalScalar<?> unit = fun.eval(T.getElement(1, 1));
    NumericalMatrix<?> F = (NumericalMatrix<?>)unit.createZeroGrid(n, n);
    for (int i = 1; i <= n; i++) {
      F.setElement(i, i, fun.eval(T.getElement(i, i)));
    }
File Line
org/mklab/tool/control/system/discrete/UserDefinedDiscreteDynamicSystem.java 135
org/mklab/tool/control/system/sink/UserDefinedDiscreteSink.java 100
  }

  /**
   * システムの出力方程式を定義したメソッドを設定します。
   * 
   * @param method システムの出力方程式を定義したメソッド
   * @throws SecurityException メソッドにアクセスする権利が無い場合
   */
  public void setOutputFunction(Method method) throws SecurityException {
    this.outputFunction = method;
    this.outputFunction.setAccessible(true);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setInitializeFunction(java.lang.reflect.Method)
   */
  public void setInitializeFunction(final Method method) throws SecurityException {
    this.initializeFunction = method;
    this.initializeFunction.setAccessible(true);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setUpdateFunction(java.lang.reflect.Method)
   */
  public void setUpdateFunction(final Method method) throws SecurityException {
    this.updateFunction = method;
    this.updateFunction.setAccessible(true);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
   */
  public Object getParameterValue(String name) throws NoSuchParameterException {
    return ParameterUtil.getValue(this.systemKlass, name);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#getParameterNames()
   */
  public Set<String> getParameterNames() throws NoSuchParameterException {
    return ParameterUtil.getParameterNames(this.systemKlass);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setParameterValue(java.lang.String, java.lang.Object)
   */
  public void setParameterValue(String name, Object value) throws NoSuchParameterException {
    ParameterUtil.setValue(this.systemKlass, name, value);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#containParameter(java.lang.String)
   */
  public boolean containParameter(String name) {
    return ParameterUtil.contains(this.systemKlass, name);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#update()
   */
  public void update() throws ParameterException {
    try {
File Line
org/mklab/tool/control/WeierstrassForm.java 91
org/mklab/tool/control/WeierstrassForm.java 160
  private NumericalMatrix<?>[] hessenbergPushDownZero(final NumericalMatrix<?> A, final NumericalMatrix<?> E, double tolerance) {
    this.TL = (NumericalMatrix<?>)A.createUnit();
    this.TR = (NumericalMatrix<?>)A.createUnit();

    NumericalMatrix<?> tA = (NumericalMatrix<?>)A.clone();
    NumericalMatrix<?> tE = (NumericalMatrix<?>)E.clone();

    for (int i = 1; i <= tA.getColumnSize(); i++) {
      for (int j = 1; j <= tA.getColumnSize() - i; j++) {
        NumericalScalar<?> e11 = tE.getElement(j, j);
        NumericalScalar<?> e22 = tE.getElement(j + 1, j + 1);

        if (!e11.isZero(tolerance) || e22.isZero(tolerance)) {
          continue;
        }
File Line
org/mklab/tool/control/ImproperLinearSystem.java 131
org/mklab/tool/control/ProperLinearSystem.java 267
    final ImproperLinearSystem inst = new ImproperLinearSystem(this.getA(), this.getB(), this.getC(), this.getD(), this.getE());

    inst.proper = this.proper;
    inst.strictlyProper = this.strictlyProper;
    inst.inputSize = this.inputSize;
    inst.stateSize = this.stateSize;
    inst.outputSize = this.outputSize;
    inst.timeDomainType = this.timeDomainType;
    inst.inputPortTags = this.inputPortTags;
    inst.outputPortTags = this.outputPortTags;
    inst.a = this.a == null ? null : (Matrix)this.a.clone();
    inst.b = this.b == null ? null : (Matrix)this.b.clone();
    inst.c = this.c == null ? null : (Matrix)this.c.clone();
    inst.d = this.d == null ? null : (Matrix)this.d.clone();
    inst.e = this.e == null ? null : (Matrix)this.e.clone();
    inst.index = this.index == null ? null : (IntMatrix)this.index.clone();
File Line
org/mklab/tool/control/system/continuous/UserDefinedContinuousDynamicSystem.java 131
org/mklab/tool/control/system/discrete/UserDefinedDiscreteStaticSystem.java 113
org/mklab/tool/control/system/sink/UserDefinedDiscreteSink.java 108
  public void setOutputFunction(final Method method) throws SecurityException {
    this.outputFunction = method;
    this.outputFunction.setAccessible(true);
  }

  /**
   * {@inheritDoc}
   */
  public void setInitializeFunction(final Method method) throws SecurityException {
    this.initializeFunction = method;
    this.initializeFunction.setAccessible(true);
  }

  /**
   * {@inheritDoc}
   */
  public void setUpdateFunction(final Method method) throws SecurityException {
    this.updateFunction = method;
    this.updateFunction.setAccessible(true);
  }

  /**
   * {@inheritDoc}
   */
  public Object getParameterValue(String name) throws NoSuchParameterException {
    return ParameterUtil.getValue(this.systemKlass, name);
  }

  /**
   * {@inheritDoc}
   */
  public Set<String> getParameterNames() throws NoSuchParameterException {
    return ParameterUtil.getParameterNames(this.systemKlass);
  }

  /**
   * {@inheritDoc}
   */
  public void setParameterValue(String name, Object value) throws NoSuchParameterException {
    ParameterUtil.setValue(this.systemKlass, name, value);
  }
   
  /**
   * {@inheritDoc}
   */
  public boolean containParameter(String name) {
    return ParameterUtil.contains(this.systemKlass, name);
  }

  /**
   * {@inheritDoc}
   */
  public void update() throws ParameterException {
    try {
File Line
org/mklab/tool/control/system/continuous/DerivativeSystem.java 27
org/mklab/tool/control/system/continuous/DerivativeSystem.java 46
org/mklab/tool/control/system/discrete/UnitLeadSystem.java 33
org/mklab/tool/control/system/discrete/UnitLeadSystem.java 52
  public void setInputSize(final int size) {
    if (size < 0) {
      return;
    }

    super.setInputSize(size);
    super.setOutputSize(size);

    if (getStateSize() != size) {
      setStateSize(size);
      super.setInitialState(new DoubleMatrix(size, 1));
      setLinearSystem(LinearSystemFactory.createLinearSystem(new DoubleMatrix(new double[][]{{0,1},{-1,0}}), new DoubleMatrix(new double[][]{{0},{1}}), new DoubleMatrix(new double[][]{{0,1}}), new DoubleMatrix(new double[][]{{0}}), new DoubleMatrix(new double[][]{{1,0},{0,0}})));
    }
  }

  /**
   * @see org.mklab.tool.control.system.SystemOperator#setOutputSize(int)
   */
  @Override
  public void setOutputSize(final int size) {
File Line
org/mklab/tool/control/Ramp.java 235
org/mklab/tool/control/Step.java 231
    DoubleMatrix Y = (DoubleMatrix)tmp.get(0);

    Canvas canvas = gnuplot.createCanvas();
    canvas.setGridVisible(true);
    canvas.setTitle("Step response"); //$NON-NLS-1$
    canvas.setXLabel("t [sec]"); //$NON-NLS-1$
    canvas.setYLabel("y"); //$NON-NLS-1$
    canvas.plot(T, Y, new String[] {"y"}); //$NON-NLS-1$
    return gnuplot;
  }

  /**
   * @param numerator 分子多項式の係数
   * @param denominator 分母多項式の係数
   * @param T 評価する時刻の列
   * @return Gnuplot
   * @throws IOException gnuplotプロセスを起動できない場合
   */
  public static Gnuplot plot(Matrix numerator, Matrix denominator, DoubleMatrix T) throws IOException {
    Gnuplot gp = new Gnuplot();
    return plot(gp, numerator, denominator, T);
  }

  /**
   * 単位ランプ応答をプロットします。
   * 
   * @param gnuplot gnuplot
   * @param numerator 分子多項式の係数
   * @param denominator 分母多項式の係数
   * @param T 評価する時刻の列
   * @return Gnuplot
   */
  public static Gnuplot plot(Gnuplot gnuplot, Matrix numerator, Matrix denominator, DoubleMatrix T) {
    RationalPolynomial g = Tf2tfn.tf2tfn(numerator, denominator);
    return plot(gnuplot, g, T);
  }

  /**
   * @param G 伝達関数行列
   * @param inputNumber 入力番号
   * @param T 評価する時刻の列
   * @return Gnuplot
   * @throws IOException gnuplotプロセスを起動できない場合
   */
  public static Gnuplot plot(RationalPolynomialMatrix G, int inputNumber, DoubleMatrix T) throws IOException {
    Gnuplot gp = new Gnuplot();
    return plot(gp, G, inputNumber, T);
  }
File Line
org/mklab/tool/control/Impulse.java 208
org/mklab/tool/control/Step.java 235
    canvas.setGridVisible(true);
    canvas.setXLabel("t [sec]");
    canvas.setYLabel("y");
    canvas.plot(T, Y, new String[] {"y"});
    return gnuplot;
  }

  /**
   * @param numerator 分子多項式の係数
   * @param denominator 分母多項式の係数
   * @param T 評価する時刻の列
   * @return Gnuplot
   * @throws IOException gnuplotプロセスを起動できない場合
   */
  public static Gnuplot plot(Matrix numerator, Matrix denominator, DoubleMatrix T) throws IOException {
    Gnuplot gp = new Gnuplot();
    return plot(gp, numerator, denominator, T);
  }

  /**
   * 単位インパルス応答をプロットする
   * 
   * @param gnuplot gnuplot
   * @param numerator 分子多項式の係数
   * @param denominator 分母多項式の係数
   * @param T 評価する時刻の列
   * @return Gnuplot
   */
  public static Gnuplot plot(Gnuplot gnuplot, Matrix numerator, Matrix denominator, DoubleMatrix T) {
    RationalPolynomial g = Tf2tfn.tf2tfn(numerator, denominator);
    return plot(gnuplot, g, T);
  }

  /**
   * @param G 伝達関数行列
   * @param inputNumber 入力番号
   * @param T 評価する時刻の列
   * @return Gnuplot
   * @throws IOException gnuplotプロセスを起動できない場合
   */
  public static Gnuplot plot(RationalPolynomialMatrix G, int inputNumber, DoubleMatrix T) throws IOException {
    Gnuplot gp = new Gnuplot();
    return plot(gp, G, inputNumber, T);
  }

  /**
   * 単位インパルス応答をプロットする
   * 
   * @param gnuplot gnuplot
   * @param G 伝達関数行列
   * @param inputNumber 入力番号
   * @param T 評価する時刻の列
   * @return Gnuplot
   */
  @SuppressWarnings("nls")
  public static Gnuplot plot(Gnuplot gnuplot, RationalPolynomialMatrix G, int inputNumber, DoubleMatrix T) {
File Line
org/mklab/tool/graph/mgplot/Mgplot.java 1720
org/mklab/tool/graph/mgplot/Mgplot.java 1808
  public static void loglog(int win, DoubleMatrix X, DoubleMatrix Y, List<String> titles, List<String> cmds1, List<String> cmds2) {
    IntMatrix idxx = X.getColumnVector(1).compareElementWise(".==", 0).find(); //$NON-NLS-1$
    if (idxx.length() != 0) {
      X.setSubMatrix(idxx, 1, DoubleMatrix.ones(idxx.length(), 1).multiply(DoubleNumberUtil.EPS));
    }

    IntMatrix idxy = Y.getColumnVector(1).compareElementWise(".==", 0).find(); //$NON-NLS-1$
    if (idxy.length() != 0) {
      Y.setSubMatrix(idxy, 1, DoubleMatrix.ones(idxy.length(), 1).multiply(DoubleNumberUtil.EPS));
    }

    grid(win, true);
    logMode(win, multiplot(win), 4);
File Line
org/mklab/tool/control/FrequencyResponse.java 197
org/mklab/tool/control/FrequencyResponse.java 234
  private NumericalMatrix<?> getResponseForProperSystem(final NumericalMatrix<?> s, final int inputNumber) {
    final Matrix a = this.system.getA();
    final Matrix b = this.system.getB();
    final Matrix c = this.system.getC();
    final Matrix d = this.system.getD();

    // Balance A
    final BalancedDecomposition<? extends NumericalMatrix<?>> ta = ((NumericalMatrix<?>)a).balancedDecompose();
    final Matrix t = ta.getD();
    final Matrix a1 = ta.getB();
    final Matrix b1 = t.leftDivide(b);
    final Matrix c1 = c.multiply(t);

    final HessenbergDecomposition<? extends NumericalMatrix<?>> qa = ((NumericalMatrix<?>)a1).hessenbergDecompose();
    final Matrix q = qa.getQ();
    final Matrix a2 = qa.getH();
    final Matrix b2 = q.conjugateTranspose().multiply(b1.getColumnVector(inputNumber));
File Line
org/mklab/tool/control/Ramp.java 295
org/mklab/tool/control/Step.java 292
    DoubleMatrix Y = (DoubleMatrix)tmp.get(0);
    int outputSize = G.getRowSize();

    String[] yy = new String[outputSize];
    for (int i = 1; i <= outputSize; i++) {
      if (outputSize == 1) {
        yy[i - 1] = "y"; //$NON-NLS-1$
      } else {
        yy[i - 1] = "y" + i; //$NON-NLS-1$
      }
    }

    Canvas canvas = gnuplot.createCanvas();
    canvas.setGridVisible(true);
    canvas.setTitle("Step response"); //$NON-NLS-1$
    canvas.setXLabel("t [sec]"); //$NON-NLS-1$
    canvas.setYLabel("y"); //$NON-NLS-1$
    canvas.plot(T, Y, yy);
    return gnuplot;
  }

  /**
   * @param A A行列
   * @param B B行列
   * @param C C行列
   * @param D D行列
   * @param inputNumber 入力番号
   * @param T 評価する時刻の列
   * @return Gnuplot
   * @throws IOException gnuplotプロセスを起動できない場合
   */
  public static Gnuplot plot(Matrix A, Matrix B, Matrix C, Matrix D, int inputNumber, DoubleMatrix T) throws IOException {
    Gnuplot gp = new Gnuplot();
    return plot(gp, A, B, C, D, inputNumber, T);
  }
File Line
org/mklab/tool/control/system/continuous/UserDefinedContinuousStaticSystem.java 83
org/mklab/tool/control/system/source/UserDefinedContinuousSource.java 76
      return (Matrix)this.outputFunction.invoke(this.object, new Double(t));
    } catch (IllegalArgumentException e) {
      throw new SolverStopException(e);
    } catch (IllegalAccessException e) {
      throw new SolverStopException(e);
    } catch (InvocationTargetException e) {
      throw new SolverStopException(e.getTargetException());
    }
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setSystemClass(java.lang.Class)
   */
  public void setSystemClass(final Class<?> klass) {
    this.systemKlass = klass;
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#getSystemClass()
   */
  public Class<?> getSystemClass() {
    return this.systemKlass;
  }

  /**
   * システムの出力方程式を定義したメソッドを設定します。
   * 
   * @param method システムの出力方程式を定義したメソッド
   * @throws SecurityException メソッドにアクセスする権利が無い場合
   */
  public void setOutputFunction(Method method) throws SecurityException {
    this.outputFunction = method;
    this.outputFunction.setAccessible(true);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setInitializeFunction(java.lang.reflect.Method)
   */
  public void setInitializeFunction(final Method method) throws SecurityException {
    this.initializeFunction = method;
    this.initializeFunction.setAccessible(true);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setUpdateFunction(java.lang.reflect.Method)
   */
  public void setUpdateFunction(final Method method) throws SecurityException {
    this.updateFunction = method;
    this.updateFunction.setAccessible(true);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
   */
  public Object getParameterValue(String name) throws NoSuchParameterException {
File Line
org/mklab/tool/control/system/SystemOperator.java 136
org/mklab/tool/control/system/SystemOperator.java 158
  public int hashCode() {
    int hashCode = 1;
    hashCode = 31 * hashCode + this.stateSize;
    hashCode = 31 * hashCode + this.inputSize;
    hashCode = 31 * hashCode + this.outputSize;
    hashCode = 31 * hashCode + (this.hasDirectFeedthrough ? 1231 : 1237);
    hashCode = 31 * hashCode + (this.forcedSystem ? 1231 : 1237);
    hashCode = 31 * hashCode + (this.dynamic ? 1231 : 1237);
    hashCode = 31 * hashCode + (this.linear ? 1231 : 1237);
    hashCode = 31 * hashCode + (this.inlet ? 1231 : 1237);
    hashCode = 31 * hashCode + (this.outlet ? 1231 : 1237);
    hashCode = 31 * hashCode + (this.parameters == null ? 0 : getParameterHashCode());
    hashCode = 31 * hashCode + (this.autoSize ? 1231 : 1237);
File Line
org/mklab/tool/graph/gnuplot/Canvas.java 1169
org/mklab/tool/graph/gnuplot/Canvas.java 1256
    for (int i = 1; i <= yData.getRowSize(); i++) {
      String lineName;
      if (i <= names.length) {
        lineName = names[i - 1];
      } else {
        lineName = "data-" + (size + 1) + "-" + i; //$NON-NLS-1$ //$NON-NLS-2$
      }

      String cmd1;
      if (i <= attribute1.length) {
        cmd1 = attribute1[i - 1];
      } else {
        cmd1 = ""; //$NON-NLS-1$
      }

      String cmd2;
      if (i <= attribute2.length) {
        cmd2 = attribute2[i - 1];
      } else {
        cmd2 = ""; //$NON-NLS-1$
      }

      if (this.keepingLineProperties == false) {
        this.lineWidthes.add(new LineWidth(1));
        this.lineTypes.add(new LineType((i - 1)%this.colors.length));
        this.lineVisibles.add(Boolean.TRUE);
        this.lineNames.add(lineName);
      }
File Line
org/mklab/tool/control/system/source/UserDefinedContinuousSource.java 76
org/mklab/tool/control/system/source/UserDefinedDiscreteSource.java 66
      return (Matrix)this.outputFunction.invoke(this.obj, new Double(t));
    } catch (IllegalArgumentException e) {
      throw new SolverStopException(e);
    } catch (IllegalAccessException e) {
      throw new SolverStopException(e);
    } catch (InvocationTargetException e) {
      throw new SolverStopException(e.getTargetException());
    }
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setSystemClass(java.lang.Class)
   */
  public void setSystemClass(final Class<?> klass) {
    this.systemKlass = klass;
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#getSystemClass()
   */
  public Class<?> getSystemClass() {
    return this.systemKlass;
  }

  /**
   * システムの出力方程式を定義したメソッドを設定します。
   * 
   * @param method システムの出力方程式を定義したメソッド
   * @throws SecurityException メソッドにアクセスする権利が無い場合
   */
  public void setOutputFunction(Method method) throws SecurityException {
    this.outputFunction = method;
    this.outputFunction.setAccessible(true);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setInitializeFunction(java.lang.reflect.Method)
   */
  public void setInitializeFunction(final Method method) throws SecurityException {
    this.initializeFunction = method;
    this.initializeFunction.setAccessible(true);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setUpdateFunction(java.lang.reflect.Method)
   */
  public void setUpdateFunction(final Method method) throws SecurityException {
    this.updateFunction = method;
    this.updateFunction.setAccessible(true);
  }

  /**
   * システムのクローズ処理を記述したメソッドを設定します。
   * 
   * @param closeFunction システムのクローズ処理を記述したメソッド
   */
  public void setCloseFunction(Method closeFunction) {
File Line
org/mklab/tool/control/system/continuous/UserDefinedContinuousDynamicSystem.java 185
org/mklab/tool/control/system/continuous/UserDefinedContinuousStaticSystem.java 167
      this.updateFunction.invoke(this.object);
    } catch (IllegalArgumentException e) {
      throw new ParameterException(e);
    } catch (IllegalAccessException e) {
      throw new ParameterException(e);
    } catch (InvocationTargetException e) {
      throw new ParameterException(e.getTargetException());
    } catch (Exception e) {
      throw new ParameterException(e);
    }
  }

  /**
   * {@inheritDoc}
   */
  @Override
  public void initialize() {
    super.initialize();
    try {
      if (this.initializeFunction != null) {
        this.initializeFunction.invoke(this.object);
      }
    } catch (IllegalArgumentException e) {
      throw new RuntimeException(e);
    } catch (IllegalAccessException e) {
      throw new RuntimeException(e);
    } catch (InvocationTargetException e) {
      throw new RuntimeException(e.getTargetException());
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
File Line
org/mklab/tool/control/system/discrete/UserDefinedDiscreteStaticSystem.java 168
org/mklab/tool/control/system/sink/UserDefinedContinuousSink.java 163
org/mklab/tool/control/system/sink/UserDefinedDiscreteSink.java 165
org/mklab/tool/control/system/source/UserDefinedDiscreteSource.java 151
    } catch (IllegalArgumentException e) {
      throw new ParameterException(e);
    } catch (IllegalAccessException e) {
      throw new ParameterException(e);
    } catch (InvocationTargetException e) {
      throw new ParameterException(e.getTargetException());
    } catch (Exception e) {
      throw new ParameterException(e);
    }
  }

  /**
   * @see org.mklab.tool.control.system.discrete.BaseDiscreteStaticSystem#initialize()
   */
  @Override
  public void initialize() {
    super.initialize();
    try {
      if (this.initializeFunction != null) {
        this.initializeFunction.invoke(this.obj);
      }
    } catch (IllegalArgumentException e) {
      throw new RuntimeException(e);
    } catch (IllegalAccessException e) {
      throw new RuntimeException(e);
    } catch (InvocationTargetException e) {
      throw new RuntimeException(e.getTargetException());
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
}
File Line
org/mklab/tool/control/WeierstrassForm.java 192
org/mklab/tool/control/WeierstrassForm.java 213
          NumericalScalar<?> z1a2 = tA.getElement(j + 1, j);
          NumericalMatrix<?> Z1 = givens(z1a1, z1a2, tolerance);
          this.TR.setSubMatrix(1, this.TR.getRowSize(), j, j + 1, this.TR.getSubMatrix(1, this.TR.getRowSize(), j, j + 1).multiply(Z1));
          tA.setSubMatrix(1, tA.getRowSize(), j, j + 1, tA.getSubMatrix(1, tA.getRowSize(), j, j + 1).multiply(Z1));
          tE.setSubMatrix(1, tE.getRowSize(), j, j + 1, tE.getSubMatrix(1, tE.getRowSize(), j, j + 1).multiply(Z1));
File Line
org/mklab/tool/control/system/discrete/UserDefinedDiscreteDynamicSystem.java 198
org/mklab/tool/control/system/sink/UserDefinedDiscreteSink.java 165
org/mklab/tool/control/system/source/UserDefinedContinuousSource.java 181
    } catch (IllegalArgumentException e) {
      throw new ParameterException(e);
    } catch (IllegalAccessException e) {
      throw new ParameterException(e);
    } catch (InvocationTargetException e) {
      throw new ParameterException(e.getTargetException());
    } catch (Exception e) {
      throw new ParameterException(e);
    }
  }

  /**
   * @see org.mklab.tool.control.system.discrete.BaseDiscreteStaticSystem#initialize()
   */
  @Override
  public void initialize() {
    super.initialize();
    try {
      if (this.initializeFunction != null) {
        this.initializeFunction.invoke(this.obj);
      }
    } catch (IllegalArgumentException e) {
      throw new RuntimeException(e);
    } catch (IllegalAccessException e) {
      throw new RuntimeException(e);
    } catch (InvocationTargetException e) {
      throw new RuntimeException(e.getTargetException());
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
File Line
org/mklab/tool/control/Obsg.java 62
org/mklab/tool/control/Obsg.java 120
      throw new  IllegalArgumentException(Messages.getString("Obsg.3")); //$NON-NLS-1$
    }

    final Matrix Tinv = ((NumericalMatrix<?>)C).kernel().transpose().appendDown(C);
    final Matrix T = Tinv.inverse();
    final Matrix Ab = Tinv.multiply(A).multiply(T);
    final Matrix Bb = Tinv.multiply(B);
    // Matrix Cb = C.multiply(T);
    final Matrix Ab11 = Ab.getSubMatrix(1, r, 1, r);
    final Matrix Ab12 = Ab.getSubMatrix(1, r, r + 1, n);
    final Matrix Ab21 = Ab.getSubMatrix(r + 1, n, 1, r);
    final Matrix Ab22 = Ab.getSubMatrix(r + 1, n, r + 1, n);
    final Matrix Bb1 = Bb.getSubMatrix(1, r, 1, m);
File Line
org/mklab/tool/control/system/discontinuous/CoulombViscousFriction.java 143
org/mklab/tool/control/system/discontinuous/DeadZone.java 167
      return t1 + (-uu1) / (uu2 - uu1) * (t2 - t1);
    }

    assert false : "never reached"; //$NON-NLS-1$

    return Double.NaN;
  }

  /**
   * @see org.mklab.tool.control.system.SystemOperator#setInputSize(int)
   */
  @Override
  public void setInputSize(final int size) {
    super.setInputSize(size);
    super.setOutputSize(size);
  }

  /**
   * @see org.mklab.tool.control.system.SystemOperator#setOutputSize(int)
   */
  @Override
  public void setOutputSize(final int size) {
    super.setInputSize(size);
    super.setOutputSize(size);
  }

  /**
   * @see org.mklab.tool.control.system.parameter.StringExternalizable#getString(java.lang.String)
   */
  public String getString(String key) {
    return Messages.getString(key);
  }

  /**
   * @see org.mklab.tool.control.system.SystemOperator#equals(java.lang.Object)
   */
  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (!super.equals(o)) {
      return false;
    }
    if (o == null) {
      return false;
    }
    if (o.getClass() != getClass()) {
      return false;
    }
File Line
org/mklab/tool/control/system/discontinuous/Backlash.java 282
org/mklab/tool/control/system/discontinuous/RateLimiter.java 220
org/mklab/tool/control/system/discontinuous/Saturation.java 168
      return t1 + (this.deadBandWidth / 2 - (uu2 - uu1)) / (this.deadBandWidth / 2) * (t2 - t1);
    }

    assert false : "never reached"; //$NON-NLS-1$

    return (t1 + t2) / 2;
  }

  /**
   * @see org.mklab.tool.control.system.SystemOperator#setInputSize(int)
   */
  @Override
  public void setInputSize(final int size) {
    super.setInputSize(size);
    super.setOutputSize(size);
  }

  /**
   * @see org.mklab.tool.control.system.SystemOperator#setOutputSize(int)
   */
  @Override
  public void setOutputSize(final int size) {
    super.setInputSize(size);
    super.setOutputSize(size);
  }

  /**
   * @see org.mklab.tool.control.system.parameter.StringExternalizable#getString(java.lang.String)
   */
  public String getString(String key) {
    return Messages.getString(key);
  }

  /**
   * @see org.mklab.tool.control.system.SystemOperator#equals(java.lang.Object)
   */
  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (!super.equals(o)) {
      return false;
    }
    if (o == null) {
      return false;
    }
    if (o.getClass() != getClass()) {
      return false;
    }
File Line
org/mklab/tool/control/system/continuous/BlockContinuousStaticSystem.java 32
org/mklab/tool/control/system/sampled/BlockSampledDataStaticSystem.java 32
  public BlockContinuousStaticSystem(final SystemOperator[][] elements, final List<Integer> inputNodes, final List<Integer> outputNodes) {
    super(elements, inputNodes, outputNodes);
    setDynamic(false);
  }

  /**
   * @see org.mklab.tool.control.system.continuous.ContinuousStaticSystem#outputEquation(double, org.mklab.nfc.matrix.Matrix)
   */
  public Matrix outputEquation(final double t, final Matrix u) throws SolverStopException {
    resetNodeValue();
    setInputNodeValue(u);
    calcNodeValue(t);
    return getOutputNodeValue();
  }

  /**
   * @see org.mklab.tool.control.system.continuous.ContinuousStaticSystem#outputEquation(double)
   */
  public Matrix outputEquation(final double t) throws SolverStopException {
    resetNodeValue();
    setInputNodeValue(new DoubleMatrix(getInputSize(), 1));
    calcNodeValue(t);
    return getOutputNodeValue();
  }

  /**
   * @see org.mklab.nfc.ode.ContinuousAlgebraicSystem#inputOutputEquation(double)
   */
  public Matrix inputOutputEquation(final double t) throws SolverStopException {
    final DoubleMatrix u = new DoubleMatrix(getInputSize(), 1);
    final Matrix y = outputEquation(t);
    return u.appendDown(y);
  }
}
File Line
org/mklab/tool/control/Impulse.java 208
org/mklab/tool/control/Ramp.java 239
    canvas.setGridVisible(true);
    canvas.setXLabel("t [sec]");
    canvas.setYLabel("y");
    canvas.plot(T, Y, new String[] {"y"});
    return gnuplot;
  }

  /**
   * @param numerator 分子多項式の係数
   * @param denominator 分母多項式の係数
   * @param T 評価する時刻の列
   * @return Gnuplot
   * @throws IOException gnuplotプロセスを起動できない場合
   */
  public static Gnuplot plot(Matrix numerator, Matrix denominator, DoubleMatrix T) throws IOException {
    Gnuplot gp = new Gnuplot();
    return plot(gp, numerator, denominator, T);
  }

  /**
   * 単位インパルス応答をプロットする
   * 
   * @param gnuplot gnuplot
   * @param numerator 分子多項式の係数
   * @param denominator 分母多項式の係数
   * @param T 評価する時刻の列
   * @return Gnuplot
   */
  public static Gnuplot plot(Gnuplot gnuplot, Matrix numerator, Matrix denominator, DoubleMatrix T) {
    RationalPolynomial g = Tf2tfn.tf2tfn(numerator, denominator);
    return plot(gnuplot, g, T);
  }

  /**
   * @param G 伝達関数行列
   * @param inputNumber 入力番号
   * @param T 評価する時刻の列
   * @return Gnuplot
   * @throws IOException gnuplotプロセスを起動できない場合
   */
  public static Gnuplot plot(RationalPolynomialMatrix G, int inputNumber, DoubleMatrix T) throws IOException {
    Gnuplot gp = new Gnuplot();
    return plot(gp, G, inputNumber, T);
  }
File Line
org/mklab/tool/control/system/sampled/BlockSampledDataDynamicSystem.java 172
org/mklab/tool/control/system/sampled/BlockSampledDataDynamicSystem.java 200
    for (final ContinuousExplicitDynamicSystem system : this.continuousDynamicSystems) {
      final int size = ((SystemOperator)system).getStateSize();
      if (size > 0) {
        final int end = offset + size - 1;
        if (end > initialState.getRowSize()) {
          throw new IllegalArgumentException(MessageFormat.format(Messages.getString("BlockSampledDataDynamicSystem.0"), system.getClass().getName())); //$NON-NLS-1$
        }
        system.setInitialState(initialState.getSubVector(offset, end));
        offset += size;
        stateSize += size;
      }
    }

    if (initialState.getRowSize() != stateSize) {
      throw new IllegalArgumentException(MessageFormat.format(Messages.getString("BlockSampledDynamicSystem.1"), Integer.valueOf(initialState.getRowSize()), Integer.valueOf(stateSize))); //$NON-NLS-1$
    }
  }

  /**
   * @see org.mklab.tool.control.system.sampled.SampledDataDynamicSystem#setDiscreteInitialState(org.mklab.nfc.matrix.Matrix)
   */
  public void setDiscreteInitialState(final Matrix initialState) {
File Line
org/mklab/tool/control/system/sampled/BlockSampledDataDynamicSystem.java 228
org/mklab/tool/control/system/sampled/BlockSampledDataDynamicSystem.java 256
    for (final ContinuousExplicitDynamicSystem system : this.continuousDynamicSystems) {
      final int size = ((SystemOperator)system).getStateSize();
      if (size > 0) {
        final int end = offset + size - 1;
        if (end > state.getRowSize()) {
          throw new IllegalArgumentException(MessageFormat.format(Messages.getString("BlockSampledDataDynamicSystem.0"), system.getClass().getName())); //$NON-NLS-1$
        }
        system.setState(state.getSubVector(offset, end));
        offset += size;
        stateSize += size;
      }
    }

    if (state.getRowSize() != stateSize) {
      throw new IllegalArgumentException(MessageFormat.format(Messages.getString("BlockSampledDynamicSystem.1"), Integer.valueOf(state.getRowSize()), Integer.valueOf(stateSize))); //$NON-NLS-1$
    }
  }
File Line
org/mklab/tool/control/system/AdjacencyMatrixUtil.java 851
org/mklab/tool/control/system/AdjacencyMatrixUtil.java 999
  static SystemOperator[][] replaceLinearDynamicSystemWithBLockSystem(final SystemOperator[][] matrix, final boolean requireringPrimitive) {
    final SystemOperator[][] newMatrix = AdjacencyMatrixUtil.createClone(matrix);

    final int size = newMatrix.length;

    for (int row = 0; row < size; row++) {
      for (int column = 0; column < size; column++) {
        if (newMatrix[row][column] == ZeroSystem.getInstance()) {
          continue;
        }

        if (!newMatrix[row][column].isLinear() || !newMatrix[row][column].isDynamic()) {
          continue;
        }

        final List<Integer> inputNodes = new ArrayList<>(Arrays.asList(1));
        final List<Integer> outputNodes = new ArrayList<>(Arrays.asList(4));
File Line
org/mklab/tool/control/system/continuous/UserDefinedContinuousLinearDynamicSystem.java 95
org/mklab/tool/control/system/discrete/UserDefinedDiscreteLinearDynamicSystem.java 82
  public void setParameterValue(final String name, final Object value) throws NoSuchParameterException {
    ParameterUtil.setValue(this.systemKlass, name, value);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#containParameter(java.lang.String)
   */
  public boolean containParameter(String name) {
    return ParameterUtil.contains(this.systemKlass, name);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setSystemClass(java.lang.Class)
   */
  public void setSystemClass(final Class<?> klass) {
    this.systemKlass = klass;
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#getSystemClass()
   */
  public Class<?> getSystemClass() {
    return this.systemKlass;
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setInitializeFunction(java.lang.reflect.Method)
   */
  public void setInitializeFunction(final Method method) throws SecurityException {
    this.initializeFunction = method;
    this.initializeFunction.setAccessible(true);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setUpdateFunction(java.lang.reflect.Method)
   */
  public void setUpdateFunction(final Method method) throws SecurityException {
    this.updateFunction = method;
    this.updateFunction.setAccessible(true);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#update()
   */
  public void update() throws ParameterException {
    try {
      this.updateFunction.invoke(this.object);
File Line
org/mklab/tool/control/system/discontinuous/Saturation.java 143
org/mklab/tool/control/system/sink/Restrictor.java 207
  public double getDiscontinuousPoint(final double t1, final Matrix u1, final double t2, final Matrix u2) {
    final List<Integer> pieces1 = getPiece(t1, u1);
    final List<Integer> pieces2 = getPiece(t2, u2);
    if (pieces1.equals(pieces2)) {
      return Double.NaN;
    }

    final int number = PiecewiseUtil.getDistinctPiece(pieces1, pieces2);
    final int piece1 = pieces1.get(number - 1);
    final int piece2 = pieces2.get(number - 1);

    final double uu1 = ((DoubleMatrix)u1).getDoubleElement(number);
    final double uu2 = ((DoubleMatrix)u2).getDoubleElement(number);

    final boolean fromOneToTwo = piece1 == 1 && piece2 == 2;
    final boolean fromTwoToOne = piece1 == 2 && piece2 == 1;
File Line
org/mklab/tool/control/ImproperLinearSystem.java 269
org/mklab/tool/control/ProperLinearSystem.java 297
      if (withInputOutput) {
        if (isContinuous()) {
          if (getSubSystemSize() == 1) {
            string.append("       "); //$NON-NLS-1$
          } else {
            string.append("     "); //$NON-NLS-1$
          }
        }

        if (isDiscrete()) {
          string.append("     "); //$NON-NLS-1$
        }

        final String format = "%" + (symbolicState[0].length() + 1 + 1 + 1) + "s"; //$NON-NLS-1$ //$NON-NLS-2$
        string.append(String.format(format, "")); //$NON-NLS-1$
      }

      string.append("["); //$NON-NLS-1$
      drawHorizontalLine(string, columnLengthes);
      string.append("]" + System.getProperty("line.separator")); //$NON-NLS-1$ //$NON-NLS-2$
    }

    string.append(getSymbolicOutputEquation(withInputOutput));

    return string.toString();
  }
File Line
org/mklab/tool/control/system/AdjacencyMatrix.java 2437
org/mklab/tool/control/system/AdjacencyMatrix.java 2565
  public LinearSystem getLinearSystem(final boolean requiringReachableSubSystem) {
    final AdjacencyMatrix allSystem = getLinearSystemFromInputToOutput(requiringReachableSubSystem);

    final int[] stateSizes = allSystem.getStateSizes();
    int stateSize = 0;
    for (int i = 0; i < stateSizes.length; i++) {
      stateSize += stateSizes[i];
    }

    final int inputSize = allSystem.getInputSize();
    final int outputSize = allSystem.getOutputSize();

    final Matrix a = allSystem.createNumericalA(stateSizes, stateSize);
    final Matrix b = allSystem.createNumericalB(stateSizes, stateSize, inputSize);
    final Matrix c = allSystem.createNumericalC(stateSizes, stateSize, outputSize);
    final Matrix d = allSystem.createNumericalD(inputSize, outputSize);
    final Matrix e = allSystem.createNumericalE(stateSizes, stateSize);

    final LinearSystem linearSystem = this.requiringDescriptor ? LinearSystemFactory.createLinearSystem(a, b, c, d, e, true) : LinearSystemFactory.createLinearSystem(a, b, c, d, e, false);
File Line
org/mklab/tool/control/AbstractLinearSystem.java 933
org/mklab/tool/control/AbstractLinearSystem.java 962
            .subtract(((AbstractLinearSystem)feedbackElement).b.divide(T2).multiply(this.d).multiply(((AbstractLinearSystem)feedbackElement).c));
        ansA = a11.appendRight(a12).appendDown(a21.appendRight(a22));

        // B = [[  B1/T1 ]
        //      [B2/T2*D1]];
        final Matrix b1 = this.b.divide(T1);
        final Matrix b2 = ((AbstractLinearSystem)feedbackElement).b.divide(T2).multiply(this.d);
        ansB = b1.appendDown(b2);
        // [T2\C1, -T2\D1*C2];
        ansC = T2.leftDivide(this.c).appendRight(T2.leftDivide(this.d).multiply(((AbstractLinearSystem)feedbackElement).c).unaryMinus());
File Line
org/mklab/tool/control/Dinitial.java 246
org/mklab/tool/control/Initial.java 252
org/mklab/tool/control/Step.java 342
    List<Matrix> yx = dinitial(A, B, C, D, x0, T);
    DoubleMatrix Y = (DoubleMatrix)yx.get(0);
    DoubleMatrix X = (DoubleMatrix)yx.get(1);

    int outputSize = C.getRowSize();
    String[] yy = new String[outputSize];
    for (int i = 1; i <= outputSize; i++) {
      if (outputSize == 1) {
        yy[i - 1] = "y";
      } else {
        yy[i - 1] = "y" + i;
      }
    }

    gnuplot.createCanvas(2, 1);
    Canvas canvas1 = gnuplot.getCanvas(0, 0);
    canvas1.setGridVisible(true);
    canvas1.setXLabel("t [sec]");
    canvas1.setYLabel("y");
    canvas1.plot(T, Y, yy);
File Line
org/mklab/tool/control/system/AdjacencyMatrix.java 2477
org/mklab/tool/control/system/AdjacencyMatrix.java 2565
  public LinearSystem getLinearSystemForMaxima(final boolean requiringReachableSubSystem, final ReversePolishNotationProcessor processor) {
    final AdjacencyMatrix allSystem = getLinearSystemFromInputToOutput(requiringReachableSubSystem);

    final int[] stateSizes = allSystem.getStateSizes();
    int stateSize = 0;
    for (int i = 0; i < stateSizes.length; i++) {
      stateSize += stateSizes[i];
    }

    final int inputSize = allSystem.getInputSize();
    final int outputSize = allSystem.getOutputSize();

    final Matrix a = allSystem.createNumericalA(stateSizes, stateSize);
    final Matrix b = allSystem.createNumericalB(stateSizes, stateSize, inputSize);
    final Matrix c = allSystem.createNumericalC(stateSizes, stateSize, outputSize);
    final Matrix d = allSystem.createNumericalD(inputSize, outputSize);

    final LinearSystem linearSystem = LinearSystemFactory.createLinearSystem(a, b, c, d);
File Line
org/mklab/tool/matrix/Dft.java 41
org/mklab/tool/matrix/Dft.java 85
    Matrix W0 = IntMatrix.series(0, N - 1).transpose().multiply(pi.multiply(2).divide(N));
    Matrix Wn = ((NumericalMatrix<?>)W0.multiply(j).unaryMinus()).expElementWise();

    NumericalMatrix<?> Y = (NumericalMatrix<?>)j.createZeroGrid(X.getRowSize(), X.getColumnSize());
    for (int k = 0; k <= N - 1; k++) {
      Y.setColumnVector(k + 1, X.multiply(Wn.powerElementWise(k)));
    }

    return Y;
  }

  /**
   * <code>X</code> の離散時間フーリエ変換
   * 
   * <pre><code>
   * 
   * W = exp&circ;{-j*2PI/N}
   * 
   * Y(k) = sum_{n=0}&circ;{N-1} X(n) W&circ;{k n} k = 0,1,...,N-1
   * 
   * Y(k) = Y(j*k * 2*PI/(N*T)) T := サンプリング周期
   * 
   * </code></pre>
   * 
   * を求めます。
   * 
   * @param X_ データ
   * @param N データの個数
   * @return 離散フーリエ変換の結果 (transformed result)
   */
  public static NumericalMatrix<?> dft(Matrix X_, int N) {
File Line
org/mklab/tool/signal/Filter.java 106
org/mklab/tool/signal/Filter.java 130
            z = (NumericalMatrix<?>)z.getSubMatrix(2, z.getRowSize(), 1, 1).appendDown(a.createZero(1, 1)).add(b2t2.multiply(x.getElement(i)));
          }
        } else {
          for (int i = 1; i <= nx; i++) {
            y.setElement(i, 1, b.getElement(1).multiply(x.getElement(i)).add(z.getElement(1)));
            Matrix tmp1 = z.getSubMatrix(2, z.getRowSize(), 1, 1).appendDown(a.createZero(1, 1));
            Matrix b2t2 = b2t;
            Matrix tmp2 = b2t2.multiply(x.getElement(i));
            Matrix a2t2 = a2t;
            Matrix tmp3 = a2t2.multiply(y.getElement(i)).appendDown(zab);
File Line
org/mklab/tool/control/system/discontinuous/Backlash.java 288
org/mklab/tool/control/system/discontinuous/CoulombViscousFriction.java 149
org/mklab/tool/control/system/discontinuous/DeadZone.java 173
org/mklab/tool/control/system/discontinuous/RateLimiter.java 226
org/mklab/tool/control/system/discontinuous/Saturation.java 174
  }

  /**
   * @see org.mklab.tool.control.system.SystemOperator#setInputSize(int)
   */
  @Override
  public void setInputSize(final int size) {
    super.setInputSize(size);
    super.setOutputSize(size);
  }

  /**
   * @see org.mklab.tool.control.system.SystemOperator#setOutputSize(int)
   */
  @Override
  public void setOutputSize(final int size) {
    super.setInputSize(size);
    super.setOutputSize(size);
  }

  /**
   * @see org.mklab.tool.control.system.parameter.StringExternalizable#getString(java.lang.String)
   */
  public String getString(String key) {
    return Messages.getString(key);
  }

  /**
   * @see org.mklab.tool.control.system.SystemOperator#equals(java.lang.Object)
   */
  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (!super.equals(o)) {
      return false;
    }
    if (o == null) {
      return false;
    }
    if (o.getClass() != getClass()) {
      return false;
    }
File Line
org/mklab/tool/control/system/math/RoundingFunction.java 179
org/mklab/tool/control/system/sink/Restrictor.java 207
  public double getDiscontinuousPoint(double t1, Matrix u1, double t2, Matrix u2) {
    final List<Integer> pieces1 = getPiece(t1, u1);
    final List<Integer> pieces2 = getPiece(t2, u2);
    if (pieces1.equals(pieces2)) {
      return Double.NaN;
    }

    final int number = PiecewiseUtil.getDistinctPiece(pieces1, pieces2);

    final int piece1 = pieces1.get(number - 1);
    final int piece2 = pieces2.get(number - 1);

    final double uu1 = ((DoubleMatrix)u1).getDoubleElement(number);
    final double uu2 = ((DoubleMatrix)u2).getDoubleElement(number);
File Line
org/mklab/tool/control/Dimpulse.java 277
org/mklab/tool/control/Dlsim.java 136
    List<Matrix> yx = dimpulse(A, B, C, D, inputNumber, seriesSize);
    DoubleMatrix Y = (DoubleMatrix)yx.get(0);
    DoubleMatrix X = (DoubleMatrix)yx.get(1);

    int outputSize = C.getRowSize();
    String[] yy = new String[outputSize];
    for (int i = 1; i <= outputSize; i++) {
      if (outputSize == 1) {
        yy[i - 1] = "y";
      } else {
        yy[i - 1] = "y" + i;
      }
    }

    gnuplot.createCanvas(2, 1);
    Canvas canvas1 = gnuplot.getCanvas(0, 0);
    canvas1.setGridVisible(true);
    canvas1.setXLabel("k");
    canvas1.setYLabel("y");
File Line
org/mklab/tool/control/FrequencyResponse.java 169
org/mklab/tool/control/FrequencyResponse.java 256
    final int size = s.length();

    if (a.getRowSize() == 0) {
      NumericalMatrix<?> dResponse = ((NumericalMatrix<?>)d2).createComplexMatrix((NumericalMatrix<?>)d2, (NumericalMatrix<?>)d2.createZero());
      List<NumericalMatrix<?>> responses = new ArrayList<>();
      for (int i = 0; i < size; i++) {
        responses.add((NumericalMatrix<?>)dResponse.clone());
      }
      return responses;
    }

    List<NumericalMatrix<?>> abResponses = Ltifr.getResponse(a2, b2, e2, s);
File Line
org/mklab/tool/control/system/AdjacencyMatrix.java 1804
org/mklab/tool/control/system/AdjacencyMatrix.java 1860
  private AdjacencyMatrix sortIntegratorLower() {
    final SystemOperator[][] matrix = AdjacencyMatrixUtil.createClone(this.elements);
    final AdjacencyMatrix ans = new AdjacencyMatrix(matrix);
    ans.setInputNodes(this.inputNodes);
    ans.setSourceNodes(this.sourceNodes);
    ans.setOutputNodes(this.outputNodes);
    ans.setSinkNodes(this.sinkNodes);
    ans.setInputPortTags(this.inputPortTags);
    ans.setOutputPortTags(this.outputPortTags);
    ans.setRequiringLinearSystem(this.requiringLinearSystem);
    ans.setRequiringDescriptor(this.requiringDescriptor);
    ans.setRequiringPrimitiveExpression(this.requiringPrimitiveExpression);

    final int inputNodeSize = ans.inputNodes.size();
    final int numberOfIntegrator = ans.getIntegratorOrUnitDelaySystemSize();

    for (int row = 0; row < inputNodeSize + numberOfIntegrator; row++) {
File Line
org/mklab/tool/control/Gmargin.java 85
org/mklab/tool/control/Pmargin.java 83
    for (;;) {
      final DoubleMatrix w = LogarithmicallySpacedVector.create(Math.log(wmin2) / Math.log(10), Math.log(wmax2) / Math.log(10), 100);
      final List<NumericalMatrix<?>> gainPhase = new Bode(LinearSystemFactory.createLinearSystem(g)).getGainAndPhase(w).get(0);
      DoubleMatrix gain = (DoubleMatrix)gainPhase.get(0);
      DoubleMatrix phase = (DoubleMatrix)gainPhase.get(1);
      gain = gain.log10ElementWise().multiply(20);
      phase = (DoubleMatrix)Unwrap.unwrapRowWise(phase);

      IntMatrix idx = phase.compareElementWise(".<", -180.0).find(); //$NON-NLS-1$
File Line
org/mklab/tool/control/Nyquist.java 238
org/mklab/tool/control/NyquistPlotter.java 234
  private void drawRealAxis(final Canvas canvas, final double min, final double max) {
    double reMin = min;
    double reMax = max;

    if (0.1 < Math.abs(reMax) || 0.1 < Math.abs(reMin)) {
      if (reMax < 1) {
        reMax = 1;
      } else if (100 < reMax) {
        reMax = 100;
      } else {
        reMax = Math.ceil(reMax / 10) * 10;
      }
      if (-1 < reMin) {
        reMin = -2;
      } else if (reMin < -100) {
        reMin = -100;
      } else {
        reMin = Math.floor(reMin / 10) * 10;
      }
    }
File Line
org/mklab/tool/control/Nyquist.java 275
org/mklab/tool/control/NyquistPlotter.java 270
  private void drawImaginaryAxis(final Canvas canvas, final double min, final double max) {
    double imMin = min;
    double imMax = max;

    if (0.1 < Math.abs(imMax) || 0.1 < Math.abs(imMin)) {
      if (imMax < 1) {
        imMax = 1;
      } else if (100 < imMax) {
        imMax = 100;
      } else {
        imMax = Math.ceil(imMax / 10) * 10;
      }
      if (-1 < imMin) {
        imMin = -1;
      } else if (imMin < -100) {
        imMin = -100;
      } else {
        imMin = Math.floor(imMin / 10) * 10;
      }
    }
File Line
org/mklab/tool/control/system/continuous/BlockPiecewiseContinuousDynamicSystem.java 92
org/mklab/tool/control/system/sampled/BlockPiecewiseSampledDataDynamicSystem.java 363
  private List<Double> getDiscontinuousPoints(double t1, final List<Matrix> inputs1, double t2, final List<Matrix> inputs2) throws SolverStopException {
    final List<Double> points = new ArrayList<>();
    for (int i = 0; i < this.piecewiseContinuousAlgebraicSystems.size(); i++) {
      final PiecewiseContinuousAlgebraicSystem system = this.piecewiseContinuousAlgebraicSystems.get(i);
      final Matrix u1 = inputs1.get(i);
      final Matrix u2 = inputs2.get(i);
      points.add(system.getDiscontinuousPoint(t1, u1, t2, u2));
    }
    return points;
  }

  /**
   * 指定された区間内([(t1,state1,inputs1),(t2,state2,inputs2)]の不連続点の時刻を返します。
   * 
   * @param t1 不連続点の前の時刻
   * @param states1 不連続点の前の状態
   * @param inputs1 不連続点の前の入力
   * @param t2 不連続点の後の時刻
   * @param states2 不連続点の後の状態
   * @param inputs2 不連続点の後の入力
   * @return 指定された区間内([(t1,x1,inputs1),(t2,x2,inputs2)]の不連続点の時刻
   * @exception SolverStopException ソルバーが停止された場合
   */
  @SuppressWarnings("boxing")
  private List<Double> getDiscontinuousPoints(double t1, List<Matrix> states1, final List<Matrix> inputs1, double t2, List<Matrix> states2, final List<Matrix> inputs2) throws SolverStopException {
File Line
org/mklab/tool/control/system/AdjacencyMatrix.java 2437
org/mklab/tool/control/system/AdjacencyMatrix.java 2477
  public LinearSystem getLinearSystem(final boolean requiringReachableSubSystem) {
    final AdjacencyMatrix allSystem = getLinearSystemFromInputToOutput(requiringReachableSubSystem);

    final int[] stateSizes = allSystem.getStateSizes();
    int stateSize = 0;
    for (int i = 0; i < stateSizes.length; i++) {
      stateSize += stateSizes[i];
    }

    final int inputSize = allSystem.getInputSize();
    final int outputSize = allSystem.getOutputSize();

    final Matrix a = allSystem.createNumericalA(stateSizes, stateSize);
    final Matrix b = allSystem.createNumericalB(stateSizes, stateSize, inputSize);
    final Matrix c = allSystem.createNumericalC(stateSizes, stateSize, outputSize);
    final Matrix d = allSystem.createNumericalD(inputSize, outputSize);
    final Matrix e = allSystem.createNumericalE(stateSizes, stateSize);
File Line
org/mklab/tool/control/system/discontinuous/RateLimiter.java 185
org/mklab/tool/control/system/discontinuous/Saturation.java 137
  }

  /**
   * @see org.mklab.nfc.ode.PiecewiseContinuousAlgebraicSystem#getDiscontinuousPoint(double, org.mklab.nfc.matrix.Matrix, double, org.mklab.nfc.matrix.Matrix)
   */
  @SuppressWarnings("boxing")
  public double getDiscontinuousPoint(final double t1, final Matrix u1, final double t2, final Matrix u2) {
    final List<Integer> pieces1 = getPiece(t1, u1);
    final List<Integer> pieces2 = getPiece(t2, u2);
    if (pieces1.equals(pieces2)) {
      return Double.NaN;
    }

    final int number = PiecewiseUtil.getDistinctPiece(pieces1, pieces2);
    final int piece1 = pieces1.get(number - 1);
    final int piece2 = pieces2.get(number - 1);

    final double uu1 = ((DoubleMatrix)u1).getDoubleElement(number, 1);
File Line
org/mklab/tool/control/system/BlockSystem.java 1246
org/mklab/tool/control/system/BlockSystem.java 1267
          final int output = firstColumn + j;
          matrix[input][output] = system;
          setupSourceSink(system, input + 1, output + 1, sourceNodes, sinkNodes);
        }
      }

      for (int i = inputNodeSize; i < blockSize; i++) {
        for (int j = 0; j < blockSize; j++) {
          final SystemOperator system = blockMatrix[i][j + 1];
          final int input = firstColumn - 1 + i;
          final int output = firstColumn + j;
          matrix[input][output] = system;
          setupSourceSink(system, input + 1, output + 1, sourceNodes, sinkNodes);
        }
      }
    } else {
File Line
org/mklab/tool/control/system/discrete/UserDefinedDiscreteStaticSystem.java 75
org/mklab/tool/control/system/source/UserDefinedDiscreteSource.java 58
  }

  /**
   * @see org.mklab.tool.control.system.discrete.BaseDiscreteStaticSystem#outputEquation(int)
   */
  @Override
  public Matrix outputEquation(int k) throws SolverStopException {
    try {
      return (Matrix)this.outputFunction.invoke(this.obj, Integer.valueOf(k));
    } catch (IllegalArgumentException e) {
      throw new SolverStopException(e);
    } catch (IllegalAccessException e) {
      throw new SolverStopException(e);
    } catch (InvocationTargetException e) {
      throw new SolverStopException(e.getTargetException());
    }
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setSystemClass(java.lang.Class)
   */
  public void setSystemClass(final Class<?> klass) {
    this.systemKlass = klass;
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#getSystemClass()
   */
  public Class<?> getSystemClass() {
    return this.systemKlass;
  }

  /**
   * システムの出力方程式を定義したメソッドを設定します。
   * 
   * @param method システムの出力方程式を定義したメソッド
   * @throws SecurityException メソッドにアクセスする権利が無い場合
   */
  public void setOutputFunction(final Method method) throws SecurityException {
File Line
org/mklab/tool/control/util/Bench.java 355
org/mklab/tool/control/util/Bench2.java 114
    ode(1.0);
    ts.setElement(6, timer.getElapsedTime());
    System.out.print("   " + format(ts.getDoubleElement(6))); //$NON-NLS-1$

    // merit
    double merit = (((DoubleMatrix)this.js5.divideElementWise(ts.getSubVector(1, 6))).powerElementWise(1.0 / 6)).product().doubleValue();
    ts.setElement(7, merit);
    System.out.print("   " + format(ts.getDoubleElement(7))); //$NON-NLS-1$

    /*
     * System.out.println(""); System.out.println(""); System.out.println("");
     * System.out.println(""); System.out.println("
     * **************************************************************");
     * System.out.println(" * あたなた計算機(機種、OS、コンパイラ)のベンチマーク結果を *");
     * System.out.println(" * *"); System.out.println(" * matx-info@matx.org
     * *"); System.out.println(" * *"); System.out.println(" *
     * まで連絡して下さい。ベンチマークの比較表に追加します。 *"); System.out.println("
     * **************************************************************");
     * System.out.println(""); System.out.println("");
     */

    Pause.pause();

    MatxList yours = new MatxList(new Object[] {Messages.getString("Bench.406"), Messages.getString("Bench.407"), ts}); //$NON-NLS-1$ //$NON-NLS-2$
File Line
org/mklab/tool/control/Dimpulse.java 277
org/mklab/tool/control/Dinitial.java 246
org/mklab/tool/control/Dlsim.java 136
org/mklab/tool/control/Initial.java 252
org/mklab/tool/control/Step.java 342
    List<Matrix> yx = dimpulse(A, B, C, D, inputNumber, seriesSize);
    DoubleMatrix Y = (DoubleMatrix)yx.get(0);
    DoubleMatrix X = (DoubleMatrix)yx.get(1);

    int outputSize = C.getRowSize();
    String[] yy = new String[outputSize];
    for (int i = 1; i <= outputSize; i++) {
      if (outputSize == 1) {
        yy[i - 1] = "y";
      } else {
        yy[i - 1] = "y" + i;
      }
    }

    gnuplot.createCanvas(2, 1);
    Canvas canvas1 = gnuplot.getCanvas(0, 0);
    canvas1.setGridVisible(true);
    canvas1.setXLabel("k");
File Line
org/mklab/tool/control/system/AdjacencyMatrix.java 1804
org/mklab/tool/control/system/AdjacencyMatrix.java 1860
org/mklab/tool/control/system/AdjacencyMatrix.java 1916
  private AdjacencyMatrix sortIntegratorLower() {
    final SystemOperator[][] matrix = AdjacencyMatrixUtil.createClone(this.elements);
    final AdjacencyMatrix ans = new AdjacencyMatrix(matrix);
    ans.setInputNodes(this.inputNodes);
    ans.setSourceNodes(this.sourceNodes);
    ans.setOutputNodes(this.outputNodes);
    ans.setSinkNodes(this.sinkNodes);
    ans.setInputPortTags(this.inputPortTags);
    ans.setOutputPortTags(this.outputPortTags);
    ans.setRequiringLinearSystem(this.requiringLinearSystem);
    ans.setRequiringDescriptor(this.requiringDescriptor);
    ans.setRequiringPrimitiveExpression(this.requiringPrimitiveExpression);

    final int inputNodeSize = ans.inputNodes.size();
    final int numberOfIntegrator = ans.getIntegratorOrUnitDelaySystemSize();
File Line
org/mklab/tool/control/system/continuous/UserDefinedContinuousDynamicSystem.java 149
org/mklab/tool/control/system/source/UserDefinedContinuousSource.java 144
    this.updateFunction.setAccessible(true);
  }

  /**
   * {@inheritDoc}
   */
  public Object getParameterValue(String name) throws NoSuchParameterException {
    return ParameterUtil.getValue(this.systemKlass, name);
  }

  /**
   * {@inheritDoc}
   */
  public Set<String> getParameterNames() throws NoSuchParameterException {
    return ParameterUtil.getParameterNames(this.systemKlass);
  }

  /**
   * {@inheritDoc}
   */
  public void setParameterValue(String name, Object value) throws NoSuchParameterException {
    ParameterUtil.setValue(this.systemKlass, name, value);
  }
   
  /**
   * {@inheritDoc}
   */
  public boolean containParameter(String name) {
    return ParameterUtil.contains(this.systemKlass, name);
  }

  /**
   * {@inheritDoc}
   */
  public void update() throws ParameterException {
    try {
      this.updateFunction.invoke(this.object);
File Line
org/mklab/tool/control/system/discrete/BaseDiscreteDynamicSystem.java 254
org/mklab/tool/control/system/discrete/BaseDiscreteStaticSystem.java 179
    hashCode = 31 * hashCode + (this.state == null ? 0 : this.state.hashCode());
    hashCode = 31 * hashCode + (int)(Double.doubleToLongBits(this.samplingInterval) ^ (Double.doubleToLongBits(this.samplingInterval) >>> 32));
    hashCode = 31 * hashCode + (this.atSamplingPoint ? 1231 : 1237);
    return hashCode;
  }

  /**
   * @see org.mklab.tool.control.system.SystemOperator#equals(java.lang.Object)
   */
  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (!super.equals(o)) {
      return false;
    }
    if (o == null) {
      return false;
    }
    if (o.getClass() != getClass()) {
      return false;
    }
File Line
org/mklab/tool/control/system/continuous/DerivativeSystem.java 37
org/mklab/tool/control/system/continuous/DerivativeSystem.java 56
org/mklab/tool/control/system/continuous/DerivativeSystem.java 71
org/mklab/tool/control/system/discrete/UnitLeadSystem.java 43
org/mklab/tool/control/system/discrete/UnitLeadSystem.java 62
org/mklab/tool/control/system/discrete/UnitLeadSystem.java 77
      super.setInitialState(new DoubleMatrix(size, 1));
      setLinearSystem(LinearSystemFactory.createLinearSystem(new DoubleMatrix(new double[][]{{0,1},{-1,0}}), new DoubleMatrix(new double[][]{{0},{1}}), new DoubleMatrix(new double[][]{{0,1}}), new DoubleMatrix(new double[][]{{0}}), new DoubleMatrix(new double[][]{{1,0},{0,0}})));
    }
File Line
org/mklab/tool/control/DoubleWeierstrassForm.java 233
org/mklab/tool/control/WeierstrassForm.java 402
      DoubleMatrix step11 = new DoubleMatrix(m * n * 2, m * n * 2);
      step11.setSubMatrix(1, n * m, 1, n * m, step10);
      step11.setSubMatrix(1, n * m, n * m + 1, n * m * 2, step7.multiply(-1));
      step11.setSubMatrix(1 + n * m, n * m * 2, 1, n * m, step8.multiply(-1));
      step11.setSubMatrix(n * m + 1, n * m * 2, n * m + 1, n * m * 2, step5);
File Line
org/mklab/tool/control/system/continuous/UserDefinedContinuousStaticSystem.java 131
org/mklab/tool/control/system/source/UserDefinedContinuousSource.java 144
    this.updateFunction.setAccessible(true);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
   */
  public Object getParameterValue(String name) throws NoSuchParameterException {
    return ParameterUtil.getValue(this.systemKlass, name);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#getParameterNames()
   */
  public Set<String> getParameterNames() throws NoSuchParameterException {
    return ParameterUtil.getParameterNames(this.systemKlass);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setParameterValue(java.lang.String, java.lang.Object)
   */
  public void setParameterValue(String name, Object value) throws NoSuchParameterException {
    ParameterUtil.setValue(this.systemKlass, name, value);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#containParameter(java.lang.String)
   */
  public boolean containParameter(String name) {
    return ParameterUtil.contains(this.systemKlass, name);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#update()
   */
  public void update() throws ParameterException {
    try {
      this.updateFunction.invoke(null);
File Line
org/mklab/tool/control/system/discontinuous/Saturation.java 143
org/mklab/tool/control/system/math/RoundingFunction.java 179
  public double getDiscontinuousPoint(final double t1, final Matrix u1, final double t2, final Matrix u2) {
    final List<Integer> pieces1 = getPiece(t1, u1);
    final List<Integer> pieces2 = getPiece(t2, u2);
    if (pieces1.equals(pieces2)) {
      return Double.NaN;
    }

    final int number = PiecewiseUtil.getDistinctPiece(pieces1, pieces2);
    final int piece1 = pieces1.get(number - 1);
    final int piece2 = pieces2.get(number - 1);

    final double uu1 = ((DoubleMatrix)u1).getDoubleElement(number);
    final double uu2 = ((DoubleMatrix)u2).getDoubleElement(number);
File Line
org/mklab/tool/control/Dimpulse.java 281
org/mklab/tool/control/Dstep.java 282
    int outputSize = C.getRowSize();
    String[] yy = new String[outputSize];
    for (int i = 1; i <= outputSize; i++) {
      if (outputSize == 1) {
        yy[i - 1] = "y";
      } else {
        yy[i - 1] = "y" + i;
      }
    }

    gnuplot.createCanvas(2, 1);
    Canvas canvas1 = gnuplot.getCanvas(0, 0);
    canvas1.setGridVisible(true);
    canvas1.setXLabel("k");
    canvas1.setYLabel("y");
    canvas1.plot(DoubleMatrix.series(1, seriesSize, 1), Y, yy);
File Line
org/mklab/tool/control/system/discontinuous/CoulombViscousFriction.java 113
org/mklab/tool/control/system/discontinuous/DeadZone.java 130
org/mklab/tool/control/system/discontinuous/Saturation.java 132
        pieces.add(1);
      }
    }

    return pieces;
  }

  /**
   * @see org.mklab.nfc.ode.PiecewiseContinuousAlgebraicSystem#getDiscontinuousPoint(double, org.mklab.nfc.matrix.Matrix, double, org.mklab.nfc.matrix.Matrix)
   */
  @SuppressWarnings("boxing")
  public double getDiscontinuousPoint(final double t1, final Matrix u1, final double t2, final Matrix u2) {
    final List<Integer> pieces1 = getPiece(t1, u1);
    final List<Integer> pieces2 = getPiece(t2, u2);

    if (pieces1.equals(pieces2)) {
      return Double.NaN;
    }

    final int number = PiecewiseUtil.getDistinctPiece(pieces1, pieces2);
    final int piece1 = pieces1.get(number - 1);
    final int piece2 = pieces2.get(number - 1);

    final boolean fromZeroToOne = piece1 == 0 && piece2 == 1;
File Line
org/mklab/tool/control/system/sampled/BlockPiecewiseSampledDataDynamicSystem.java 341
org/mklab/tool/control/system/sampled/BlockPiecewiseSampledDataStaticSystem.java 193
  private List<Double> getContinuousDiscreteDiscontinuousPoints(double t1, final List<Matrix> inputs1, double t2, final List<Matrix> inputs2) throws SolverStopException {
    final List<Double> points = new ArrayList<>();
    for (int i = 0; i < this.piecewiseContinuousDiscreteAlgebraicSystems.size(); i++) {
      final PiecewiseContinuousDiscreteAlgebraicSystem system = this.piecewiseContinuousDiscreteAlgebraicSystems.get(i);
      final Matrix u1 = inputs1.get(i);
      final Matrix u2 = inputs2.get(i);
      points.add(system.getDiscontinuousPoint(t1, u1, t2, u2));
    }
    return points;
  }

  /**
   * 指定された区間内([(t1,inputs1),(t2,inputs2)]の連続代数システムの不連続点の時刻を返します。
   * 
   * @param t1 不連続点の前の時刻
   * @param inputs1 不連続点の前の入力
   * @param t2 不連続点の後の時刻
   * @param inputs2 不連続点の後の入力
   * @return 指定された区間内([(t1,inputs1),(t2,inputs2)]の不連続点の時刻
   * @throws SolverStopException ソルバーが停止しば場合
   */
  @SuppressWarnings("boxing")
  private List<Double> getContinuousDiscontinuousPoints(double t1, final List<Matrix> inputs1, double t2, final List<Matrix> inputs2) throws SolverStopException {
File Line
org/mklab/tool/graph/gnuplot/Canvas.java 1205
org/mklab/tool/graph/gnuplot/Canvas.java 1301
      if (i == 1 && size == 0) {
        this.plotStrings.clear();
        this.removedPlotStrings.clear();
      }

      if (this.lineVisibles.get(i - 1).booleanValue()) {
        this.plotStrings.add(command);
        this.removedPlotStrings.add(""); //$NON-NLS-1$
      } else {
        this.plotStrings.add(""); //$NON-NLS-1$
        this.removedPlotStrings.add(command);
      }
    }

    File f = new File(dataFile);
    while (!f.exists()) {
      //
    }

    this.gnuplot.redraw();
  }

  /**
   * {@inheritDoc}
   */
  public void plot2D(DoubleMatrix xData, DoubleMatrix yData, String[] names, String[] attribute1, String[] attribute2) {
File Line
org/mklab/tool/graph/mgplot/Mgplot.java 1894
org/mklab/tool/graph/mgplot/Mgplot.java 1922
      command(win, "set size 1.0,1.0"); //$NON-NLS-1$
      command(win, "set origin 0,0"); //$NON-NLS-1$
      command(win, "set multiplot"); //$NON-NLS-1$
      for (int i = 1; i <= MAX_FRAME; i++) {
        String str = size_strings(win, i);
        if (str.length() > 0) {
          out(win, str);
        }
        str = title_strings(win, i);
        if (str.length() > 0) {
          out(win, str);
        }
        str = plot_strings(win, i);
        if (str.length() > 0) {
          out(win, "plot " + str + newLine); //$NON-NLS-1$
          // mgplot_out(win, str + "\n");
        }
      }
File Line
org/mklab/tool/control/Dinitial.java 248
org/mklab/tool/control/Initial.java 254
org/mklab/tool/control/Lsim.java 238
    DoubleMatrix X = (DoubleMatrix)yx.get(1);

    int outputSize = C.getRowSize();
    String[] yy = new String[outputSize];
    for (int i = 1; i <= outputSize; i++) {
      if (outputSize == 1) {
        yy[i - 1] = "y";
      } else {
        yy[i - 1] = "y" + i;
      }
    }

    gnuplot.createCanvas(2, 1);
    Canvas canvas1 = gnuplot.getCanvas(0, 0);
    canvas1.setGridVisible(true);
    canvas1.setXLabel("t [sec]");
    canvas1.setYLabel("y");
    canvas1.plot(T, Y, yy);
File Line
org/mklab/tool/control/DoubleWeierstrassForm.java 240
org/mklab/tool/control/WeierstrassForm.java 408
      DoubleMatrix step12 = new DoubleMatrix(m * n * 2, 1);
      for (int i = 0; i < n; i++) {
        step12.setSubMatrix(1 + i * m, (1 + i) * m, 1, 1, E12.getColumnVector(1 + i).multiply(-1));
      }
      for (int i = 0; i < n; i++) {
        step12.setSubMatrix(1 + (i + n) * m, (1 + i + n) * m, 1, 1, A12.getColumnVector(1 + i).multiply(-1));
      }
File Line
org/mklab/tool/control/ImproperLinearSystem.java 328
org/mklab/tool/control/ProperLinearSystem.java 422
      if (withInputOutput) {
        if (isContinuous()) {
          if (getSubSystemSize() == 1) {
            string.append("    "); //$NON-NLS-1$
          } else {
            string.append("  "); //$NON-NLS-1$
          }
        }

        string.append("[" + symbolicOutput[row] + "]"); //$NON-NLS-1$ //$NON-NLS-2$
        if (row == getOutputPortSize() / 2) {
          if (isContinuous()) {
            string.append("(t)="); //$NON-NLS-1$
          } else {
            string.append("(k)  ="); //$NON-NLS-1$
          }
        } else {
          if (isContinuous()) {
            string.append("    "); //$NON-NLS-1$
          } else {
            string.append("  "); //$NON-NLS-1$
File Line
org/mklab/tool/control/WeierstrassForm.java 107
org/mklab/tool/control/WeierstrassForm.java 184
org/mklab/tool/control/WeierstrassForm.java 198
        NumericalScalar<?> q1e1 = tE.getElement(j, j + 1);
        NumericalScalar<?> q1e2 = tE.getElement(j + 1, j + 1);
        NumericalMatrix<?> Q1 = givens(q1e1, q1e2, tolerance);
        this.TL.setSubMatrix(j, j + 1, 1, this.TL.getColumnSize(), Q1.multiply(this.TL.getSubMatrix(j, j + 1, 1, this.TL.getColumnSize())));
        tE.setSubMatrix(j, j + 1, 1, tE.getColumnSize(), Q1.multiply(tE.getSubMatrix(j, j + 1, 1, tE.getColumnSize())));
File Line
org/mklab/tool/control/system/sink/UserDefinedContinuousSink.java 86
org/mklab/tool/control/system/sink/UserDefinedDiscreteSink.java 86
org/mklab/tool/control/system/source/UserDefinedContinuousSource.java 84
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setSystemClass(java.lang.Class)
   */
  public void setSystemClass(final Class<?> klass) {
    this.systemKlass = klass;
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#getSystemClass()
   */
  public Class<?> getSystemClass() {
    return this.systemKlass;
  }

  /**
   * システムの出力方程式を定義したメソッドを設定します。
   * 
   * @param method システムの出力方程式を定義したメソッド
   * @throws SecurityException メソッドにアクセスする権利が無い場合
   */
  public void setOutputFunction(Method method) throws SecurityException {
    this.outputFunction = method;
    this.outputFunction.setAccessible(true);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setInitializeFunction(java.lang.reflect.Method)
   */
  public void setInitializeFunction(final Method method) throws SecurityException {
    this.initializeFunction = method;
    this.initializeFunction.setAccessible(true);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setUpdateFunction(java.lang.reflect.Method)
   */
  public void setUpdateFunction(final Method method) throws SecurityException {
    this.updateFunction = method;
    this.updateFunction.setAccessible(true);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
   */
  public Object getParameterValue(String name) throws NoSuchParameterException {
File Line
org/mklab/tool/graph/mgplot/Mgplot.java 615
org/mklab/tool/graph/mgplot/Mgplot.java 754
    for (int i = 1; i <= Y.getRowSize(); i++) {
      String tit;
      if (i <= titles.size()) {
        tit = titles.get(i - 1);
      } else {
        tit = "data-" + (num + 1) + "-" + i; //$NON-NLS-1$ //$NON-NLS-2$
      }

      String cmd1;
      if (i <= cmds1.size()) {
        cmd1 = cmds1.get(i - 1);
      } else {
        cmd1 = ""; //$NON-NLS-1$
      }

      String cmd2;
      if (i <= cmds2.size()) {
        cmd2 = cmds2.get(i - 1);
      } else {
        cmd2 = ""; //$NON-NLS-1$
      }

      String str = "'" + datafile + "' u 0:" + i + " " + cmd1 + " t '" + tit + "' " + cmd2; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
File Line
org/mklab/tool/control/ImproperLinearSystem.java 223
org/mklab/tool/control/ProperLinearSystem.java 235
    for (int i = 0; i < this.getStateSize() + 1; i++) {
      pw.print(aString[i]);
      pw.print("|"); //$NON-NLS-1$
      pw.println(bString[i]);
    }

    for (int i = 0; i < aString[0].length(); i++) {
      pw.print("-"); //$NON-NLS-1$
    }

    pw.print("+"); //$NON-NLS-1$

    for (int i = 0; i < bString[0].length(); i++) {
      pw.print("-"); //$NON-NLS-1$
    }

    pw.println(""); //$NON-NLS-1$

    for (int i = 0; i < this.getOutputSize() + 1; i++) {
File Line
org/mklab/tool/control/Ramp.java 36
org/mklab/tool/control/Step.java 34
public class Ramp {

  /**
   * メインメソッド
   * 
   * @param args コマンドライン引数
   * @throws IOException キーボードから入力できない場合
   */
  public static void main(String[] args) throws IOException {
    Polynomial s = new Polynomial("s"); //$NON-NLS-1$
    RationalPolynomial g1 = new RationalPolynomial(1);
    RationalPolynomial g2 = new Polynomial(1).divide(s.add(1));
    RationalPolynomial g = g1.multiply(g2);
    g.print();
    DoubleMatrix T = LinearlySpacedVector.create(0, 2, 100);
    Gnuplot gp = plot(g, T);
    try {
      Pause.pause();
    } finally {
      gp.close();
    }
  }

  /**
   * 連続時間システム
   * 
   * <pre><code>
   * 
   * . x = Ax + Bu y = Cx + Du
   * 
   * </code></pre>
   * 
   * の <code>inputNumber</code> 番目の入力に単位ランプ入力が加えられた 場合のランプ応答を求めます。
   * 
   * <p>もし <code>inputNumber = 0</code>なら、 <pre><code>
   * 
   * [[Y for 1st input] [[X for 1st input] [Y for 2nd input] [X for 2nd input] [...............] [...............] [Y for m'th input]] と [Y for m'th input]].
   * 
   * </code></pre> を返します。
   * 
   * @param A A行列
   * @param B B行列
   * @param C C行列
   * @param D D行列
   * @param inputNumber 入力番号
   * @param T 時刻の列(等間隔)
   * @return {YY, XX} (出力と状態の応答) response
   */
  public static List<Matrix> ramp(Matrix A, Matrix B, Matrix C, Matrix D, int inputNumber, Matrix T) {
File Line
org/mklab/tool/control/system/discontinuous/CoulombViscousFriction.java 115
org/mklab/tool/control/system/discontinuous/DeadZone.java 132
org/mklab/tool/control/system/discontinuous/Quantizer.java 94
org/mklab/tool/control/system/discontinuous/Saturation.java 134
    }

    return pieces;
  }

  /**
   * @see org.mklab.nfc.ode.PiecewiseContinuousAlgebraicSystem#getDiscontinuousPoint(double, org.mklab.nfc.matrix.Matrix, double, org.mklab.nfc.matrix.Matrix)
   */
  @SuppressWarnings("boxing")
  public double getDiscontinuousPoint(final double t1, final Matrix u1, final double t2, final Matrix u2) {
    final List<Integer> pieces1 = getPiece(t1, u1);
    final List<Integer> pieces2 = getPiece(t2, u2);

    if (pieces1.equals(pieces2)) {
      return Double.NaN;
    }

    final int number = PiecewiseUtil.getDistinctPiece(pieces1, pieces2);
    final int piece1 = pieces1.get(number - 1);
    final int piece2 = pieces2.get(number - 1);
File Line
org/mklab/tool/graph/gnuplot/Canvas.java 1332
org/mklab/tool/graph/gnuplot/Canvas.java 1413
    final int ySize = zData.getColumnSize();

    setLineSize(1);
    String dataFile = getDataFilePath(0);

    try(final PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(dataFile)))) {
      for (int i = 1; i <= xSize; i++) {
        for (int j = 1; j <= ySize; j++) {
          pw.println("" + xData.getDoubleElement(i, j) + " " + yData.getDoubleElement(i, j) + " " + zData.getDoubleElement(i, j)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        }
        pw.println(""); //$NON-NLS-1$
File Line
org/mklab/tool/graph/mgplot/Mgplot.java 2016
org/mklab/tool/graph/mgplot/Mgplot.java 2113
  public static void semilogx(int win, DoubleMatrix X, DoubleMatrix Y, List<String> titles, List<String> cmds1, List<String> cmds2) {
    IntMatrix idx = X.getColumnVector(1).compareElementWise(".==", 0).find(); //$NON-NLS-1$
    if (idx.length() != 0) {
      X.setSubMatrix(idx, 1, DoubleMatrix.ones(idx.length(), 1).multiply(DoubleNumberUtil.EPS));
    }

    grid(win, true);
    logMode(win, multiplot(win), 1);
File Line
org/mklab/tool/graph/mgplot/Mgplot.java 2210
org/mklab/tool/graph/mgplot/Mgplot.java 2307
  public static void semilogy(int win, DoubleMatrix X, DoubleMatrix Y, List<String> titles, List<String> cmds1, List<String> cmds2) {
    IntMatrix idx = Y.getColumnVector(1).compareElementWise(".==", 0).find(); //$NON-NLS-1$
    if (idx.length() != 0) {
      Y.setSubMatrix(idx, 1, DoubleMatrix.ones(idx.length(), 1).multiply(DoubleNumberUtil.EPS));
    }

    grid(win, true);
    logMode(win, multiplot(win), 2);
File Line
org/mklab/tool/control/Dinitial.java 248
org/mklab/tool/control/Initial.java 254
org/mklab/tool/control/Ramp.java 346
    DoubleMatrix X = (DoubleMatrix)yx.get(1);

    int outputSize = C.getRowSize();
    String[] yy = new String[outputSize];
    for (int i = 1; i <= outputSize; i++) {
      if (outputSize == 1) {
        yy[i - 1] = "y";
      } else {
        yy[i - 1] = "y" + i;
      }
    }

    gnuplot.createCanvas(2, 1);
    Canvas canvas1 = gnuplot.getCanvas(0, 0);
    canvas1.setGridVisible(true);
    canvas1.setXLabel("t [sec]");
    canvas1.setYLabel("y");
    canvas1.plot(T, Y, yy);
File Line
org/mklab/tool/control/DoubleWeierstrassForm.java 252
org/mklab/tool/control/WeierstrassForm.java 419
      DoubleMatrix BDL12 = A12.createZero();

      for (int i = 0; i < n; i++) {
        BDR12.setColumnVector(1 + i, step13.getSubMatrix(1 + i * m, (1 + i) * m, 1, 1));
      }

      for (int i = 0; i < n; i++) {
        BDL12.setColumnVector(1 + i, step13.getSubMatrix(1 + (i + n) * m, (1 + i + n) * m, 1, 1));
      }

      this.BDR = A.createUnit();
File Line
org/mklab/tool/control/Obsg.java 77
org/mklab/tool/control/Obsg.java 140
    final Matrix L = Pplace.pplace(Ab11.transpose(), Ab21.transpose().unaryMinus(), poles).transpose().unaryMinus();

    final Matrix U = L.createUnit(r).appendRight(L.unaryMinus()).multiply(Tinv);
    final Matrix Ah = Ab11.subtract(L.multiply(Ab21));
    final Matrix Bh = Ah.multiply(L).add(Ab12).subtract(L.multiply(Ab22));
    final Matrix Ch = T.multiply(T.createUnit(r).appendDown(T.createZero(p, r)));
    final Matrix Dh = T.multiply(L.appendDown(A.createUnit(p)));
File Line
org/mklab/tool/control/system/AdjacencyMatrix.java 2021
org/mklab/tool/control/system/AdjacencyMatrix.java 2153
    Arrays.sort(sortedInsertingNodes);

    final Map<Integer, String> originalInputPortTags = new TreeMap<>();
    for (final Integer key : this.inputPortTags.keySet()) {
      originalInputPortTags.put(key, this.inputPortTags.get(key));
    }

    final Map<Integer, String> newInputPortTags = new TreeMap<>();

    for (int i = 0; i < this.inputNodes.size(); i++) {
      final int inputNode = this.inputNodes.get(i);
      int shiftSize = 0;
      for (int j = 0; j < sortedInsertingNodes.length; j++) {
File Line
org/mklab/tool/control/system/AdjacencyMatrix.java 2087
org/mklab/tool/control/system/AdjacencyMatrix.java 2219
    Arrays.sort(sortedInsertingNodes);

    final Map<Integer, String> originalOutputPortTags = new TreeMap<>();
    for (final Integer key : this.outputPortTags.keySet()) {
      originalOutputPortTags.put(key, this.outputPortTags.get(key));
    }

    final Map<Integer, String> newOutputPortTags = new TreeMap<>();

    for (int i = 0; i < this.outputNodes.size(); i++) {
      final int outputNode = this.outputNodes.get(i);
      int shiftSize = 0;
      for (int j = 0; j < sortedInsertingNodes.length; j++) {
File Line
org/mklab/tool/control/system/discontinuous/CoulombViscousFriction.java 118
org/mklab/tool/control/system/discontinuous/DeadZone.java 135
org/mklab/tool/control/system/discontinuous/RateLimiter.java 185
  }

  /**
   * @see org.mklab.nfc.ode.PiecewiseContinuousAlgebraicSystem#getDiscontinuousPoint(double, org.mklab.nfc.matrix.Matrix, double, org.mklab.nfc.matrix.Matrix)
   */
  @SuppressWarnings("boxing")
  public double getDiscontinuousPoint(final double t1, final Matrix u1, final double t2, final Matrix u2) {
    final List<Integer> pieces1 = getPiece(t1, u1);
    final List<Integer> pieces2 = getPiece(t2, u2);

    if (pieces1.equals(pieces2)) {
      return Double.NaN;
    }

    final int number = PiecewiseUtil.getDistinctPiece(pieces1, pieces2);
    final int piece1 = pieces1.get(number - 1);
    final int piece2 = pieces2.get(number - 1);

    final boolean fromZeroToOne = piece1 == 0 && piece2 == 1;
File Line
org/mklab/tool/control/system/sink/UserDefinedDiscreteSink.java 126
org/mklab/tool/control/system/source/UserDefinedContinuousSource.java 144
    this.updateFunction.setAccessible(true);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#getParameterValue(java.lang.String)
   */
  public Object getParameterValue(String name) throws NoSuchParameterException {
    return ParameterUtil.getValue(this.systemKlass, name);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#getParameterNames()
   */
  public Set<String> getParameterNames() throws NoSuchParameterException {
    return ParameterUtil.getParameterNames(this.systemKlass);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#setParameterValue(java.lang.String, java.lang.Object)
   */
  public void setParameterValue(String name, Object value) throws NoSuchParameterException {
    ParameterUtil.setValue(this.systemKlass, name, value);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#containParameter(java.lang.String)
   */
  public boolean containParameter(String name) {
    return ParameterUtil.contains(this.systemKlass, name);
  }

  /**
   * @see org.mklab.tool.control.system.UserDefinedSystem#update()
   */
  public void update() throws ParameterException {
    try {
File Line
org/mklab/tool/control/system/AdjacencyMatrix.java 4362
org/mklab/tool/control/system/AdjacencyMatrix.java 4408
    StringBuffer stringBuffer = new StringBuffer();
    final String separator = ","; //$NON-NLS-1$
    stringBuffer.append(" " + separator); //$NON-NLS-1$
    for (int row = 0; row < matrix.length; row++) {
      stringBuffer.append(row % 10 + separator);
    }
    stringBuffer.append(lineseparator);

    for (int row = 0; row < matrix.length; row++) {
      stringBuffer.append(row % 10 + separator);
      for (int col = 0; col < matrix.length; col++) {
        if (matrix[row][col] instanceof ZeroSystem) {
File Line
org/mklab/tool/control/system/continuous/BlockContinuousSystem.java 65
org/mklab/tool/control/system/discrete/BlockDiscreteSystem.java 51
  }

  /**
   * ノードの値を計算します。
   * 
   * @param t 時刻
   * @exception SolverStopException ソルバーが停止された場合
   */
  protected void calcNodeValue(final double t) throws SolverStopException {
    this.time = t;
    calcNodeValue();
  }

  /**
   * {@inheritDoc}
   */
  @Override
  protected Matrix calcOutputOfDirectFeedthroughSystem(final SystemOperator system, final Matrix u) throws SolverStopException {
    if (system instanceof DynamicSystem) {
      final DynamicSystem dSystem = (DynamicSystem)system;
      return dSystem.outputEquation(this.time, dSystem.getState(), u);
    }

    return ((StaticSystem)system).outputEquation(this.time, u);
  }

  /**
   * {@inheritDoc}
   */
  @Override
  protected Matrix calcOutputOfNonDirectFeedthroughSystem(final SystemOperator system) throws SolverStopException {
    if (system == null) throw new NullPointerException();
File Line
org/mklab/tool/control/system/discontinuous/Quantizer.java 97
org/mklab/tool/control/system/discontinuous/RateLimiter.java 185
  }

  /**
   * @see org.mklab.nfc.ode.PiecewiseContinuousAlgebraicSystem#getDiscontinuousPoint(double, org.mklab.nfc.matrix.Matrix, double, org.mklab.nfc.matrix.Matrix)
   */
  @SuppressWarnings("boxing")
  public double getDiscontinuousPoint(final double t1, final Matrix u1, final double t2, final Matrix u2) {
    final List<Integer> pieces1 = getPiece(t1, u1);
    final List<Integer> pieces2 = getPiece(t2, u2);

    if (pieces1.equals(pieces2)) {
      return Double.NaN;
    }

    final int number = PiecewiseUtil.getDistinctPiece(pieces1, pieces2);
    final int piece1 = pieces1.get(number - 1);
    final int piece2 = pieces2.get(number - 1);
File Line
org/mklab/tool/control/system/source/PulseSource.java 198
org/mklab/tool/control/system/source/RampSource.java 141
org/mklab/tool/control/system/source/StepSource.java 141
    if (percentage < this.pulseWidth) {
      return new ArrayList<>(Arrays.asList(new Integer[] {1}));
    }

    return new ArrayList<>(Arrays.asList(new Integer[] {0}));
  }

  /**
   * @see org.mklab.nfc.ode.PiecewiseContinuousAlgebraicSystem#getDiscontinuousPoint(double, org.mklab.nfc.matrix.Matrix, double, org.mklab.nfc.matrix.Matrix)
   */
  public double getDiscontinuousPoint(final double t1, final Matrix u1, final double t2, final Matrix u2) {
    final List<Integer> piece1 = getPiece(t1, u1);
    final List<Integer> piece2 = getPiece(t2, u2);

    if (piece1.equals(piece2)) {
      return Double.NaN;
    }
File Line
org/mklab/tool/signal/Filter.java 106
org/mklab/tool/signal/Filter.java 130
org/mklab/tool/signal/Filter.java 157
            z = (NumericalMatrix<?>)z.getSubMatrix(2, z.getRowSize(), 1, 1).appendDown(a.createZero(1, 1)).add(b2t2.multiply(x.getElement(i)));
          }
        } else {
          for (int i = 1; i <= nx; i++) {
            y.setElement(i, 1, b.getElement(1).multiply(x.getElement(i)).add(z.getElement(1)));
            Matrix tmp1 = z.getSubMatrix(2, z.getRowSize(), 1, 1).appendDown(a.createZero(1, 1));
            Matrix b2t2 = b2t;
            Matrix tmp2 = b2t2.multiply(x.getElement(i));
File Line
org/mklab/tool/control/Dimpulse.java 65
org/mklab/tool/control/Dstep.java 65
      throw new IllegalArgumentException(message);
    }

    Matrix XX, YY;
    if (inputNumber == 0) {
      int inputSize = B.getColumnSize();
      YY = A.createZero(C.getRowSize() * inputSize, seriesSize);
      XX = A.createZero(A.getRowSize() * inputSize, seriesSize);
      for (int i = 1; i <= inputSize; i++) {
        List<Matrix> yx = Dlsim.dlsim(A, B.getColumnVector(i), C, D.getColumnVector(i), A.createOnes(1).appendRight(A.createZero(1, seriesSize - 1)));
File Line
org/mklab/tool/control/Lsim.java 238
org/mklab/tool/control/Ramp.java 346
org/mklab/tool/control/Step.java 344
    int stateSize = A.getRowSize();
    int outputSize = C.getRowSize();

    String[] yy = new String[outputSize];
    for (int i = 1; i <= outputSize; i++) {
      if (outputSize == 1) {
        yy[i - 1] = "y";
      } else {
        yy[i - 1] = "y" + i;
      }
    }

    gnuplot.createCanvas(2, 1);
    Canvas canvas1 = gnuplot.getCanvas(0, 0);
    canvas1.setGridVisible(true);
    canvas1.setXLabel("t [sec]");
    canvas1.setYLabel("y");
    canvas1.plot(T, Y, yy);
File Line
org/mklab/tool/control/Ltifr.java 60
org/mklab/tool/control/Ltifr.java 104
    final NumericalScalar<?> epsilon = unit.getMachineEpsilon();

    for (int i = 1; i <= size; i++) {
      final NumericalScalar<?> s = ss.getElement(i);
      NumericalMatrix<?> sI_A = (NumericalMatrix<?>)(A.createUnit().multiply(s).subtract(A));
      if (sI_A.isFullRank() == false) {
        sI_A = (NumericalMatrix<?>)(A.createUnit().multiply(s.add(epsilon)).subtract(A));
      }

      G.setColumnVectors((i - 1) * inputSize + 1, i * inputSize, sI_A.leftDivide(B));
File Line
org/mklab/tool/control/model/matxbook/MotorContinuousObserver1.java 53
org/mklab/tool/control/model/matxbook/MotorContinuousObserver2.java 24
  @Override
  public Matrix inputOutputEquation(double t, Matrix xx) {
    Matrix x = xx.getSubVector(1, 2);
    Matrix z = xx.getSubVector(3, 3);
    Matrix y = this.motor.outputEquation(t, x);
    Matrix uh = new DoubleMatrix(1, 1);
    Matrix uyh = uh.appendDown(y);
    Matrix xh = this.observer.outputEquation(t, z, uyh);
    Matrix u = this.stateFeedback.outputEquation(t, xh).unaryMinus();
    Matrix uy = u.appendDown(y);