Performs the performing operation x = x + A(:,i)*alpha

<p>NOTE: This is the same as cs_scatter() in csparse.</p>
968104
public static void multAddColA(DMatrixSparseCSC A , int colA ,
                                   double alpha,
                                   DMatrixSparseCSC C, int mark,
                                   double x[] , int w[] ) {
        int idxA0 = A.col_idx[colA];
        int idxA1 = A.col_idx[colA+1];

        for (int j = idxA0; j < idxA1; j++) {
            int row = A.nz_rows[j];

            if( w[row] < mark ) {
                if( C.nz_length >= C.nz_rows.length ) {
                    C.growMaxLength(C.nz_length *2+1,true);
                }

                w[row] = mark;
                C.nz_rows[C.nz_length] = row;
                C.col_idx[mark] = ++C.nz_length;
                x[row] = A.nz_values[j]*alpha;
            } else {
                x[row] += A.nz_values[j]*alpha;
            }
        }
    }
389339
private void performAdj(int operation, int position, byte[] bytes, int offset, int length) {
		checkMutable();
		final int to = (bytes.length << 3) - offset;
		final int from = to - length;
		position += length;
		for (int i = from; i < to; i++) {
			boolean b = (bytes[i >> 3] & (128 >> (i & 7))) != 0;
			performAdj(operation, --position, b);
		}
	}
959071
public static Dcs cs_transpose(Dcs A, boolean values) {
        int p, q, j, Cp[], Ci[], n, m, Ap[], Ai[], w[];
        double Cx[], Ax[];
        Dcs C;
        if (!Dcs_util.CS_CSC(A))
            return (null); /* check inputs */
        m = A.m;
        n = A.n;
        Ap = A.p;
        Ai = A.i;
        Ax = A.x;
        C = Dcs_util.cs_spalloc(n, m, Ap[n], values && (Ax != null), false); /* allocate result */
        w = new int[m]; /* get workspace */
        Cp = C.p;
        Ci = C.i;
        Cx = C.x;
        for (p = 0; p < Ap[n]; p++)
            w[Ai[p]]++; /* row counts */
        Dcs_cumsum.cs_cumsum(Cp, w, m); /* row pointers */
        for (j = 0; j < n; j++) {
            for (p = Ap[j]; p < Ap[j + 1]; p++) {
                Ci[q = w[Ai[p]]++] = j; /* place A(i,j) as entry C(j,i) */
                if (Cx != null)
                    Cx[q] = Ax[p];
            }
        }
        return C;
    }
593215
public static void divide( DMatrix2 a , double alpha ) {
        a.a1 /= alpha;
        a.a2 /= alpha;
    }
895038
public static DZcs cs_transpose(DZcs A, boolean values)
	{
		int p, q, j, Cp[], Ci[], n, m, Ap[], Ai[], w[] ;
		DZcsa Cx = new DZcsa(), Ax = new DZcsa() ;
		DZcs C ;
		if (!CS_CSC (A)) return (null) ;		/* check inputs */
		m = A.m ; n = A.n ; Ap = A.p ; Ai = A.i ; Ax.x = A.x ;
		C = cs_spalloc (n, m, Ap [n], values && (Ax.x != null), false) ;  /* allocate result */
		w = new int [m] ;				/* get workspace */
		Cp = C.p ; Ci = C.i ; Cx.x = C.x ;
		for (p = 0 ; p < Ap [n] ; p++) w [Ai [p]]++ ;	/* row counts */
		cs_cumsum (Cp, w, m) ;				/* row pointers */
		for (j = 0 ; j < n ; j++)
		{
			for (p = Ap [j] ; p < Ap [j + 1] ; p++)
			{
				Ci [q = w [Ai [p]]++] = j ;	/* place A(i,j) as entry C(j,i) */
				if (Cx.x != null)
					Cx.set(q, (values) ? cs_conj(Ax.get(p)) : Ax.get(p)) ;
			}
		}
		return (C) ;
	}
