Movatterモバイル変換


[0]ホーム

URL:


SciPy

numpy.ma.identity

numpy.ma.identity(n,dtype=None) = <numpy.ma.core._convert2ma object>

Return the identity array.

The identity array is a square array with ones onthe main diagonal.

Parameters:
n:int

Number of rows (and columns) inn xn output.

dtype:data-type, optional

Data-type of the output. Defaults tofloat.

Returns:
out:ndarray

n xn array with its main diagonal set to one,and all other elements 0.

Examples

>>>np.identity(3)array([[ 1.,  0.,  0.],       [ 0.,  1.,  0.],       [ 0.,  0.,  1.]])

Previous topic

numpy.ma.dot

Next topic

numpy.ma.inner

Quick search

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

[8]ページ先頭

©2009-2025 Movatter.jp