Movatterモバイル変換


[0]ホーム

URL:


SciPy

numpy.matrix.setfield

matrix.setfield(val,dtype,offset=0)

Put a value into a specified place in a field defined by a data-type.

Placeval intoa‘s field defined bydtype and beginningoffsetbytes into the field.

Parameters:

val : object

Value to be placed in field.

dtype : dtype object

Data-type of the field in which to placeval.

offset : int, optional

The number of bytes into the field at which to placeval.

Returns:

None

See also

getfield

Examples

>>>x=np.eye(3)>>>x.getfield(np.float64)array([[ 1.,  0.,  0.],       [ 0.,  1.,  0.],       [ 0.,  0.,  1.]])>>>x.setfield(3,np.int32)>>>x.getfield(np.int32)array([[3, 3, 3],       [3, 3, 3],       [3, 3, 3]])>>>xarray([[  1.00000000e+000,   1.48219694e-323,   1.48219694e-323],       [  1.48219694e-323,   1.00000000e+000,   1.48219694e-323],       [  1.48219694e-323,   1.48219694e-323,   1.00000000e+000]])>>>x.setfield(np.eye(3),np.int32)>>>xarray([[ 1.,  0.,  0.],       [ 0.,  1.,  0.],       [ 0.,  0.,  1.]])

Previous topic

numpy.matrix.searchsorted

Next topic

numpy.matrix.setflags

  • © Copyright 2008-2009, The Scipy community.
  • Last updated on Jun 10, 2017.
  • Created usingSphinx 1.5.3.

[8]ページ先頭

©2009-2025 Movatter.jp