1237663
private void calculateSCL(double[] x) {
    //System.out.println("Checking at: "+x[0]+" "+x[1]+" "+x[2]);
    value = 0.0;
    Arrays.fill(derivative, 0.0);
    double[] sums = new double[numClasses];
    double[] probs = new double[numClasses];
    double[] counts = new double[numClasses];
    Arrays.fill(counts, 0.0);
    for (int d = 0; d < data.length; d++) {
      //       if (d == testMin) {
      //         d = testMax - 1;
      //         continue;
      //       }
      int[] features = data[d];
      // activation
      Arrays.fill(sums, 0.0);
      for (int c = 0; c < numClasses; c++) {
        for (int f = 0; f < features.length; f++) {
          int i = indexOf(features[f], c);
          sums[c] += x[i];
        }
      }
      // expectation (slower routine replaced by fast way)
      // double total = Double.NEGATIVE_INFINITY;
      // for (int c=0; c<numClasses; c++) {
      //   total = SloppyMath.logAdd(total, sums[c]);
      // }
      double total = ArrayMath.logSum(sums);
      int ld = labels[d];
      for (int c = 0; c < numClasses; c++) {
        probs[c] = Math.exp(sums[c] - total);
        for (int f = 0; f < features.length; f++) {
          int i = indexOf(features[f], c);
          derivative[i] += probs[ld] * probs[c];
        }
      }
      // observed
      for (int f = 0; f < features.length; f++) {
        int i = indexOf(features[f], labels[d]);
        derivative[i] -= probs[ld];
      }
      value -= probs[ld];
    }
    // priors
    if (true) {
      for (int i = 0; i < x.length; i++) {
        double k = 1.0;
        double w = x[i];
        value += k * w * w / 2.0;
        derivative[i] += k * w;
      }
    }
  }
988519
public void calcCost(Node node)
    {
        node.cost = 0.0;
        if (alphaFloat_ != null)
        {
            float c = 0.0f;
            for (int i = 0; node.fVector.get(i) != -1; i++)
            {
                c += alphaFloat_[node.fVector.get(i) + node.y];
            }
            node.cost = costFactor_ * c;
        }
        else
        {
            double c = 0.0;
            for (int i = 0; node.fVector.get(i) != -1; i++)
            {
                c += alpha_[node.fVector.get(i) + node.y];
            }
            node.cost = costFactor_ * c;
        }
    }
435749
private void calc(int x, int y) {
        double d;
        int dIndex;
        int index;

        for (int alpha = 0; alpha < (this.cSteps - 1); alpha++) {
            d = y * this.cCosA[alpha] - x * this.cSinA[alpha];
            dIndex = (int) (d - this.cDMin);
            index = dIndex * this.cSteps + alpha;
            try {
                this.cHMatrix[index] += 1;
            } catch (Exception e) {
                logger.warn("", e);
            }
        }
    }
602867
public static void scale( double alpha , DMatrixD1 a )
    {
        // on very small matrices (2 by 2) the call to getNumElements() can slow it down
        // slightly compared to other libraries since it involves an extra multiplication.
        final int size = a.getNumElements();

        for( int i = 0; i < size; i++ ) {
            a.data[i] *= alpha;
        }
    }
780624
public void mul(IVector a, IVector result) {
        if ((a == null) || (columns != a.size)) return;

        if (result.size != rows) result.reshape(rows);

        int i, j;
        double realsum, imagsum;
        for (i = 0; i < rows; i++) {
            realsum = 0;
            imagsum = 0;
            for (j = 0; j < columns; j++) {
                realsum += realmatrix[i][j] * a.realvector[j] - imagmatrix[i][j] * a.imagvector[j];
                imagsum += realmatrix[i][j] * a.imagvector[j] + imagmatrix[i][j] * a.realvector[j];
            }
            result.realvector[i] = realsum;
            result.imagvector[i] = imagsum;
        }
    }
701112
public float mixed(float[] x, int A, float alpha) {
    float tmp;
    tmp =
      (float) Math.cos((float) 2.0 * A * (float) Math.PI * x[0] + (float) Math.PI * (float) 0.5);
    tmp /= (2.0 * (float) A * Math.PI);

    return (float) Math.pow(((float) 1.0 - x[0] - tmp), alpha);
  }
139249
public final void additiveExpression() throws RecognitionException {
		int additiveExpression_StartIndex = input.index();

		try {
			if ( state.backtracking>0 && alreadyParsedRule(input, 122) ) { return; }

			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1188:5: ( multiplicativeExpression ( ( '+' | '-' ) multiplicativeExpression )* )
			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1188:9: multiplicativeExpression ( ( '+' | '-' ) multiplicativeExpression )*
			{
			pushFollow(FOLLOW_multiplicativeExpression_in_additiveExpression5410);
			multiplicativeExpression();
			state._fsp--;
			if (state.failed) return;
			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1188:34: ( ( '+' | '-' ) multiplicativeExpression )*
			loop154:
			while (true) {
				int alt154=2;
				int LA154_0 = input.LA(1);
				if ( (LA154_0==40||LA154_0==44) ) {
					alt154=1;
				}

				switch (alt154) {
				case 1 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1188:36: ( '+' | '-' ) multiplicativeExpression
					{
					if ( input.LA(1)==40||input.LA(1)==44 ) {
						input.consume();
						state.errorRecovery=false;
						state.failed=false;
					}
					else {
						if (state.backtracking>0) {state.failed=true; return;}
						MismatchedSetException mse = new MismatchedSetException(null,input);
						throw mse;
					}
					pushFollow(FOLLOW_multiplicativeExpression_in_additiveExpression5422);
					multiplicativeExpression();
					state._fsp--;
					if (state.failed) return;
					}
					break;

				default :
					break loop154;
				}
			}

			}

		}
		catch (RecognitionException re) {
			reportError(re);
			recover(input,re);
		}
		finally {
			// do for sure before leaving
			if ( state.backtracking>0 ) { memoize(input, 122, additiveExpression_StartIndex); }

		}
	}
