First scale a supplied steering acceleration, then add it to this steering acceleration.

@param steering the steering acceleration
@param scalar the scalar
@return this steering acceleration for chaining
356604
public SteeringAcceleration<T> mulAdd (SteeringAcceleration<T> steering, float scalar) {
		linear.mulAdd(steering.linear, scalar);
		angular += steering.angular * scalar;
		return this;
	}
504422
def addScalarBar3D(
        self,
        pos=(0, 0, 0),
        normal=(0, 0, 1),
        sx=0.1,
        sy=2,
        nlabels=9,
        ncols=256,
        cmap=None,
        c="k",
        alpha=1,
    ):
        
        # book it, it will be created by Plotter.show() later
        self.scalarbar = [pos, normal, sx, sy, nlabels, ncols, cmap, c, alpha]
        return self
1106872
public static ComplexNumber Add(ComplexNumber z1, double scalar) {
        return new ComplexNumber(z1.real + scalar, z1.imaginary);
    }
729754
public void scale(float value) {
		r *= value;
		g *= value;
		b *= value;
		a *= value;
	}
1086938
public Vector3f mul(float scalar, Vector3f dest) {
        dest.x = x * scalar;
        dest.y = y * scalar;
        dest.z = z * scalar;
        return dest;
    }
275904
@Override
    public ChronoPeriod multipliedBy(int scalar) {
        if (this.isZero() || scalar == 1) {
            return this;
        }
        return new ChronoPeriodImpl(
                chrono,
                Math.multiplyExact(years, scalar),
                Math.multiplyExact(months, scalar),
                Math.multiplyExact(days, scalar));
    }
719628
@SuppressWarnings("unchecked")
  public static <E, C extends Counter<E>> C scale(C c, double s) {
    C scaled = (C) c.getFactory().create();
    for (E key : c.keySet()) {
      scaled.setCount(key, c.getCount(key) * s);
    }
    return scaled;
  }
1124521
public Vector2i mul(int scalar, Vector2i dest) {
        dest.x = x * scalar;
        dest.y = y * scalar;
        return dest;
    }
488452
function (scale) {
            scale = me.Math.clamp(scale, 0, 1);
            this.glArray[0] *= scale;
            this.glArray[1] *= scale;
            this.glArray[2] *= scale;

            return this;
        }
872277
public static FloatBinding scalb(final float f, final ObservableIntegerValue scaleFactor) {
        return createFloatBinding(()->Math.scalb(f, scaleFactor.get()), scaleFactor);
    }
471027
private void scale(double[] scaling, double[][] alpha, int t) {
        double[] table = alpha[t];

        double sum = 0.0;
        for (int i = 0; i < table.length; i++) {
            sum += table[i];
        }

        scaling[t] = sum;
        for (int i = 0; i < table.length; i++) {
            table[i] /= sum;
        }
    }
47097
public static double scalarProduct( double[] a, double[] b ) {
        double c = 0;
        for( int i = 0; i < a.length; i++ ) {
            c = c + a[i] * b[i];
        }
        return c;
    }
1100979
def _make_hat(self, v1, v2, acceleration, distance, min_time):
        
        if min_time > 0:
            # We are trying to meet time constraints
            # Solve quadratic to give vm
            b = v1 + v2 + min_time * acceleration
            c = distance * acceleration + (v1*v1 + v2*v2) / 2
            op = b*b - 4 * c
            if np.isclose(op, 0):
                # Might have a negative number as rounding error...
                op = 0
            elif op < 0:
                # Can't do this, set something massive to fail vm check...
                op = 10000000000

            def get_times(vm):
                t1 = (vm - v1) / acceleration
                t2 = (vm - v2) / acceleration
                tm = min_time - t1 - t2
                assert -self.max_velocity <= vm <= self.max_velocity
                assert t1 >= 0 and t2 >= 0 and tm >= 0
                return t1, tm, t2

            try:
                # Try negative root
                vm = (b - np.sqrt(op)) / 2
                t1, tm, t2 = get_times(vm)
            except AssertionError:
                try:
                    # Try positive root
                    vm = (b + np.sqrt(op)) / 2
                    t1, tm, t2 = get_times(vm)
                except AssertionError:
                    # If vm is out of range or any segment takes negative time,
                    # we can't do it in min_time, so act as if unconstrained
                    t1, tm, t2, vm = self._calculate_hat_params(
                        v1, v2, acceleration, distance)
        else:
            t1, tm, t2, vm = self._calculate_hat_params(
                v1, v2, acceleration, distance)

        # If middle segment needs to be negative time then we need to cap
        # vm and spend no time at vm
        if tm < 0:
            # Solve the quadratic to work out how long to spend accelerating
            vm = np.sqrt(
                (2 * acceleration * distance + v1 * v1 + v2 * v2) / 2)
            if acceleration < 0:
                vm = -vm
            t1 = self.acceleration_time(v1, vm)
            t2 = self.acceleration_time(vm, v2)
            tm = 0

        # Yield the result
        yield t1, vm
        yield tm, vm
        yield t2, v2
