/*@
@ requires data != null;
@ requires 0 <= nWords && nWords <= data.length && offset >= 0;
@ requires nWords == 0 ==> offset == 0;
@ ensures nWords == 0 ==> offset == 0;
@ ensures nWords > 0 ==> data[nWords - 1] != 0;
@
968402
private /*@ helper @*/ void trimLeadingZeros() {
        int i = nWords;
        if (i > 0 && (data[--i] == 0)) {
            //for (; i > 0 && data[i - 1] == 0; i--) ;
            while(i > 0 && data[i - 1] == 0) {
                i--;
            }
            this.nWords = i;
            if (i == 0) { // all words are zero
                this.offset = 0;
            }
        }
    }
554103
void init() {
    numnegative = new int[numSamples() + 1];
    numpositive = new int[numSamples() + 1];
    numnegative[0] = 0;
    numpositive[0] = 0;
    int num = numSamples();
    for (int i = 1; i <= num; i++) {
      numnegative[i] = numnegative[i - 1] + (classes[i - 1] == 0 ? 1 : 0);
    }
    for (int i = 1; i <= num; i++) {
      numpositive[i] = numpositive[i - 1] + (classes[num - i] == 0 ? 0 : 1);
    }
    System.err.println("total positive " + numpositive[num] + " total negative " + numnegative[num] + " total " + num);
    for (int i = 1; i < numpositive.length; i++) {
      //System.out.println(i + " positive " + numpositive[i] + " negative " + numnegative[i] + " classes " + classes[i - 1] + " " + classes[num - i]);
    }
  }
1171350
function(x) {
    var index = null, ni = this.elements.length, ki = ni, i, nj, kj = this.elements[0].length, j;
    do { i = ki - ni;
      nj = kj;
      do { j = kj - nj;
        if (this.elements[i][j] == x) { return {i: i+1, j: j+1}; }
      } while (--nj);
    } while (--ni);
    return null;
  }
904771
function(x) {
            	var ni = this.elements.length, i, nj = this.elements[0].length, j;
            	for (i = 0; i < ni; i++) {
            	    for (j = 0; j < nj; j++) {
            		if (this.elements[i][j] == x) { return {i: i + 1, j: j + 1}; }
            	    }
            	}
            	return null;
                }
1113991
function(data) {
			data = data || {};
			var paramNames = Object.keys(data);
			var buf = [];
			for (var i=0; i < paramNames.length; i++) {
				var param = paramNames[i], value = data[param];
				buf.push(x_www_form_urlencode(param) + '=' + x_www_form_urlencode(value)); //$NON-NLS-0$
			}
			return buf.join('&'); //$NON-NLS-0$
		}
741469
function() {
            	var maxes = [];

            	for(var i = 1; i <= this.rows(); i++) {
            	    var max = null;
            	    var maxIndex = -1;

            	    for(var j = 1; j <= this.cols(); j++) {
            		if(max === null || this.e(i, j) > max) {
            		    max = this.e(i, j);
            		    maxIndex = j;
            		}
            	    }

            	    maxes.push(maxIndex);
            	}

            	return $V(maxes);
                }
1088794
function (D) {
			var N = D.length;
			assert(N > 0, " X is empty? You must have some data!");
			// convert D to a (fast) typed array version
			var dists = zeros(N * N); // allocate contiguous array
			for (var i = 0; i < N; i++) {
				for (var j = i + 1; j < N; j++) {
					var d = D[i][j];
					dists[i * N + j] = d;
					dists[j * N + i] = d;
				}
			}
			this.P = d2p(dists, this.perplexity, 1e-4);
			this.N = N;
			this.initSolution(); // refresh this
		}
1124168
private int getDataIndexOfKey(Object key) {
    int dataSize = this.size << 1;
    Object[] data = this.data;
    for (int i = 0; i < dataSize; i += 2) {
      Object k = data[i];
      if (key == null ? k == null : key.equals(k)) {
        return i;
      }
    }
    return -2;
  }