377501
def _compute_intra_event_alpha(self, C, vs30, pga1100):
        
        alpha = np.zeros_like(vs30, dtype=float)
        idx = vs30 < C['k1']
        if np.any(idx):
            temp1 = (pga1100[idx] +
                     C['c'] * (vs30[idx] / C['k1']) ** C['n']) ** -1.
            temp1 = temp1 - ((pga1100[idx] + C['c']) ** -1.)
            alpha[idx] = C['k2'] * pga1100[idx] * temp1

        return alpha
451490
public static void scale( double alpha , DMatrix4 a ) {
        a.a1 *= alpha;
        a.a2 *= alpha;
        a.a3 *= alpha;
        a.a4 *= alpha;
    }
306985
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
  {

    XMLString s1 = m_arg0.execute(xctxt).xstr();
    double start = m_arg1.execute(xctxt).num();
    int lenOfS1 = s1.length();
    XMLString substr;

    if (lenOfS1 <= 0)
      return XString.EMPTYSTRING;
    else
    {
      int startIndex;

      if (Double.isNaN(start))
      {

        // Double.MIN_VALUE doesn't work with math below 
        // so just use a big number and hope I never get caught.
        start = -1000000;
        startIndex = 0;
      }
      else
      {
        start = Math.round(start);
        startIndex = (start > 0) ? (int) start - 1 : 0;
      }

      if (null != m_arg2)
      {
        double len = m_arg2.num(xctxt);
        int end = (int) (Math.round(len) + start) - 1;

        // Normalize end index.
        if (end < 0)
          end = 0;
        else if (end > lenOfS1)
          end = lenOfS1;

        if (startIndex > lenOfS1)
          startIndex = lenOfS1;

        substr = s1.substring(startIndex, end);
      }
      else
      {
        if (startIndex > lenOfS1)
          startIndex = lenOfS1;
        substr = s1.substring(startIndex);
      }
    }

    return (XString)substr; // cast semi-safe
  }
1277400
public static int cudnnAddTensor(
        cudnnHandle handle, 
        Pointer alpha, 
        cudnnTensorDescriptor aDesc, 
        Pointer A, 
        Pointer beta, 
        cudnnTensorDescriptor cDesc, 
        Pointer C)
    {
        return checkResult(cudnnAddTensorNative(handle, alpha, aDesc, A, beta, cDesc, C));
    }
764153
public function process()
    {
        $operands = $this->getOperands();

        if ($operands->containsNull() === true) {
            return null;
        }

        if ($operands->anythingButRecord() === false) {
            $msg = "The Max operator only accept values with a cardinality of single, multiple or ordered.";
            throw new OperatorProcessingException($msg, $this, OperatorProcessingException::WRONG_CARDINALITY);
        }

        if ($operands->exclusivelyNumeric() === false) {
            // As per QTI 2.1 spec, If any of the sub-expressions is not a numerical value, then the result is NULL.
            return null;
        }

        // As per QTI 2.1 spec,
        // The result is a single float, or, if all sub-expressions are of
        // integer type, a single integer.
        $integerCount = 0;
        $valueCount = 0;
        $max = -PHP_INT_MAX;
        foreach ($operands as $operand) {
            if (!$operand instanceof Container) {
                $baseType = ($operand instanceof QtiFloat) ? BaseType::FLOAT : BaseType::INTEGER;
                $value = new MultipleContainer($baseType, array($operand));
            } else {
                $value = $operand;
            }

            foreach ($value as $v) {

                if (is_null($v)) {
                    return null;
                }

                $valueCount++;
                $integerCount += ($v instanceof QtiInteger) ? 1 : 0;

                if ($v->getValue() > $max) {
                    $max = $v->getValue();
                }
            }
        }

        return ($integerCount === $valueCount) ? new QtiInteger(intval($max)) : new QtiFloat(floatval($max));
    }