Creates NDArray filled with zeros

```
zeros(2) // Creates array of zeros of length 2
zeros([2,2,2]) // Create 2x2x2 matrix of zeros
zeros(2,'i16') // Creates array of 2 16-bit integers filled with zeros
```
9421
function zeros(arg0, datatype) {
    var A;
    if (Array.isArray(arg0)) {
        A = new ndarray_1.NDArray({ shape: arg0, datatype: datatype });
    }
    else {
        A = new ndarray_1.NDArray({ shape: [arg0], datatype: datatype });
    }
    A.fill(0);
    return A;
}
85828
def write_ndarray(self, result, dst_paths, nodata=None, compress='lzw'):
        """"""

        assert len(dst_paths) == result.shape[2]
        assert result.shape[0] == self._height
        assert result.shape[1] == self._width
        assert result.shape[2] == len(dst_paths)
        with rasterio.open(self._mrio._get_template_for_given_resolution(self._mrio.dst_res, "path")) as src_layer:
            pass # later we need src_layer for src_layer.window_transform(win)
        for i, pth in enumerate(dst_paths):
            dst_path_chunk = self.get_chunk_path_from_layer_path(pth, self.ji)

            result_layer_i = result[:, :, [i]]
            assert result_layer_i.shape[2] == 1
            kwargs = self._mrio._get_template_for_given_resolution(
                res=self._mrio.dst_res, return_="meta").copy()
            kwargs.update({"driver": "GTiff",
                           "compress": compress,
                           "nodata": nodata,
                           "height": self._height,
                           "width": self._width,
                           "dtype": result_layer_i.dtype,
                           "transform": src_layer.window_transform(self._window)})
            with rasterio.open(dst_path_chunk, "w", **kwargs) as dst:
                dst.write(result_layer_i[:, :, 0], 1)
1338673
def bin(args):
    
    p = OptionParser(bin.__doc__)
    p.add_option("--dtype", choices=("float32", "int32"),
                 help="dtype of the matrix")
    opts, args = p.parse_args(args)

    if len(args) != 1:
        sys.exit(not p.print_help())

    tsvfile, = args
    dtype = opts.dtype
    if dtype is None:  # Guess
        dtype = np.int32 if "data" in tsvfile else np.float32
    else:
        dtype = np.int32 if dtype == "int32" else np.float32

    print("dtype: {}".format(dtype), file=sys.stderr)
    fp = open(tsvfile)
    next(fp)
    arrays = []
    for i, row in enumerate(fp):
        a = np.fromstring(row, sep="\t", dtype=dtype)
        a = a[1:]
        arrays.append(a)
        print(i, a, file=sys.stderr)

    print("Merging", file=sys.stderr)
    b = np.concatenate(arrays)
    print("Binary shape: {}".format(b.shape), file=sys.stderr)
    binfile = tsvfile.rsplit(".", 1)[0] + ".bin"
    b.tofile(binfile)
1130715
def get_numpy_array(self):
        
        # This holds the obect's spectral data, and will be passed to
        # numpy.array() to create a numpy array (matrix) for the matrix math
        # that will be done during the conversion to XYZ.
        values = []

        # Use the required value list to build this dynamically. Default to
        # 0.0, since that ultimately won't affect the outcome due to the math
        # involved.
        for val in self.VALUES:
            values.append(getattr(self, val, 0.0))

        # Create and the actual numpy array/matrix from the spectral list.
        color_array = numpy.array([values])
        return color_array
1365264
def zero2d(self):
        
        return type(self)(x=np.atleast_2d(np.zeros((self.shape[0],self.shape[1]))),
                   row_names=self.row_names,
                   col_names=self.col_names,
                   isdiagonal=False)
481806
def _make_indices(self, Ns):
        '''  '''
        N_new = int(Ns * self.n_splits)

        test = [np.full(N_new, False) for i in range(self.n_splits)]
        for i in range(self.n_splits):
            test[i][np.arange(Ns * i, Ns * (i + 1))] = True
        train = [np.logical_not(test[i]) for i in range(self.n_splits)]

        test = [np.arange(N_new)[test[i]] for i in range(self.n_splits)]
        train = [np.arange(N_new)[train[i]] for i in range(self.n_splits)]

        cv = list(zip(train, test))
        return cv
1206682
def delta(n, d=None, center=0):
    
    if isinstance(n, six.integer_types):
        n = [n]
    if d is None:
        n0 = _np.asanyarray(n, dtype=_np.int32)
    else:
        n0 = _np.array(n * d, dtype=_np.int32)
    d = n0.size

    if center < 0:
        cind = [0] * d
    else:
        cind = []
        for i in xrange(d):
            cind.append(center % n0[i])
            center //= n0[i]
        if center > 0:
            cind = [0] * d
    cr = []
    for i in xrange(d):
        cur_core = _np.zeros((1, n0[i], 1))
        cur_core[0, cind[i], 0] = 1
        cr.append(cur_core)
    return _vector.vector.from_list(cr)
430908
def _ndarray_assoc(arr, k, v):
    ''
    arr = np.array(arr)
    arr[k] = v
    arr.setflags(write=False)
    return arr
