Array of vector lengths
335852
def length(self):
        """"""
        return np.sqrt(np.sum(self**2, axis=1)).view(np.ndarray)
283850
def normalize_std_array(vector):
  """"""

  # Initializes variables
  length = 1
  n_samples = len(vector)
  mean = numpy.ndarray((length,), 'float64')
  std = numpy.ndarray((length,), 'float64')
  mean.fill(0)
  std.fill(0)

  # Computes mean and variance
  for array in vector:
    x = array.astype('float64')
    mean += x
    std += (x ** 2)

  mean /= n_samples
  std /= n_samples
  std -= (mean ** 2)
  std = std ** 0.5
  arrayset = numpy.ndarray(shape=(n_samples,mean.shape[0]), dtype=numpy.float64)

  for i in range (0, n_samples):
    arrayset[i,:] = (vector[i]-mean) / std
  return arrayset
935929
def vector_distance(a, b):
    """"""
    a = np.array(a)
    b = np.array(b)
    return np.linalg.norm(a - b)
1047790
function __getLengthByArrayBuffers(data) {
	let length = 0;
	for (let key in data) {
		length += data[key].byteLength;
	}
	return length;
}
1246229
def arr_to_vector(arr):
    
    dim = array_dim(arr)
    tmp_arr = []
    for n in range(len(dim) - 1):
        for inner in arr:
            for i in inner:
                tmp_arr.append(i)
        arr = tmp_arr
        tmp_arr = []
    return arr
979918
function createDistanceArray(input, distance) {
  var length = input.length
  var matrix = new Array(length)
  for (var i = 0; i < length; i++) {
    matrix[i] = new Array(i)
    for (var j = 0; j < i; j++)
      matrix[i][j] = distance(input[i], input[j])
  }

  return matrix
}
1233779
private static int[] getStrides(int[] dims) {
        int rightmost = dims.length - 1;
        int[] strides = new int[dims.length];
        if (dims.length > 0) {          
            strides[rightmost] = 1;
            for (int i=rightmost-1; i >= 0; i--) {
                strides[i] = dims[i+1]*strides[i+1];
            }
        }
        return strides;
    }
1292876
function zeros (length) {
  const arr = []
  for (let i = 0; i < length; i++) {
    arr.push(0)
  }
  return arr
}
109038
def segment_array(arr, length, overlap=.5):
    

    arr = N.array(arr)

    offset = float(overlap) * length
    total_segments = int((N.shape(arr)[0] - length) / offset) + 1
    # print "total segments", total_segments

    other_shape = N.shape(arr)[1:]
    out_shape = [total_segments, length]
    out_shape.extend(other_shape)

    out = N.empty(out_shape)

    for i in xrange(total_segments):
        out[i][:] = arr[i * offset:i * offset + length]

    return out
177961
def normalize(self):
        """"""
        vlength = self.length()

        #Make sure the length isn't 0
        if vlength > 0:
            self.x /= vlength
            self.y /= vlength
            self.z /= vlength
        else:
            return Vector3(0, 0, 0)
29686
function createWithDimensions(dims, val){
    if(!Array.isArray(dims)) throw new Error("dims must be an array.");
    if(undef(val)) throw new Error("val must be defined.");
    
    const l = dims[dims.length - 1];
    const nextDims = dims.slice(0, -1);
    const array = new Array(l).fill(val);

    if(nextDims.length === 0) return new Vector(array);
    return createWithDimensions(nextDims, array);
}
1106441
function(length) {

        var dividerPoint = this.pointAtLength(length);

        // return array with two new lines
        return [
            new Line(this.start, dividerPoint),
            new Line(dividerPoint, this.end)
        ];
    }
329155
def array_map(f, ar):
    ""
    flat_ar = ravel(ar)
    out = zeros(len(flat_ar), flat_ar.typecode())
    for i in range(len(flat_ar)):
        out[i] = f(flat_ar[i])
    out.shape = ar.shape
    return out
78751
function vectorParams (options, input) {
  if (!input && typeof options === 'string') {
    options = { input: options }
  }
  options = options || {}
  let params = Object.assign({}, defaultsVectorParams, options)
  params.input = input || params.input
  return params
}
592756
function validateArrayLengths(len1, len2) {
  var outputLen = len1;
  if (len1 !== len2) {
    if (len1 === 1) {
      outputLen = len2;
    } else if (len2 !== 1) {
      throw new Error('incompatible array lengths: ' + len1 + ' and ' +
        len2);
    }
  }
  return outputLen;
}
1232116
function (x) {
        if (x.length === 2) {
            return new THREE.Vector2(x[0], x[1]);
        } else if (x.length === 3) {
            return new THREE.Vector3(x[0], x[1], x[2]);
        }
    }
130831
public static int getLength(Object array) {
        if (array instanceof Object[]) {
            return ((Object[]) array).length;
        } else if (array instanceof boolean[]) {
            return ((boolean[]) array).length;
        }