*******************BEGINNING OF FUNCTION********************//
509569
public static boolean is_ashadi(String str)
    {
        String s1 = VarnaUtil.getAdiVarna(str);
        if (is_ash(s1)) return true;
        return false;
    }
266773
function begins(query, node) {
  var value = node[query.name]

  return (
    typeof value === 'string' &&
    value.slice(0, query.value.length) === query.value
  )
}
1312351
private function _processFunctionStart() {
		$this->_inFunction = true;
		$this->_cyclomaticComplexity = 1;
		$this->_npathComplexity = 0;
		$this->_functionLevel = $this->statementStack->count();
		$this->_justAfterFuncStmt = false;

		$this->_functionStartLine = $this->lineNumber;

		// Check the position of the open curly after the function declaration
		if ($this->_isActive('funcDefinitionOpenCurly')) {
			$pos = $this->_config->getTestProperty('funcDefinitionOpenCurly', 'position');

			$currentToken = $this->tokenizer->getCurrentToken();
			$previousToken = $this->tokenizer->peekPrvsValidToken();

			if ($pos === NEW_LINE) {
				// The previous token should be on the previous line
				$isPosOk = ($previousToken->line < $currentToken->line);
			} else {
				// The previous token should be on the same line
				$isPosOk = ($previousToken->line === $currentToken->line);
			}

			if (!$isPosOk) {
				$tmp = ($pos === SAME_LINE) ? "the previous line." : "a new line.";
				$msg = $this->_getMessage('LEFT_CURLY_POS', $tmp);
				$this->_writeError('funcDefinitionOpenCurly', $msg);
			}
		}
	}
26559
function() {

      // asinh(c) = log(c + sqrt(c^2 + 1))

      var tmp = this['im'];
      this['im'] = -this['re'];
      this['re'] = tmp;
      var res = this['asin']();

      this['re'] = -this['im'];
      this['im'] = tmp;
      tmp = res['re'];

      res['re'] = -res['im'];
      res['im'] = tmp;
      return res;
    }