1171498
@Override
    public INDArray scalar(double value) {
        if (Nd4j.dataType() == DataType.DOUBLE)
            return create(new double[] {value}, new int[0], new int[0], 0);
        else
            return scalar((float) value);
    }
226416
@Nullable
  public com.simiacryptus.util.data.ScalarStatistics add(@javax.annotation.Nonnull final double... values) {
    double v1 = 0;
    double v2 = 0;
    double vmax = max;
    double vmin = max;
    int z = 0;
    double vlog = 0;
    int n = 0;
    int p = 0;
    for (final double v : values) {
      v1 += v;
      v2 += v * v;
      vmin = Math.min(min, v);
      vmax = Math.max(max, v);
      if (Math.abs(v) < com.simiacryptus.util.data.ScalarStatistics.zeroTol) {
        z++;
      }
      else {
        if (v < 0) {
          n++;
        }
        else {
          p++;
        }
        vlog += Math.log10(Math.abs(v));
      }
    }
    synchronized (this) {
      sum0 += values.length;
      sum1 += v1;
      sum2 += v2;
      min = Math.min(min, vmin);
      max = Math.max(max, vmax);
      negatives += n;
      positives += p;
      sumLog += vlog;
      zeros += z;
    }
    return this;
  }
724134
private MutableBigInteger divideMagnitude(MutableBigInteger div,
                                              MutableBigInteger quotient,
                                              boolean needRemainder ) {
        // assert div.intLen > 1
        // D1 normalize the divisor
        int shift = Integer.numberOfLeadingZeros(div.value[div.offset]);
        // Copy divisor value to protect divisor
        final int dlen = div.intLen;
        int[] divisor;
        MutableBigInteger rem; // Remainder starts as dividend with space for a leading zero
        if (shift > 0) {
            divisor = new int[dlen];
            copyAndShift(div.value,div.offset,dlen,divisor,0,shift);
            if (Integer.numberOfLeadingZeros(value[offset]) >= shift) {
                int[] remarr = new int[intLen + 1];
                rem = new MutableBigInteger(remarr);
                rem.intLen = intLen;
                rem.offset = 1;
                copyAndShift(value,offset,intLen,remarr,1,shift);
            } else {
                int[] remarr = new int[intLen + 2];
                rem = new MutableBigInteger(remarr);
                rem.intLen = intLen+1;
                rem.offset = 1;
                int rFrom = offset;
                int c=0;
                int n2 = 32 - shift;
                for (int i=1; i < intLen+1; i++,rFrom++) {
                    int b = c;
                    c = value[rFrom];
                    remarr[i] = (b << shift) | (c >>> n2);
                }
                remarr[intLen+1] = c << shift;
            }
        } else {
            divisor = Arrays.copyOfRange(div.value, div.offset, div.offset + div.intLen);
            rem = new MutableBigInteger(new int[intLen + 1]);
            System.arraycopy(value, offset, rem.value, 1, intLen);
            rem.intLen = intLen;
            rem.offset = 1;
        }

        int nlen = rem.intLen;

        // Set the quotient size
        final int limit = nlen - dlen + 1;
        if (quotient.value.length < limit) {
            quotient.value = new int[limit];
            quotient.offset = 0;
        }
        quotient.intLen = limit;
        int[] q = quotient.value;


        // Must insert leading 0 in rem if its length did not change
        if (rem.intLen == nlen) {
            rem.offset = 0;
            rem.value[0] = 0;
            rem.intLen++;
        }

        int dh = divisor[0];
        long dhLong = dh & LONG_MASK;
        int dl = divisor[1];

        // D2 Initialize j
        for (int j=0; j < limit-1; j++) {
            // D3 Calculate qhat
            // estimate qhat
            int qhat = 0;
            int qrem = 0;
            boolean skipCorrection = false;
            int nh = rem.value[j+rem.offset];
            int nh2 = nh + 0x80000000;
            int nm = rem.value[j+1+rem.offset];

            if (nh == dh) {
                qhat = ~0;
                qrem = nh + nm;
                skipCorrection = qrem + 0x80000000 < nh2;
            } else {
                long nChunk = (((long)nh) << 32) | (nm & LONG_MASK);
                if (nChunk >= 0) {
                    qhat = (int) (nChunk / dhLong);
                    qrem = (int) (nChunk - (qhat * dhLong));
                } else {
                    long tmp = divWord(nChunk, dh);
                    qhat = (int) (tmp & LONG_MASK);
                    qrem = (int) (tmp >>> 32);
                }
            }

            if (qhat == 0)
                continue;

            if (!skipCorrection) { // Correct qhat
                long nl = rem.value[j+2+rem.offset] & LONG_MASK;
                long rs = ((qrem & LONG_MASK) << 32) | nl;
                long estProduct = (dl & LONG_MASK) * (qhat & LONG_MASK);

                if (unsignedLongCompare(estProduct, rs)) {
                    qhat--;
                    qrem = (int)((qrem & LONG_MASK) + dhLong);
                    if ((qrem & LONG_MASK) >=  dhLong) {
                        estProduct -= (dl & LONG_MASK);
                        rs = ((qrem & LONG_MASK) << 32) | nl;
                        if (unsignedLongCompare(estProduct, rs))
                            qhat--;
                    }
                }
            }

            // D4 Multiply and subtract
            rem.value[j+rem.offset] = 0;
            int borrow = mulsub(rem.value, divisor, qhat, dlen, j+rem.offset);

            // D5 Test remainder
            if (borrow + 0x80000000 > nh2) {
                // D6 Add back
                divadd(divisor, rem.value, j+1+rem.offset);
                qhat--;
            }

            // Store the quotient digit
            q[j] = qhat;
        } // D7 loop on j
        // D3 Calculate qhat
        // estimate qhat
        int qhat = 0;
        int qrem = 0;
        boolean skipCorrection = false;
        int nh = rem.value[limit - 1 + rem.offset];
        int nh2 = nh + 0x80000000;
        int nm = rem.value[limit + rem.offset];

        if (nh == dh) {
            qhat = ~0;
            qrem = nh + nm;
            skipCorrection = qrem + 0x80000000 < nh2;
        } else {
            long nChunk = (((long) nh) << 32) | (nm & LONG_MASK);
            if (nChunk >= 0) {
                qhat = (int) (nChunk / dhLong);
                qrem = (int) (nChunk - (qhat * dhLong));
            } else {
                long tmp = divWord(nChunk, dh);
                qhat = (int) (tmp & LONG_MASK);
                qrem = (int) (tmp >>> 32);
            }
        }
        if (qhat != 0) {
            if (!skipCorrection) { // Correct qhat
                long nl = rem.value[limit + 1 + rem.offset] & LONG_MASK;
                long rs = ((qrem & LONG_MASK) << 32) | nl;
                long estProduct = (dl & LONG_MASK) * (qhat & LONG_MASK);

                if (unsignedLongCompare(estProduct, rs)) {
                    qhat--;
                    qrem = (int) ((qrem & LONG_MASK) + dhLong);
                    if ((qrem & LONG_MASK) >= dhLong) {
                        estProduct -= (dl & LONG_MASK);
                        rs = ((qrem & LONG_MASK) << 32) | nl;
                        if (unsignedLongCompare(estProduct, rs))
                            qhat--;
                    }
                }
            }


            // D4 Multiply and subtract
            int borrow;
            rem.value[limit - 1 + rem.offset] = 0;
            if(needRemainder)
                borrow = mulsub(rem.value, divisor, qhat, dlen, limit - 1 + rem.offset);
            else
                borrow = mulsubBorrow(rem.value, divisor, qhat, dlen, limit - 1 + rem.offset);

            // D5 Test remainder
            if (borrow + 0x80000000 > nh2) {
                // D6 Add back
                if(needRemainder)
                    divadd(divisor, rem.value, limit - 1 + 1 + rem.offset);
                qhat--;
            }

            // Store the quotient digit
            q[(limit - 1)] = qhat;
        }


        if (needRemainder) {
            // D8 Unnormalize
            if (shift > 0)
                rem.rightShift(shift);
            rem.normalize();
        }
        quotient.normalize();
        return needRemainder ? rem : null;
    }
159964
public void addScaling(double scale) {
    // invalidate inverse
    inv = null;
    // Note: last ROW is not included.
    for(int i = 0; i < dim; i++) {
      for(int j = 0; j <= dim; j++) {
        trans[i][j] = trans[i][j] * scale;
      }
    }
    // As long as relative vectors aren't used, this would also work:
    // trans[dim][dim] = trans[dim][dim] / scale;
  }