Subtracts a factor elementwise from this one.
@param other The subtrahend.
@throws IllegalArgumentException If the two tensors have different sizes.
432838
public void elemSubtract(Tensor other) {
        checkEqualSize(this, other);
        for (int c = 0; c < this.values.length; c++) {
            subtractValue(c, other.values[c]);
        }
    }
661990
private static BigDecimal doSubtract(final BigDecimal v1, final BigDecimal v2) {
        BigDecimal diff = v1;
        if (v1 != null && v2 != null) {
            diff = v1.subtract(v2);
        } else if (v2 != null) {
            diff = v2.negate();
        }
        return diff;
    }
921768
@NonNull
  public static Term subtract(@NonNull Term left, @NonNull Term right) {
    return new BinaryArithmeticTerm(ArithmeticOperator.DIFFERENCE, left, right);
  }
451433
public static void subtractEquals( DMatrix2 a , DMatrix2 b ) {
        a.a1 -= b.a1;
        a.a2 -= b.a2;
    }
876850
public static void minus(double[] y, double[] x) {
        if (x.length != y.length) {
            throw new IllegalArgumentException(String.format("Arrays have different length: x[%d], y[%d]", x.length, y.length));
        }

        for (int i = 0; i < x.length; i++) {
            y[i] -= x[i];
        }
    }
1157563
@Override
  public Double subtract12(Long arg1, Double arg2) {
    if (arg1 == null || arg2 == null) {
      return Double.NaN;
    } else {
      return arg1.doubleValue() - arg2;
    }
  }
382638
@SuppressWarnings("unchecked")
  public void replaceInplace(final LNGVector<? extends T> other) {
    if (this == other)
      throw new IllegalArgumentException("cannot replace a vector in-place with itself");
    this.elements = (T[]) new Object[other.size()];
    for (int i = 0; i < other.size(); i++)
      this.elements[i] = other.get(i);
    this.size = other.size;
  }
1295574
def Minus(self, other):
    
    return Point(self.x - other.x,
                 self.y - other.y,
                 self.z - other.z)
517392
public Vector2f lerp(Vector2fc other, float t, Vector2f dest) {
        dest.x = x + (other.x() - x) * t;
        dest.y = y + (other.y() - y) * t;
        return dest;
    }
1125668
public void subtract(Vector v)
	{
		x = x - v.x;
		y = y - v.y;
		z = z - v.z;
	}
173947
public void elemDivide(VTensor other) {
        checkEqualSize(this, other);
        for (int c = 0; c < this.size(); c++) {
            divideValue(c, other.getValue(c));
        }
    }
235005
private static void subtractTernaryValues(Vector destination,
                                              TernaryVector source) {
        for (int p : source.positiveDimensions())
            destination.set(p, destination.getValue(p).doubleValue() - 1);
        for (int n : source.negativeDimensions())
            destination.set(n, destination.getValue(n).doubleValue() + 1);
    }
357953
public void set(LongDoubleSortedVector other) {
        this.used = other.used;
        this.indices = LongArrays.copyOf(other.indices);
        this.values = DoubleArrays.copyOf(other.values);
    }
856049
public static Tensor outerProduct(Tensor first, Tensor second) {
    int[] firstDimNums = first.getDimensionNumbers();
    long[] firstKeyOffsets = first.getDimensionOffsets();
    int[] firstSizes = first.getDimensionSizes();
    int[] secondDimNums = second.getDimensionNumbers();
    long[] secondKeyOffsets = second.getDimensionOffsets();
    int[] secondSizes = second.getDimensionSizes();
    
    // Determine the dimensions of the result tensor and compute
    // the mapping between keys of the input tensors and the result. 
    SortedSet<Integer> resultDimSet = Sets.newTreeSet(Ints.asList(firstDimNums));
    resultDimSet.addAll(Ints.asList(secondDimNums));
    int[] resultDims = Ints.toArray(resultDimSet);
    int[] resultSizes = new int[resultDims.length];
    Preconditions.checkArgument(resultDims.length == firstDimNums.length + secondDimNums.length);

    for (int i = 0; i < resultDims.length; i++) {
      int firstIndex = Ints.indexOf(firstDimNums, resultDims[i]);
      if (firstIndex != -1) {
        resultSizes[i] = firstSizes[firstIndex];
      } else {
        int secondIndex = Ints.indexOf(secondDimNums, resultDims[i]);
        resultSizes[i] = secondSizes[secondIndex];
      }
    }
    long[] resultDimOffsets = AbstractTensorBase.computeIndexOffsets(resultSizes);

    long[] firstResultKeyOffsets = new long[firstDimNums.length];
    long[] secondResultKeyOffsets = new long[secondDimNums.length];
    for (int i = 0; i < firstDimNums.length; i++) {
      int resultIndex = Ints.indexOf(resultDims, firstDimNums[i]);
      firstResultKeyOffsets[i] = resultDimOffsets[resultIndex];
    }

    for (int i = 0; i < secondDimNums.length; i++) {
      int resultIndex = Ints.indexOf(resultDims, secondDimNums[i]);
      secondResultKeyOffsets[i] = resultDimOffsets[resultIndex];
    }

    // Merge the keys and values of both tensors using the computed mapping.
    int numKeys = first.size() * second.size();
    long[] resultKeyNums = new long[numKeys];
    double[] resultValues = new double[numKeys];
    int resultIndex = 0;
    int firstNumKeys = first.size();
    int secondNumKeys = second.size();
    for (int i = 0; i < firstNumKeys; i++) {
      long firstCurKeyNum = first.indexToKeyNum(i); 
      long resultKeyNum = AbstractTensorBase.recodeKeyNum(firstCurKeyNum, firstKeyOffsets, firstSizes,
          firstResultKeyOffsets);
      double firstValue = first.getByIndex(i);
      for (int k = 0; k < secondNumKeys; k++) {
        long secondKeyNum = second.indexToKeyNum(k);
        long secondResultKeyNum = AbstractTensorBase.recodeKeyNum(secondKeyNum, secondKeyOffsets, 
            secondSizes, secondResultKeyOffsets);
        
        resultKeyNums[resultIndex] = resultKeyNum + secondResultKeyNum;
        resultValues[resultIndex] = firstValue * second.getByIndex(k);
        resultIndex++;
      }
    }

    Preconditions.checkState(resultIndex == numKeys);
    return SparseTensor.fromUnorderedKeyValuesNoCopy(resultDims, resultSizes, resultKeyNums, resultValues);
  }
1172747
public void product(IntIntVector other) {
        // TODO: Add special case for IntIntDenseVector.
        for (int i=0; i<size; i++) {
            elements[i + start] *= other.get(i);
        }
    }
342776
public void elemMultiply(VTensor other) {
        checkEqualSize(this, other);
        for (int c = 0; c < this.size(); c++) {
            multiplyValue(c, other.getValue(c));
        }
    }
346756
def add_or_subtract!(operator,other)
      if other.is_a? Quantity
        other = other.to(@unit) if other.unit.is_alternative_for?(@unit)

        if @unit.is_equivalent_to? other.unit
          @value = @value.send operator, other.value

          return self
        else
          raise Quantify::Exceptions::InvalidObjectError, "Cannot add or subtract Quantities with different dimensions"
        end
      else
        raise Quantify::Exceptions::InvalidObjectError, "Cannot add or subtract non-Quantity objects"
      end
    end