146681
function Buf(buffer) {
  this._initialSize = 64 * 1024;
  this._stepSize = this._initialSize;
  this._pos = 0;

  if (typeof buffer === 'number') {
    this._initialSize = buffer;
  }
  if (buffer instanceof Buffer) {
    this._buf = buffer;
  } else {
    this._buf = new Buffer(this._initialSize);
  }
}
545858
function(functions, payload, error) {
		var payloadLength = payload.readUInt32LE(0);
		var identifierEndPosition = 8 + payload.readUInt32LE(4);
		var identifier = payload.slice(8, identifierEndPosition).toString(module.exports.encoding);
		
		var position = identifierEndPosition;
		
		var response = [ new Buffer(1) /* Status code response */ ];
		if(identifier in functions) {
			var args = [];
			for(; position < payloadLength;) {
				var dataType = payload.readUInt8(position++);
				var dataSize = payload.readUInt32LE(position);
				position += 4;
				var value = undefined;
				switch(dataType) {
					case module.exports.EnumDataType.byte:
						value = payload.readInt8(position);
						position++;
						break;
					case module.exports.EnumDataType.ubyte:
						value = payload.readUInt8(position);
						position++;
						break;
					case module.exports.EnumDataType.short:
						value = payload.readInt16LE(position);
						position += 2;
						break;
					case module.exports.EnumDataType.ushort:
						value = payload.readUInt16LE(position);
						position += 2;
						break;
					case module.exports.EnumDataType.int:
						value = payload.readInt32LE(position);
						position += 4;
						break;
					case module.exports.EnumDataType.uint:
						value = payload.readUInt32LE(position);
						position += 4;
						break;
					case module.exports.EnumDataType.float:
						value = payload.readFloatLE(position);
						position += 4;
						break;
					case module.exports.EnumDataType.double:
						value = payload.readDoubleLE(position);
						position += 8;
						break;
					case module.exports.EnumDataType.string:
						var next = position + dataSize;
						value = payload.slice(position, next).toString(module.exports.encoding);
						position = next;
						break;
					case module.exports.EnumDataType.boolean:
						value = payload.readUInt8(position) > 0;
						position++;
						break;
					case module.exports.EnumDataType.undefined:
						value = undefined;
						break;
					case module.exports.EnumDataType.null:
						value = null;
						break;
					default:
						error(new Error('Unsupported data type argument received from client'));
						response[0].writeUInt8(module.exports.EnumNodeResponse.NodeError, 0);
						return response[0]; // Early exit
				}
				
				args.push(value);
			}
	
			var result = functions[identifier].callback.apply(this, args);
			if(result === undefined) {
				// TODO: Will be removed in future versions. This response type is now handled
				// in the "Okay" response as the "undefined" datatype.
				response[0].writeUInt8(module.exports.EnumNodeResponse.NoResult, 0);
			}
			else {
				response[0].writeUInt8(module.exports.EnumNodeResponse.Okay, 0);
				
				var argtype = functions[identifier].responseType;
				
				if(!argtype) {
					if(result === null) {
						argtype = 'null';
					}
					else {
						switch(typeof result) {
							case 'number':
								if(result === (result|0)) {
									argtype = 'int'; // Default to int for normal numbers
								}
								else {
									argtype = 'float'; // float for anything else
								}
								break;
							case 'string':
								argtype = 'string';
								break;
							case 'boolean':
								argtype = 'boolean';
								break;
							case 'undefined':
								argtype = 'undefiend';
								break;
						}
					}
					functions[identifier].responseType = argtype;
				}
				
				var tempBuf = undefined;
				var dataType = module.exports.EnumDataType[argtype];
				if(dataType !== undefined) {
					switch(dataType) {
						case module.exports.EnumDataType.byte:
							tempBuf = new Buffer(1);
							tempBuf.writeInt8(result, 0);
							break;
						case module.exports.EnumDataType.ubyte:
							tempBuf = new Buffer(1);
							tempBuf.writeUInt8(result, 0);
							break;
						case module.exports.EnumDataType.short:
							tempBuf = new Buffer(2);
							tempBuf.writeInt16LE(result, 0);
							break;
						case module.exports.EnumDataType.ushort:
							tempBuf = new Buffer(2);
							tempBuf.writeUInt16LE(result, 0);
							break;
						case module.exports.EnumDataType.int:
							tempBuf = new Buffer(4);
							tempBuf.writeInt32LE(result, 0);
							break;
						case module.exports.EnumDataType.uint:
							tempBuf = new Buffer(4);
							tempBuf.writeUInt32LE(result, 0);
							break;
						case module.exports.EnumDataType.float:
							tempBuf = new Buffer(4);
							tempBuf.writeFloatLE(result, 0);
							break;
						case module.exports.EnumDataType.double:
							tempBuf = new Buffer(8);
							tempBuf.writeDoubleLE(result, 0);
							break;
						case module.exports.EnumDataType.string:
							tempBuf = new Buffer(result);
							break;
						case module.exports.EnumDataType.boolean:
							tempBuf = new Buffer(1);
							tempBuf.writeUInt8(result ? 0x1 : 0x0, 0);
							break;
						case module.exports.EnumDataType.undefined:
						case module.exports.EnumDataType.null:
							tempBuf = new Buffer(0);
							break;
						default:
							error(new Error('Data type' + dataType + ' has gone unhandled by this node implementation'));
							response[0].writeUInt8(module.exports.EnumNodeResponse.NodeError, 0);
							break;
					}
					
					if(dataType < module.exports.EnumDataType._max) {
						var argHeader = new Buffer(5);
						argHeader.writeUInt8(dataType, 0);
						argHeader.writeUInt32LE(tempBuf.length, 1);
						response.push(argHeader);
						response.push(tempBuf);
					}
				}
				else {
					error(new Error('Unsupported data type returned from nodesocket function'));
					response[0].writeUInt8(module.exports.EnumNodeResponse.NodeError, 0);
				}
			}
		}
		else {
			response[0].writeUInt8(module.exports.EnumNodeResponse.InvalidFunction, 0);
		}
	
		return makeBufferPosResponse(Buffer.concat(response), position);
	}