603920
protected function initData()
    {
        if ($this->data !== null) {
            return;
        }

        if ($this->value !== null) {
            $this->data = $this->value;
            return;
        }

        if ($this->model instanceof Model) {
            $data = ($this->model->hasProperty($this->attribute) || isset($this->model->{$this->attribute}))
                ? ArrayHelper::getValue($this->model, $this->attribute, [])
                : [];

            if (!is_array($data) && empty($data)) {
                return;
            }

            if (!($data instanceof \Traversable)) {
                $data = (array) $data;
            }

            foreach ($data as $index => $value) {
                $this->data[$index] = $value;
            }
        }
    }
210358
function init$9() {
        this.no_off = this.no_off || false;
        this.no_rot = this.no_rot || false;

        if (isNaN(this.k0)) {
            this.k0 = 1;
        }
        var sinlat = Math.sin(this.lat0);
        var coslat = Math.cos(this.lat0);
        var con = this.e * sinlat;

        this.bl = Math.sqrt(1 + this.es / (1 - this.es) * Math.pow(coslat, 4));
        this.al = this.a * this.bl * this.k0 * Math.sqrt(1 - this.es) / (1 - con * con);
        var t0 = tsfnz(this.e, this.lat0, sinlat);
        var dl = this.bl / coslat * Math.sqrt((1 - this.es) / (1 - con * con));
        if (dl * dl < 1) {
            dl = 1;
        }
        var fl;
        var gl;
        if (!isNaN(this.longc)) {
            //Central point and azimuth method

            if (this.lat0 >= 0) {
                fl = dl + Math.sqrt(dl * dl - 1);
            }
            else {
                fl = dl - Math.sqrt(dl * dl - 1);
            }
            this.el = fl * Math.pow(t0, this.bl);
            gl = 0.5 * (fl - 1 / fl);
            this.gamma0 = Math.asin(Math.sin(this.alpha) / dl);
            this.long0 = this.longc - Math.asin(gl * Math.tan(this.gamma0)) / this.bl;

        }
        else {
            //2 points method
            var t1 = tsfnz(this.e, this.lat1, Math.sin(this.lat1));
            var t2 = tsfnz(this.e, this.lat2, Math.sin(this.lat2));
            if (this.lat0 >= 0) {
                this.el = (dl + Math.sqrt(dl * dl - 1)) * Math.pow(t0, this.bl);
            }
            else {
                this.el = (dl - Math.sqrt(dl * dl - 1)) * Math.pow(t0, this.bl);
            }
            var hl = Math.pow(t1, this.bl);
            var ll = Math.pow(t2, this.bl);
            fl = this.el / hl;
            gl = 0.5 * (fl - 1 / fl);
            var jl = (this.el * this.el - ll * hl) / (this.el * this.el + ll * hl);
            var pl = (ll - hl) / (ll + hl);
            var dlon12 = adjust_lon(this.long1 - this.long2);
            this.long0 = 0.5 * (this.long1 + this.long2) - Math.atan(jl * Math.tan(0.5 * this.bl * (dlon12)) / pl) / this.bl;
            this.long0 = adjust_lon(this.long0);
            var dlon10 = adjust_lon(this.long1 - this.long0);
            this.gamma0 = Math.atan(Math.sin(this.bl * (dlon10)) / gl);
            this.alpha = Math.asin(dl * Math.sin(this.gamma0));
        }

        if (this.no_off) {
            this.uc = 0;
        }
        else {
            if (this.lat0 >= 0) {
                this.uc = this.al / this.bl * Math.atan2(Math.sqrt(dl * dl - 1), Math.cos(this.alpha));
            }
            else {
                this.uc = -1 * this.al / this.bl * Math.atan2(Math.sqrt(dl * dl - 1), Math.cos(this.alpha));
            }
        }

    }
