Scalar subtraction: {@code out = this - scalar}<br>
Output variable has the same shape as the input variable

@param varName Output variable name
@param scalar  Scalar for operation
@return Output variable
355510
public SDVariable sub(String varName, double scalar) {
        val result = sameDiff.f().sub(this, scalar);
        return sameDiff.updateVariableNameAndReference(result, varName);
    }
1295373
public SDVariable scalarMax(SDVariable in, Number value) {
        return scalarMax(null, in, value);
    }
631294
private Variable createVariableInferred(TokenList.Token t0, Variable variableRight) {
        Variable result;

        if( t0.getType() == Type.WORD ) {
            switch( variableRight.getType()) {
                case MATRIX:
                    alias(new DMatrixRMaj(1,1),t0.getWord());
                    break;

                case SCALAR:
                    if( variableRight instanceof VariableInteger) {
                        alias(0,t0.getWord());
                    } else {
                        alias(1.0,t0.getWord());
                    }
                    break;

                case INTEGER_SEQUENCE:
                    alias((IntegerSequence)null,t0.getWord());
                    break;

                default:
                    throw new RuntimeException("Type not supported for assignment: "+variableRight.getType());
            }

            result = variables.get(t0.getWord());
        } else {
            result = t0.getVariable();
        }
        return result;
    }
311682
public DifferentialFunction getVariableOutputFunction(String variableName) {
        Preconditions.checkState(variables.containsKey(variableName), "No variable with name \"%s\" found in graph", variableName);
        if(variables.get(variableName).getOutputOfOp() == null)
            return null;
        return ops.get(variables.get(variableName).getOutputOfOp()).getOp();
    }
1225684
@Deprecated
    public void putShapeForVarName(String varName, long[] shape) {
        if (shape == null) {
            throw new ND4JIllegalStateException("Shape must not be null!");
        }

        if (variableNameToShape.containsKey(varName)) {
            throw new ND4JIllegalStateException("Shape for " + varName + " already exists!");
        }

        variableNameToShape.put(varName, shape);
    }
1258947
static String replacementTypeVarName(Name name, Set<String> superTypeVars) {
    String baseName = name.toString();
    int typeVarNum = 2;

    Matcher matcher = TRAILING_DIGIT_EXTRACTOR.matcher(name);
    if (matcher.matches()) {
      baseName = matcher.group(1);
      typeVarNum = Integer.parseInt(matcher.group(2)) + 1;
    }

    String replacementName;
    while (superTypeVars.contains(replacementName = baseName + typeVarNum)) {
      typeVarNum++;
    }

    return replacementName;
  }
155762
public SDVariable scalarMin(String name, SDVariable in, Number value) {
        validateNumerical("min", in);
        SDVariable ret = f().scalarMin(in, value);
        return updateVariableNameAndReference(ret, name);
    }
606874
public static final VariableNumMap singleton(int varNum, String varName, Variable variable) {
    return new VariableNumMap(new int[] {varNum}, new String[] {varName}, new Variable[] {variable});
  }
955768
final public void println(float v)
  {
    String s = String.valueOf(v);
    
    write(s, 0, s.length());
    println();
  }
432043
public SDVariable addVariable(SDVariable variable) {
        Preconditions.checkState(variable.getSameDiff() == this, "Samediff instance must be the same.");

        if (variables.containsKey(variable.getVarName()) && !variables.get(variable.getVarName()).getVariable().equals(variable)) {
            throw new IllegalArgumentException("Variable already found with variable opName " + variable.getVarName());
        }

        Preconditions.checkState(variable.getSameDiff() == this, "Same diff instance for variable must be the same!");
        variables.put(variable.getVarName(), Variable.builder().name(variable.getVarName()).variable(variable).build());
        return variable;
    }
186373
public static SoyValue minus(SoyValue operand0, SoyValue operand1) {
    if (operand0 instanceof IntegerData && operand1 instanceof IntegerData) {
      return IntegerData.forValue(operand0.longValue() - operand1.longValue());
    } else {
      return FloatData.forValue(operand0.numberValue() - operand1.numberValue());
    }
  }
1070762
public boolean hasOutputVariable(String name) {
        for (OutputVariable outputVariable : this.outputVariables) {
            if (outputVariable.getName().equals(name)) {
                return true;
            }
        }
        return false;
    }
469734
@Override
  public Double subtract12(Double arg1, Double arg2) {
    if (arg1 == null || arg2 == null) {
      return Double.NaN;
    } else {
      return arg1 - arg2;
    }
  }
527930
public static double var(int[] x) {
        if (x.length < 2) {
            throw new IllegalArgumentException("Array length is less than 2.");
        }

        double sum = 0.0;
        double sumsq = 0.0;
        for (int xi : x) {
            sum += xi;
            sumsq += xi * xi;
        }

        int n = x.length - 1;
        return sumsq / n - (sum / x.length) * (sum / n);
    }
1330552
public int lookupVariableName(String varName) {
        Integer varNoWrapper = varNameToNoMap.get(varName.toUpperCase());
        if (varNoWrapper == null) {
            return -1;
        }
        int varNo = varNoWrapper.intValue();
        return varNo;
    }
493394
public static double sub(float v1, float v2) {
		return sub(Float.toString(v1), Float.toString(v2)).doubleValue();
	}
575644
public static String toIdentityVariableName(String varName) {
	char[] chars = varName.toCharArray();
	long changes = 0;

	StringBuilder rtn = new StringBuilder(chars.length + 2);
	rtn.append("CF");

	for (int i = 0; i < chars.length; i++) {
	    char c = chars[i];
	    if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9')) rtn.append(c);
	    else {
		rtn.append('_');
		changes += (c * (i + 1));
	    }
	}

	return rtn.append(changes).toString();
    }