584803
def jenks(data, num_breaks):
    

    data = numpy.ma.compressed(data)
    if len(data) > 1000:
        data.sort()
        ls = numpy.linspace(0, len(data)-1, 1000)
        ls = [int(round(x)) for x in ls]
        data_list = data[ls]
    else:
        data_list = data

    data_list.sort()

    mat1 = []
    for i in range(0, len(data_list) + 1):
        temp = []
        for j in range(0, num_breaks + 1):
            temp.append(0)
        mat1.append(temp)

    mat2 = []
    for i in range(0, len(data_list) + 1):
        temp = []
        for j in range(0, num_breaks + 1):
            temp.append(0)
        mat2.append(temp)

    for i in range(1, num_breaks + 1):
        mat1[1][i] = 1
        mat2[1][i] = 0
        for j in range(2, len(data_list) + 1):
            mat2[j][i] = float('inf')

    v = 0.0
    for l in range(2, len(data_list) + 1):
        s1 = 0.0
        s2 = 0.0
        w = 0.0
        for m in range(1, l + 1):
            i3 = l - m + 1

            val = float(data_list[i3-1])

            s2 += val * val
            s1 += val

            w += 1
            v = s2 - (s1 * s1) / w
            i4 = i3 - 1

            if i4 != 0:
                for j in range(2, num_breaks + 1):
                    if mat2[l][j] >= (v + mat2[i4][j - 1]):
                        mat1[l][j] = i3
                        mat2[l][j] = v + mat2[i4][j - 1]

        mat1[l][1] = 1
        mat2[l][1] = v

    k = len(data_list)
    kclass = []
    for i in range(0, num_breaks + 1):
        kclass.append(0)

    kclass[num_breaks] = float(data_list[len(data_list) - 1])

    count_num = num_breaks
    while count_num >= 2:
        id = int((mat1[k][count_num]) - 2)

        kclass[count_num - 1] = data_list[id]
        k = int((mat1[k][count_num] - 1))
        count_num -= 1

    return [float(x) for x in kclass][1:]
791320
def trim_zeros(self):
              
        tmp = self.numpy()
        f = len(self)-len(_numpy.trim_zeros(tmp, trim='f'))
        b = len(self)-len(_numpy.trim_zeros(tmp, trim='b'))
        return self[f:len(self)-b]
187568
def to_0d_array(value: Any) -> np.ndarray:
    
    if np.isscalar(value) or (isinstance(value, np.ndarray) and
                              value.ndim == 0):
        return np.array(value)
    else:
        return to_0d_object_array(value)
36769
def image2array(image):
    
    nx, ny = image.shape  # find the size of the array
    imgh = np.reshape(image, nx*ny)  # change the shape to be 1d
    return imgh
672577
function encodeArray_NUM_REPEATED( encoder, data, n_type ) {

	//
	// Repeated Numeric Array (NUM_REPEATED)
	//
	// ....  ...    .   +   Data Length
	// 0100 [TYPE] [LN]    [16bit/32bit]
	//

	encoder.counters.arr_num_repeated+=1;		
	encoder.log(LOG.ARR, "array.numeric.repeated, len="+data.length+
		", type="+_NUMTYPE[n_type]+" ("+n_type+")");

	if (data.length < UINT16_MAX) { // 16-bit length prefix
		encoder.stream8.write( pack1b( ARR_OP.NUM_REPEATED | NUMTYPE_LN.UINT16 | (n_type << 1) ) );
		encoder.stream16.write( pack2b( data.length, false ) );
		encoder.counters.arr_hdr+=3;
	} else { // 32-bit length prefix
		encoder.stream8.write( pack1b( ARR_OP.NUM_REPEATED | NUMTYPE_LN.UINT32 | (n_type << 1) ) );
		encoder.stream32.write( pack4b( data.length, false ) );
		encoder.counters.arr_hdr+=5;
	}

	// Write initial value
	pickStream( encoder, n_type )
		.write( packByNumType[n_type]( data[0] ) );

}
655298
def matrix(self) -> np.ndarray:
        
        num_qubits = self.num_qubits()
        if num_qubits is None:
            raise ValueError('Unknown number of qubits')
        num_dim = 2 ** num_qubits
        result = np.zeros((num_dim, num_dim), dtype=np.complex128)
        for gate, coefficient in self.items():
            result += protocols.unitary(gate) * coefficient
        return result
800199
def zero_pad(ts, n_zeros):
    
    
    zeros_shape = ts.shape[:-1] + (n_zeros,)
    zzs = np.zeros(zeros_shape)
    # Concatenate along the time-dimension:
    new_data = np.concatenate((zzs, ts.data, zzs), axis=-1)

    return nts.TimeSeries(new_data, sampling_rate=ts.sampling_rate)
767159
function() {
            	var rows = this.elements.length;
            	var elements = [];

            	for (var i = 0; i < rows; i++) {
            	    elements.push([this.elements[i]]);
            	}
            	return matrix$2.create(elements);
                }
462115
def tril!(k=0)
      if ndim < 2
        raise NArray::ShapeError, "must be >= 2-dimensional array"
      end
      if contiguous?
        idx = triu_indices(k+1)
        *shp,m,n = shape
        reshape!(*shp,m*n)
        self[false,idx] = 0
        reshape!(*shp,m,n)
      else
        store(tril(k))
      end
    end