Divide a factor elementwise from this one.
@param other The divisor.
@throws IllegalArgumentException If the two tensors have different sizes.
173947
public void elemDivide(VTensor other) {
        checkEqualSize(this, other);
        for (int c = 0; c < this.size(); c++) {
            divideValue(c, other.getValue(c));
        }
    }
1093499
private double denseTensorInnerProduct(DenseTensor other) {
    double[] otherValues = other.values;
    int length = values.length;
    Preconditions.checkArgument(otherValues.length == length);
    
    double innerProduct = 0.0;
    for (int i = 0; i < length; i++) {
      innerProduct += values[i] * otherValues[i];
    }
    return innerProduct;
  }
858716
def divide(x1, x2, output_shape=None, name=None):
  
  output_shape = convert_to_shape(output_shape)
  if not isinstance(x2, Tensor):
    return ScalarMultiplyOperation(x1, 1.0 / x2).outputs[0]
  with tf.name_scope(name, default_name="divide"):
    x1, x2 = binary_arguments_to_tensors(x1, x2)
    return multiply(x1, reciprocal(x2), output_shape=output_shape)
849859
long divide(long v, MutableBigInteger quotient) {
        if (v == 0)
            throw new ArithmeticException("BigInteger divide by zero");

        // Dividend is zero
        if (intLen == 0) {
            quotient.intLen = quotient.offset = 0;
            return 0;
        }
        if (v < 0)
            v = -v;

        int d = (int)(v >>> 32);
        quotient.clear();
        // Special case on word divisor
        if (d == 0)
            return divideOneWord((int)v, quotient) & LONG_MASK;
        else {
            return divideLongMagnitude(v, quotient).toLong();
        }
    }
1043693
public FloatPoint Divide(FloatPoint point1, FloatPoint point2) {
        FloatPoint result = new FloatPoint(point1);
        result.Divide(point2);
        return result;
    }
778587
protected static final SparseTensor elementwiseMultiplyNaive(SparseTensor big, Tensor small) {
    // Compute a mapping from keyNums of big to keyNums of small.
    int[] bigDimensions = big.getDimensionNumbers();
    int[] smallDimensions = small.getDimensionNumbers();
    int[] bigDimensionSizes = big.getDimensionSizes();
    int smallDimensionInd = smallDimensions.length - 1;
    int bigDimensionInd = bigDimensions.length - 1;
    // divisors, modulos and multipliers store the mapping from
    // bigKeyNum to
    // smallKeyNum.
    // They contain a series of division, modulo and multiplication
    // operations
    // whose results are added to get a smallKeyNum.
    long[] divisors = new long[smallDimensions.length];
    long[] modulos = new long[smallDimensions.length];
    long[] multipliers = new long[smallDimensions.length];
    int divisorInd = 0;
    long divisor = 1;
    long multiplier = 1;
    long modulo = 1;
    while (bigDimensionInd >= 0 && smallDimensionInd >= 0) {
      while (bigDimensions[bigDimensionInd] != smallDimensions[smallDimensionInd]) {
        divisor *= bigDimensionSizes[bigDimensionInd];
        bigDimensionInd--;
      }
      divisors[divisorInd] = divisor;

      modulo = 1;
      while (bigDimensionInd >= 0 && smallDimensionInd >= 0 &&
          bigDimensions[bigDimensionInd] == smallDimensions[smallDimensionInd]) {
        divisor *= bigDimensionSizes[bigDimensionInd];
        modulo *= bigDimensionSizes[bigDimensionInd];
        bigDimensionInd--;
        smallDimensionInd--;
      }
      modulos[divisorInd] = modulo;
      multipliers[divisorInd] = multiplier;
      divisorInd++;
      multiplier *= modulo;
    }

    // The result tensor is no larger than the larger (superset of
    // dimensions)
    // tensor.
    long[] resultKeyInts = new long[big.size()];
    double[] resultValues = new double[big.size()];
    // How many result values have been filled so far.
    int resultInd = 0;

    long bigKeyNum, smallKeyNum;
    double value;
    int numElements = big.size();
    for (int bigInd = 0; bigInd < numElements; bigInd++) {
      bigKeyNum = big.indexToKeyNum(bigInd);
      // map bigKeyNum to a smallKeyNum
      smallKeyNum = 0;
      for (int i = 0; i < divisorInd; i++) {
        smallKeyNum += ((bigKeyNum / divisors[i]) % modulos[i]) * multipliers[i];
      }
      value = small.get(smallKeyNum);

      if (value != 0.0) {
        resultKeyInts[resultInd] = bigKeyNum;
        resultValues[resultInd] = value * big.getByIndex(bigInd);
        resultInd++;
      }
    }

    return resizeIntoTable(big.getDimensionNumbers(), big.getDimensionSizes(), resultKeyInts,
        resultValues, resultInd);
  }
358515
public IntIntSortedVector getSum(IntIntVector other) {
        IntIntSortedVector sum = new IntIntSortedVector(this);
        sum.add(other);
        return sum;
    }
21410
public void product(LongIntVector other) {
        // TODO: Add special case for LongIntDenseVector.
        for (int i=0; i<size; i++) {
            elements[i + start] *= other.get(i);
        }
    }
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);
  }
374699
public void setTo(Permutation other) {

        if (this.values.length != other.values.length)
            throw new IllegalArgumentException("permutations are different size");

        for (int i = 0; i < this.values.length; i++) {
            this.values[i] = other.values[i];
        }
    }
357786
public void elemAdd(Tensor other) {
        checkEqualSize(this, other);
        for (int c = 0; c < this.values.length; c++) {
            addValue(c, other.values[c]);
        }
    }
227126
def **(other)
      case other
      when Integer
        if other > 0
          num = @numerator**other
          den = @denominator**other
          self.class.new(num, den)
        elsif other < 0
          num = @denominator**-other
          den = @numerator**-other
          self.class.new(num, den)
        elsif other.zero?
          unity
        end
      else
        x, y = other.coerce(self)
        x**y
      end
    end
784191
public void set(IntFloatSortedVector other) {
        this.used = other.used;
        this.indices = IntArrays.copyOf(other.indices);
        this.values = FloatArrays.copyOf(other.values);
    }
124417
public SDVariable mmul(String name, SDVariable other){
        return sameDiff.mmul(name, this, other);
    }
165125
public void product(LongIntVector other) {
        // TODO: Add special case for LongIntDenseVector.
        for (int i=0; i<idxAfterLast; i++) {
            elements[i] *= other.get(i);
        }
    }
1186795
public void product(LongDoubleVector other) {
        // TODO: Add special case for LongDoubleDenseVector.
        for (int i=0; i<size; i++) {
            elements[i + start] *= other.get(i);
        }
    }
1069892
public void product(IntDoubleVector other) {
        // TODO: Add special case for IntDoubleDenseVector.
        for (int i=0; i<idxAfterLast; i++) {
            elements[i] *= other.get(i);
        }
    }