1241034
double[] lineMinimize(DiffFunction function, double[] initial, double[] direction) {
    // make a 1-dim function along the direction line
    // THIS IS A HACK (but it's the NRiC peoples' hack)
    OneDimDiffFunction oneDim = new OneDimDiffFunction(function, initial, direction);
    // do a 1-dim line min on this function
    //Double Ax = new Double(0.0);
    //Double Xx = new Double(1.0);
    //Double Bx = new Double(0.0);
    // bracket the extreme pt
    double guess = 0.01;
    //System.err.println("Current "+oneDim.valueAt(0)+" nudge "+(oneDim.smallestZeroPositiveLocation()*1e-2)+" "+oneDim.valueAt(oneDim.smallestZeroPositiveLocation()*1e-5));
    if (!silent) {
      System.err.print("[");
    }
    Triple bracketing = mnbrak(new Triple(0, guess, 0), oneDim);
    if (!silent) {
      System.err.print("]");
    }
    double ax = bracketing.a;
    double xx = bracketing.b;
    double bx = bracketing.c;
    //lastXx = xx;
    // CHECK FOR END OF WORLD
    if (!(ax <= xx && xx <= bx) && !(bx <= xx && xx <= ax)) {
      System.err.println("Bad bracket order!");
    }
    if (verbose) {
      System.err.println("Bracketing found: " + ax + " " + xx + " " + bx);
      System.err.println("Bracketing found: " + oneDim.valueAt(ax) + " " + oneDim.valueAt(xx) + " " + oneDim.valueAt(bx));
      //System.err.println("Bracketing found: "+arrayToString(oneDim.vectorOf(ax),3)+" "+arrayToString(oneDim.vectorOf(xx),3)+" "+arrayToString(oneDim.vectorOf(bx),3));
    }
    // find the extreme pt
    if (!silent) {
      System.err.print("<");
    }
    double xmin = dbrent(oneDim, ax, xx, bx);
    if (!silent) {
      System.err.print(">");
    }
    // return the full vector
    //System.err.println("Went "+xmin+" during lineMinimize");
    return oneDim.vectorOf(xmin);
  }
117083
final public void Function() throws ParseException {
 /*@bgen(jjtree) Function */
    AstFunction jjtn000 = new AstFunction(JJTFUNCTION);
    boolean jjtc000 = true;
    jjtree.openNodeScope(jjtn000);Token t0 = null;
    Token t1 = null;
    try {
      t0 = jj_consume_token(IDENTIFIER);
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case COLON:
        jj_consume_token(COLON);
        t1 = jj_consume_token(IDENTIFIER);
        break;
      default:
        jj_la1[48] = jj_gen;
        ;
      }
        if (t1 != null) {
            jjtn000.setPrefix(t0.image);
            jjtn000.setLocalName(t1.image);
        } else {
            jjtn000.setLocalName(t0.image);
        }
      label_19:
      while (true) {
        MethodParameters();
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case LPAREN:
          ;
          break;
        default:
          jj_la1[49] = jj_gen;
          break label_19;
        }
      }
    } catch (Throwable jjte000) {
      if (jjtc000) {
        jjtree.clearNodeScope(jjtn000);
        jjtc000 = false;
      } else {
        jjtree.popNode();
      }
      if (jjte000 instanceof RuntimeException) {
        {if (true) throw (RuntimeException)jjte000;}
      }
      if (jjte000 instanceof ParseException) {
        {if (true) throw (ParseException)jjte000;}
      }
      {if (true) throw (Error)jjte000;}
    } finally {
      if (jjtc000) {
        jjtree.closeNodeScope(jjtn000, true);
      }
    }
  }
78195
function Grammar(delimiters) {
    this.delimiters = delimiters;

    this.internal = [
      makeEntry("START_IF", "if"),
      makeEntry("ELSE", "else"),
      makeEntry("ELSIF", "elsif"),
      makeEntry("END_IF", "endif"),
      makeEntry("NOT", "not"),
      makeEntry("EQUALITY", "=="),
      makeEntry("NOT_EQUALITY", "!="),
      makeEntry("GREATER_THAN_EQUAL", ">="),
      makeEntry("GREATER_THAN", ">"),
      makeEntry("LESS_THAN_EQUAL", "<="),
      makeEntry("LESS_THAN", "<"),
      makeEntry("START_EACH", "each"),
      makeEntry("END_EACH", "endeach"),
      makeEntry("ASSIGN", "as"),
      makeEntry("PARTIAL", "partial"),
      makeEntry("START_EXTEND", "extend"),
      makeEntry("END_EXTEND", "endextend"),
      makeEntry("MAGIC", ".")
    ];
  }
249725
private static int findStart( char[] buffer, int start, int end )
    {
        int pos, cp;
        for ( pos = start; pos < end && isWhitespace( cp = codePointAt( buffer, pos ) ); pos += charCount( cp ) )
        {
            if ( cp == '\n' )
            {
                start = pos + 1;
            }
        }
        return pos >= end ? end : start;
    }
1003104
function(a,b,c,d,e,f,g,h) {
            //console.log("running callback function", a, that, moduleId);
            // store the value
            that.execValues[moduleId] = {
               output: [a,b,c,d,e,f,g,h]
            };
            
            that.executeModules(moduleId, "output");
         }
