Movatterモバイル変換


[0]ホーム

URL:


SciPy

numpy.matlib.ones

numpy.matlib.ones(shape,dtype=None,order='C')[source]

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

Ifshape has length one i.e.(N,), or is a scalarN,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.]])

Previous topic

numpy.matlib.zeros

Next topic

numpy.matlib.eye

Quick search

  • © Copyright 2008-2018, The SciPy community.
  • Last updated on Jul 24, 2018.
  • Created usingSphinx 1.6.6.

[8]ページ先頭

©2009-2025 Movatter.jp