-
matrix.copy(order='C')
-
Return a copy of the array.
Parameters: order : {?C?, ?F?, ?A?, ?K?}, optional
Controls the memory layout of the copy. ?C? means C-order, ?F? means F-order, ?A? means ?F? if
a
is Fortran contiguous, ?C? otherwise. ?K? means match the layout ofa
as closely as possible. (Note that this function and :func:numpy.copy are very similar, but have different default values for their order= arguments.)See also
Examples
1>>> x
=
np.array([[
1
,
2
,
3
],[
4
,
5
,
6
]], order
=
'F'
)
1>>> y
=
x.copy()
1>>> x.fill(
0
)
123>>> x
array([[
0
,
0
,
0
],
[
0
,
0
,
0
]])
123>>> y
array([[
1
,
2
,
3
],
[
4
,
5
,
6
]])
12>>> y.flags[
'C_CONTIGUOUS'
]
True
matrix.copy()

2025-01-10 15:47:30
Please login to continue.