numpy的matrix
矩阵是一个专门的二维数组,通过操作保持其二维性质。 它有一些特殊的运算符,如*(矩阵乘法)和**(矩阵幂)。
Attributes
A |
Return self as an ndarray object. |
A1 |
Return self as a flattened ndarray. |
H |
Returns the (complex) conjugate transpose of self. |
I |
Returns the (multiplicative) inverse of invertible self. |
T |
Returns the transpose of the matrix. |
base |
Base object if memory is from some other object. |
ctypes |
An object to simplify the interaction of the array with the ctypes module. |
data |
Python buffer object pointing to the start of the array’s data. |
dtype |
Data-type of the array’s elements. |
flags |
Information about the memory layout of the array. |
flat |
A 1-D iterator over the array. |
imag |
The imaginary part of the array. |
itemsize |
Length of one array element in bytes. |
nbytes |
Total bytes consumed by the elements of the array. |
ndim |
Number of array dimensions. |
real |
The real part of the array. |
shape |
Tuple of array dimensions. |
size |
Number of elements in the array. |
strides |
Tuple of bytes to step in each dimension when traversing an array. |
Methods
all([axis, out]) |
Test whether all matrix elements along a given axis evaluate to True. |
any([axis, out]) |
Test whether any array element along a given axis evaluates to True. |
argmax([axis, out]) |
Indexes of the maximum values along an axis. |
argmin([axis, out]) |
Indexes of the minimum values along an axis. |
argpartition(kth[, axis, kind, order]) |
Returns the indices that would partition this array. |
argsort([axis, kind, order]) |
Returns the indices that would sort this array. |
astype(dtype[, order, casting, subok, copy]) |
Copy of the array, cast to a specified type. |
byteswap(inplace) |
Swap the bytes of the array elements |
choose(choices[, out, mode]) |
Use an index array to construct a new array from a set of choices. |
clip([min, max, out]) |
Return an array whose values are limited to [min, max]. |
compress(condition[, axis, out]) |
Return selected slices of this array along given axis. |
conj() |
Complex-conjugate all elements. |
conjugate() |
Return the complex conjugate, element-wise. |
copy([order]) |
Return a copy of the array. |
cumprod([axis, dtype, out]) |
Return the cumulative product of the elements along the given axis. |
cumsum([axis, dtype, out]) |
Return the cumulative sum of the elements along the given axis. |
diagonal([offset, axis1, axis2]) |
Return specified diagonals. |
dot(b[, out]) |
Dot product of two arrays. |
dump(file) |
Dump a pickle of the array to the specified file. |
dumps() |
Returns the pickle of the array as a string. |
fill(value) |
Fill the array with a scalar value. |
flatten([order]) |
Return a flattened copy of the matrix. |
getA() |
Return self as an ndarray object. |
getA1() |
Return self as a flattened ndarray. |
getH() |
Returns the (complex) conjugate transpose of self. |
getI() |
Returns the (multiplicative) inverse of invertible self. |
getT() |
Returns the transpose of the matrix. |
getfield(dtype[, offset]) |
Returns a field of the given array as a certain type. |
item(*args) |
Copy an element of an array to a standard Python scalar and return it. |
itemset(*args) |
Insert scalar into an array (scalar is cast to array’s dtype, if possible) |
max([axis, out]) |
Return the maximum value along an axis. |
mean([axis, dtype, out]) |
Returns the average of the matrix elements along the given axis. |
min([axis, out]) |
Return the minimum value along an axis. |
newbyteorder([new_order]) |
Return the array with the same data viewed with a different byte order. |
nonzero() |
Return the indices of the elements that are non-zero. |
partition(kth[, axis, kind, order]) |
Rearranges the elements in the array in such a way that value of the element in kth position is in the position it would be in a sorted array. |
prod([axis, dtype, out]) |
Return the product of the array elements over the given axis. |
ptp([axis, out]) |
Peak-to-peak (maximum - minimum) value along the given axis. |
put(indices, values[, mode]) |
Set a.flat[n] = values[n] for all n in indices. |
ravel([order]) |
Return a flattened matrix. |
repeat(repeats[, axis]) |
Repeat elements of an array. |
reshape(shape[, order]) |
Returns an array containing the same data with a new shape. |
resize(new_shape[, refcheck]) |
Change shape and size of array in-place. |
round([decimals, out]) |
Return a with each element rounded to the given number of decimals. |
searchsorted(v[, side, sorter]) |
Find indices where elements of v should be inserted in a to maintain order. |
setfield(val, dtype[, offset]) |
Put a value into a specified place in a field defined by a data-type. |
setflags([write, align, uic]) |
Set array flags WRITEABLE, ALIGNED, and UPDATEIFCOPY, respectively. |
sort([axis, kind, order]) |
Sort an array, in-place. |
squeeze([axis]) |
Return a possibly reshaped matrix. |
std([axis, dtype, out, ddof]) |
Return the standard deviation of the array elements along the given axis. |
sum([axis, dtype, out]) |
Returns the sum of the matrix elements, along the given axis. |
swapaxes(axis1, axis2) |
Return a view of the array with axis1 and axis2 interchanged. |
take(indices[, axis, out, mode]) |
Return an array formed from the elements of a at the given indices. |
tobytes([order]) |
Construct Python bytes containing the raw data bytes in the array. |
tofile(fid[, sep, format]) |
Write array to a file as text or binary (default). |
tolist() |
Return the matrix as a (possibly nested) list. |
tostring([order]) |
Construct Python bytes containing the raw data bytes in the array. |
trace([offset, axis1, axis2, dtype, out]) |
Return the sum along diagonals of the array. |
transpose(*axes) |
Returns a view of the array with axes transposed. |
var([axis, dtype, out, ddof]) |
Returns the variance of the matrix elements, along the given axis. |
view([dtype, type]) |
New view of array with the same data. |
属性
A 将自己作为ndarray对象返回。
A1 作为一个扁平的ndarray回归自我。
H 返回自我的(复数)共轭转置。
I 返回可逆自我的(乘法)倒数。
T 返回矩阵的转置。
base 如果内存来自其他对象,则为基本对象。
ctypes 一个对象,用于简化数组与ctypes模块的交互。
data Python缓冲区对象指向数组的数据的开始。
dtype 数组元素的数据类型。
flags 关于数组的内存布局的信息。
flat 在数组上的一维迭代器。
imag 数组的虚部。
itemsize 一个数组元素的长度(以字节为单位)。
nbytes 数组元素消耗的总字节数。
ndim 数组维数。
real 数组的实际部分。
shape 数组维度的形状元组。
size 数组中元素的数量。
strides 遍历数组时遍历每个维度的字节元组。
A 将自己作为ndarray对象返回。
A1 作为一个扁平的ndarray回归自我。
H 返回自我的(复数)共轭转置。
I 返回可逆自我的(乘法)倒数。
T 返回矩阵的转置。
base 如果内存来自其他对象,则为基本对象。
ctypes 一个对象,用于简化数组与ctypes模块的交互。
data Python缓冲区对象指向数组的数据的开始。
dtype 数组元素的数据类型。
flags 关于数组的内存布局的信息。
flat 在数组上的一维迭代器。
imag 数组的虚部。
itemsize 一个数组元素的长度(以字节为单位)。
nbytes 数组元素消耗的总字节数。
ndim 数组维数。
real 数组的实际部分。
shape 数组维度的形状元组。
size 数组中元素的数量。
strides 遍历数组时遍历每个维度的字节元组。
方法
all([axis,out]) 测试给定轴上的所有矩阵元素是否为True。
any([axis,out]) 测试给定轴上的任何数组元素是否为True。
argmax([axis,out]) 沿轴的最大值的索引。
argmin([axis,out]) 沿轴的最小值的索引。
argpartition(kth [,axis,kind,order]) 返回将对此数组进行分区的索引。
argsort([axis,kind,order]) 返回将对此数组进行排序的索引。
astype(dtype [,order,casting,subok,copy]) 复制数组,转换为指定的类型。
byteswap(inplace) 交换数组元素的字节
choose(choices[,out, mode]) 使用索引数组从一组选择构造一个新的数组。
clip([min,max,out]) 返回数值限制为[min,max]的数组。
compress(condition [,axis,out]) 沿给定轴返回此数组的选定切片。
conj() 复合共轭所有元素。
conjugate() 返回复数共轭,元素明智。
copy([order]) 返回数组的一个副本。
cumprod([axis,dtype,out]) 返回给定轴上元素的累积积。
cumsum([axis,dtype,out]) 返回沿给定轴的元素的累积和。
diagonal([offset,axis1,axis2]) 返回指定的对角线。
dot(b [,out]) 两个数组的点积。
dump(file) 将数组的pickle转储到指定的文件。
dumps() 以字符串的形式返回数组的pickle。
fill(value) 用标量值填充数组。
flatten([order]) 返回矩阵的平面副本。
getA() 将自己作为一个ndarray对象返回。
getA1() 返回自我作为一个扁平的ndarray。
getH() 返回自我的(复数)共轭转置。
getI() 返回可逆自我的(乘法)倒数。
getT() 返回矩阵的转置。
getfield(dtype [,offset]) 以给定类型返回给定数组的字段。
item(* args) 将数组的元素复制到标准的Python标量并返回。
itemset(* args) 将标量插入数组(标量转换为数组的dtype,如果可能的话)
max([axis,out]) 沿轴返回最大值。
mean([axis,dtype,out]) 返回沿给定轴的矩阵元素的平均值。
min([axis,out]) 沿轴返回最小值。
newbyteorder([new_order]) 以不同的字节顺序查看以相同的数据查看的数组。
nonzero() 返回非零元素的索引。
partition(kth [,axis,kind,order]) 以这样的方式重新排列数组中的元素,即第k个元素的值位于排序数组中的位置。
prod([axis,dtype,out]) 返回给定轴上的数组元素的乘积。
ptp([axis,out]) 沿给定轴的峰 - 峰值(最大值 - 最小值)。
put(indices,values [,mode]) 为索引中的所有n设置a.flat [n] = values [n]。
ravel([order]) 返回一个扁平的矩阵。
repeat(repeats[,axis]) 重复数组的元素。
reshape(shape [,order]) 返回包含具有新形状的相同数据的数组。
resize(new_shape [,refcheck]) 就地改变数组的形状和大小。
round([decimals,out]) 将每个元素返回到给定的小数位数。
searchsorted(v [,side,sorter]) 查找v中元素应该插入的索引以保持顺序。
setfield(val,dtype [,offset]) 将值放入由数据类型定义的字段中的指定位置。
setflags([write,align,uic]) 分别设置数组标志WRITEABLE,ALIGNED和UPDATEIFCOPY。
sort([axis,kind,order]) 对数组进行排序。
squeeze([axis]) 返回一个可能重新塑造的矩阵。
std([axis,dtype,out,ddof]) 返回给定轴的数组元素的标准偏差。
sum([axis,dtype,out]) 返回沿给定轴的矩阵元素的总和。
swapaxes(axis1,axis2) 返回轴1和轴2互换的数组视图。
take(indices [,axis,out,mode]) 返回由给定索引处的a元素组成的数组。
tobytes([order]) 构造包含数组中原始数据字节的Python字节。
tofile(fid [,sep,format]) 以文本或二进制形式将数组写入文件(默认)。
tolist() 将矩阵作为(可能嵌套的)列表返回。
tostring([order]) 构造包含数组中原始数据字节的Python字节。
trace([offset,axis1,axis2,dtype,out]) 沿着数组的对角线返回和。
transpose(*axes) 返回轴转置阵列的视图。
var([axis,dtype,out,ddof]) 返回沿给定轴的矩阵元素的方差。
view([dtype,type]) 具有相同数据的数组的新视图。
any([axis,out]) 测试给定轴上的任何数组元素是否为True。
argmax([axis,out]) 沿轴的最大值的索引。
argmin([axis,out]) 沿轴的最小值的索引。
argpartition(kth [,axis,kind,order]) 返回将对此数组进行分区的索引。
argsort([axis,kind,order]) 返回将对此数组进行排序的索引。
astype(dtype [,order,casting,subok,copy]) 复制数组,转换为指定的类型。
byteswap(inplace) 交换数组元素的字节
choose(choices[,out, mode]) 使用索引数组从一组选择构造一个新的数组。
clip([min,max,out]) 返回数值限制为[min,max]的数组。
compress(condition [,axis,out]) 沿给定轴返回此数组的选定切片。
conj() 复合共轭所有元素。
conjugate() 返回复数共轭,元素明智。
copy([order]) 返回数组的一个副本。
cumprod([axis,dtype,out]) 返回给定轴上元素的累积积。
cumsum([axis,dtype,out]) 返回沿给定轴的元素的累积和。
diagonal([offset,axis1,axis2]) 返回指定的对角线。
dot(b [,out]) 两个数组的点积。
dump(file) 将数组的pickle转储到指定的文件。
dumps() 以字符串的形式返回数组的pickle。
fill(value) 用标量值填充数组。
flatten([order]) 返回矩阵的平面副本。
getA() 将自己作为一个ndarray对象返回。
getA1() 返回自我作为一个扁平的ndarray。
getH() 返回自我的(复数)共轭转置。
getI() 返回可逆自我的(乘法)倒数。
getT() 返回矩阵的转置。
getfield(dtype [,offset]) 以给定类型返回给定数组的字段。
item(* args) 将数组的元素复制到标准的Python标量并返回。
itemset(* args) 将标量插入数组(标量转换为数组的dtype,如果可能的话)
max([axis,out]) 沿轴返回最大值。
mean([axis,dtype,out]) 返回沿给定轴的矩阵元素的平均值。
min([axis,out]) 沿轴返回最小值。
newbyteorder([new_order]) 以不同的字节顺序查看以相同的数据查看的数组。
nonzero() 返回非零元素的索引。
partition(kth [,axis,kind,order]) 以这样的方式重新排列数组中的元素,即第k个元素的值位于排序数组中的位置。
prod([axis,dtype,out]) 返回给定轴上的数组元素的乘积。
ptp([axis,out]) 沿给定轴的峰 - 峰值(最大值 - 最小值)。
put(indices,values [,mode]) 为索引中的所有n设置a.flat [n] = values [n]。
ravel([order]) 返回一个扁平的矩阵。
repeat(repeats[,axis]) 重复数组的元素。
reshape(shape [,order]) 返回包含具有新形状的相同数据的数组。
resize(new_shape [,refcheck]) 就地改变数组的形状和大小。
round([decimals,out]) 将每个元素返回到给定的小数位数。
searchsorted(v [,side,sorter]) 查找v中元素应该插入的索引以保持顺序。
setfield(val,dtype [,offset]) 将值放入由数据类型定义的字段中的指定位置。
setflags([write,align,uic]) 分别设置数组标志WRITEABLE,ALIGNED和UPDATEIFCOPY。
sort([axis,kind,order]) 对数组进行排序。
squeeze([axis]) 返回一个可能重新塑造的矩阵。
std([axis,dtype,out,ddof]) 返回给定轴的数组元素的标准偏差。
sum([axis,dtype,out]) 返回沿给定轴的矩阵元素的总和。
swapaxes(axis1,axis2) 返回轴1和轴2互换的数组视图。
take(indices [,axis,out,mode]) 返回由给定索引处的a元素组成的数组。
tobytes([order]) 构造包含数组中原始数据字节的Python字节。
tofile(fid [,sep,format]) 以文本或二进制形式将数组写入文件(默认)。
tolist() 将矩阵作为(可能嵌套的)列表返回。
tostring([order]) 构造包含数组中原始数据字节的Python字节。
trace([offset,axis1,axis2,dtype,out]) 沿着数组的对角线返回和。
transpose(*axes) 返回轴转置阵列的视图。
var([axis,dtype,out,ddof]) 返回沿给定轴的矩阵元素的方差。
view([dtype,type]) 具有相同数据的数组的新视图。

浙公网安备 33010602011771号