1001327
@Override
    public Iterator<Datum<SparseArray>> iterator() {
        return new Iterator<Datum<SparseArray>>() {

            /**
             * Current position.
             */
            int i = 0;

            @Override
            public boolean hasNext() {
                return i < data.size();
            }

            @Override
            public Datum<SparseArray> next() {
                return get(i++);
            }

            @Override
            public void remove() {
                SparseDataset.this.remove(i);
            }
        };
    }
119617
function() {
            	if (!this.isSquare) { return null; }
            	var els = [], n = this.elements.length;
            	for (var i = 0; i < n; i++) {
            	    els.push(this.elements[i][i]);
            	}
            	return $V(els);
                }
780116
function(index){
    
        //check for out-of-bounds values
        if (index > -1 && index < this._length){
            var current = this._head,
                i = 0;
                
            while(i++ < index){
                current = current.next;            
            }
        
            return current.data;
        } else {
            return null;
        }
    }
314138
private void init() {
        width = Double.MAX_VALUE;
        for (int i = 1; i < data.length; i++) {
            double w = Math.abs(data[i][0] - data[i - 1][0]);
            if (width > w) {
                width = w;
            }
        }

        leftTop = new double[data.length][2];
        rightTop = new double[data.length][2];
        leftBottom = new double[data.length][2];
        rightBottom = new double[data.length][2];

        for (int i = 0; i < data.length; i++) {
            leftTop[i][0] = data[i][0] - width / 2;
            leftTop[i][1] = data[i][1];

            rightTop[i][0] = data[i][0] + width / 2;
            rightTop[i][1] = data[i][1];

            leftBottom[i][0] = data[i][0] - width / 2;
            leftBottom[i][1] = 0;

            rightBottom[i][0] = data[i][0] + width / 2;
            rightBottom[i][1] = 0;
        }
    }
271003
function() {
            	var mins = [];

            	for(var i = 1; i <= this.rows(); i++) {
            	    var min = null;
            	    var minIndex = -1;

            	    for(var j = 1; j <= this.cols(); j++) {
            		if(min === null || this.e(i, j) < min) {
            		    min = this.e(i, j);
            		    minIndex = j;
            		}
            	    }

            	    mins.push(minIndex);
            	}

            	return $V(mins);
                }
1247400
function () {
        var data = this.data;
        var nodes = this._nodes;

        for (var i = 0, len = nodes.length; i < len; i++) {
            nodes[i].dataIndex = -1;
        }

        for (var i = 0, len = data.count(); i < len; i++) {
            nodes[data.getRawIndex(i)].dataIndex = i;
        }
    }
230523
function () {
		var ikConstraints = this.ikConstraints;
		var ikConstraintsCount = ikConstraints.length;

		var arrayCount = ikConstraintsCount + 1;
		var boneCache = this.boneCache;
		if (boneCache.length > arrayCount) boneCache.length = arrayCount;
		for (var i = 0, n = boneCache.length; i < n; i++)
			boneCache[i].length = 0;
		while (boneCache.length < arrayCount)
			boneCache[boneCache.length] = [];

		var nonIkBones = boneCache[0];
		var bones = this.bones;

		outer:
		for (var i = 0, n = bones.length; i < n; i++) {
			var bone = bones[i];
			var current = bone;
			do {
				for (var ii = 0; ii < ikConstraintsCount; ii++) {
					var ikConstraint = ikConstraints[ii];
					var parent = ikConstraint.bones[0];
					var child= ikConstraint.bones[ikConstraint.bones.length - 1];
					while (true) {
						if (current == child) {
							boneCache[ii].push(bone);
							boneCache[ii + 1].push(bone);
							continue outer;
						}
						if (child == parent) break;
						child = child.parent;
					}
				}
				current = current.parent;
			} while (current);
			nonIkBones[nonIkBones.length] = bone;
		}
	}