range
返回一个新的NdArray其范围为[top,left]->[bottom,right]
,step为间隔
声明
NdArray range(int top, int bottom, int left, int right, int row_step = 1, int col_step = 1)
参数
参数名 | 描述 |
---|---|
self | 代指当前的NdArray |
top | 范围顶行号 |
bottom | 范围底行号 |
left | 范围左列号 |
right | 范围右列号 |
row_step | 行间隔 |
col_step | 列间隔 |
返回值
范围内矩阵
使用方式
// 从(0, 0)到(2, 5)范围内数据,行间隔为1,列间隔为2
ndarr2.range(0, 2, 0, 5, 1, 2).print();