1018375
public void create_function( String name, int nargs, Function f ) {
        synchronized (this) {
            _create_function(name, nargs, f);
        }
    }
153466
function Name() {
    /**
     * The prefix value
     * @member
     */
    this.prefix = null;
    /**
     * The first value
     * @member
     */
    this.first = null;
    /**
     * The middle value
     * @member
     */
    this.middle = null;
    /**
     * The last value
     * @member
     */
    this.last = null;
    /**
     * The suffix value
     * @member
     */
    this.suffix = null;

}
1257882
private void init()
	{

		sum = BigInteger.ZERO;
		sumByMillisec = BigInteger.ZERO;
		currentVal = -1;
		count =0;
		avg = -1;
		max = -1;
		min = -1;
	}
754240
function initial(array) {
      var length = array == null ? 0 : array.length;
      return length ? baseSlice(array, 0, -1) : [];
    }
1111069
public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        while (scan.hasNextLine()) {
            String line = scan.nextLine();

            LogicExpression<String> expr = LogicExpressionParsers.trivial.parse(line);

            System.out.println("string: " + expr.toString());
            System.out.println("value:  " + expr.apply(null));
            System.out.println();
        }

        scan.close();
    }
1212443
public static void main(String[] args) {
    if (args.length == 0) {
      System.err.println("Usage: java edu.stanford.nlp.math.SloppyMath " + "[-logAdd|-fishers k n r m|-binomial r n p");
    } else if (args[0].equals("-logAdd")) {
      System.out.println("Log adds of neg infinity numbers, etc.");
      System.out.println("(logs) -Inf + -Inf = " + logAdd(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY));
      System.out.println("(logs) -Inf + -7 = " + logAdd(Double.NEGATIVE_INFINITY, -7.0));
      System.out.println("(logs) -7 + -Inf = " + logAdd(-7.0, Double.NEGATIVE_INFINITY));
      System.out.println("(logs) -50 + -7 = " + logAdd(-50.0, -7.0));
      System.out.println("(logs) -11 + -7 = " + logAdd(-11.0, -7.0));
      System.out.println("(logs) -7 + -11 = " + logAdd(-7.0, -11.0));
      System.out.println("real 1/2 + 1/2 = " + logAdd(Math.log(0.5), Math.log(0.5)));
    } else if (args[0].equals("-fishers")) {
      int k = Integer.parseInt(args[1]);
      int n = Integer.parseInt(args[2]);
      int r = Integer.parseInt(args[3]);
      int m = Integer.parseInt(args[4]);
      double ans = SloppyMath.hypergeometric(k, n, r, m);
      System.out.println("hypg(" + k + "; " + n + ", " + r + ", " + m + ") = " + ans);
      ans = SloppyMath.oneTailedFishersExact(k, n, r, m);
      System.out.println("1-tailed Fisher's exact(" + k + "; " + n + ", " + r + ", " + m + ") = " + ans);
      double ansChi = SloppyMath.chiSquare2by2(k, n, r, m);
      System.out.println("chiSquare(" + k + "; " + n + ", " + r + ", " + m + ") = " + ansChi);

      System.out.println("Swapping arguments should give same hypg:");
      ans = SloppyMath.hypergeometric(k, n, r, m);
      System.out.println("hypg(" + k + "; " + n + ", " + m + ", " + r + ") = " + ans);
      int othrow = n - m;
      int othcol = n - r;
      int cell12 = m - k;
      int cell21 = r - k;
      int cell22 = othrow - (r - k);
      ans = SloppyMath.hypergeometric(cell12, n, othcol, m);
      System.out.println("hypg(" + cell12 + "; " + n + ", " + othcol + ", " + m + ") = " + ans);
      ans = SloppyMath.hypergeometric(cell21, n, r, othrow);
      System.out.println("hypg(" + cell21 + "; " + n + ", " + r + ", " + othrow + ") = " + ans);
      ans = SloppyMath.hypergeometric(cell22, n, othcol, othrow);
      System.out.println("hypg(" + cell22 + "; " + n + ", " + othcol + ", " + othrow + ") = " + ans);
    } else if (args[0].equals("-binomial")) {
      int k = Integer.parseInt(args[1]);
      int n = Integer.parseInt(args[2]);
      double p = Double.parseDouble(args[3]);
      double ans = SloppyMath.exactBinomial(k, n, p);
      System.out.println("Binomial p(X >= " + k + "; " + n + ", " + p + ") = " + ans);
    } else {
      System.err.println("Unknown option: " + args[0]);
    }
  }