Did I find the right examples for you? yes no

All Samples(16)  |  Call(10)  |  Derive(0)  |  Import(6)
Matrix of ones.

Return a matrix of given shape and type, filled with ones.

Parameters
----------
shape : {sequence of ints, int}
    Shape of the matrix
dtype : data-type, optional
    The desired data-type for the matrix, default is np.float64.(more...)

        def ones(shape, dtype=None, order='C'):
    """
    Matrix of ones.

    Return a matrix of given shape and type, filled with ones.

    Parameters
    ----------
    shape : {sequence of ints, int}
        Shape of the matrix
    dtype : data-type, optional
        The desired data-type for the matrix, default is np.float64.
    order : {'C', 'F'}, optional
        Whether to store matrix in C- or Fortran-contiguous order,
        default is 'C'.

    Returns
    -------
    out : matrix
        Matrix of ones of given shape, dtype, and order.

    See Also
    --------
    ones : Array of ones.
    matlib.zeros : Zero matrix.

    Notes
    -----
    If `shape` has length one i.e. ``(N,)``, or is a scalar ``N``,
    `out` becomes a single row matrix of shape ``(1,N)``.

    Examples
    --------
    >>> np.matlib.ones((2,3))
    matrix([[ 1.,  1.,  1.],
            [ 1.,  1.,  1.]])

    >>> np.matlib.ones(2)
    matrix([[ 1.,  1.]])

    """
    a = ndarray.__new__(matrix, shape, dtype, order=order)
    a.fill(1)
    return a
        


src/d/o/dolo-0.4.6.3/dolo/numeric/extern/helpers.py   dolo(Download)
from numpy import r_, c_, arange, diff, mean, sqrt, log, mat
from numpy import asarray, nan
from numpy.matlib import ones, zeros, rand, eye, empty
from numpy.linalg import eigh, cholesky, solve, lstsq
# (lstsq also as tool to determine rank)
        for row in range(p):
            # (must be ones() instead of 1 because of 2d-requirement
            if lstsq( m[row,:], ones(1) )[2] == 0 or idrcount >= r:
                c = r_[ c, zeros(r) ]
                co = r_[ co, idpr[row-idrcount, :] ]
    else: return temp
 
from numpy.matlib import empty, ones, zeros
from numpy import mat, c_, r_
def getDeterministics(nobs, which = 'c', date = 0.5):
        out = c_[ out, slopeshift ]
    if 'i' in which:
        impulse = r_[ zeros(shiftperiod).T, ones(1), zeros(nobs-shiftperiod-1).T ]
        out = c_[ out, impulse ]
    if 'q' in which or 'Q' in which:
    else: return result
 
from numpy.matlib import ones, zeros, mat
from numpy.linalg import solve
def commontrendstest(series, LagTrunc=4, determ = 'c', breakpoint=0.5):

src/d/o/dolo-HEAD/dolo/numeric/extern/helpers.py   dolo(Download)
from numpy import r_, c_, arange, diff, mean, sqrt, log, mat
from numpy import asarray, nan
from numpy.matlib import ones, zeros, rand, eye, empty
from numpy.linalg import eigh, cholesky, solve, lstsq
# (lstsq also as tool to determine rank)
        for row in range(p):
            # (must be ones() instead of 1 because of 2d-requirement
            if lstsq( m[row,:], ones(1) )[2] == 0 or idrcount >= r:
                c = r_[ c, zeros(r) ]
                co = r_[ co, idpr[row-idrcount, :] ]
    else: return temp
 
from numpy.matlib import empty, ones, zeros
from numpy import mat, c_, r_
def getDeterministics(nobs, which = 'c', date = 0.5):
        out = c_[ out, slopeshift ]
    if 'i' in which:
        impulse = r_[ zeros(shiftperiod).T, ones(1), zeros(nobs-shiftperiod-1).T ]
        out = c_[ out, impulse ]
    if 'q' in which or 'Q' in which:
    else: return result
 
from numpy.matlib import ones, zeros, mat
from numpy.linalg import solve
def commontrendstest(series, LagTrunc=4, determ = 'c', breakpoint=0.5):

src/n/u/nupic-linux64-HEAD/lib64/python2.6/site-packages/numpy/tests/test_matlib.py   nupic-linux64(Download)
def test_ones():
    assert_array_equal(np.matlib.ones((2, 3)),
                       np.matrix([[ 1.,  1.,  1.],
                                 [ 1.,  1.,  1.]]))
 
    assert_array_equal(np.matlib.ones(2), np.matrix([[ 1.,  1.]]))

src/m/i/MissionPlanner-HEAD/Lib/site-packages/numpy/tests/test_matlib.py   MissionPlanner(Download)
def test_ones():
    assert_array_equal(np.matlib.ones((2, 3)),
                       np.matrix([[ 1.,  1.,  1.],
                                 [ 1.,  1.,  1.]]))
 
    assert_array_equal(np.matlib.ones(2), np.matrix([[ 1.,  1.]]))

src/n/u/numpy-1.8.1/numpy/tests/test_matlib.py   numpy(Download)
def test_ones():
    assert_array_equal(np.matlib.ones((2, 3)),
                       np.matrix([[ 1.,  1.,  1.],
                                 [ 1.,  1.,  1.]]))
 
    assert_array_equal(np.matlib.ones(2), np.matrix([[ 1.,  1.]]))