numpy.add.at
来源:互联网 发布:挖矿软件 编辑:程序博客网 时间:2024/06/06 21:15
numpy.ufunc.at
ufunc.at(a, indices, b=None)
Performs unbuffered in place operation on operand ‘a’ for elements specified by ‘indices’. For addition ufunc, this method is equivalent to a[indices] += b, except that results are accumulated for elements that are indexed more than once. For example, a[[0,0]] += 1 will only increment the first element once because of buffering, whereas add.at(a, [0,0], 1) will increment the first element twice.
Parameters:
a : array_like
The array to perform in place operation on.
indices : array_like or tuple
Array like index object or slice object for indexing into first operand. If first operand has multiple dimensions, indices can be a tuple of array like index objects or slice objects.
b : array_like
Second operand for ufuncs requiring two operands. Operand must be broadcastable over first operand after indexing or slicing.
Examples
Set items 0 and 1 to their negative values:>>> a = np.array([1, 2, 3, 4])>>> np.negative.at(a, [0, 1])>>> print(a)array([-1, -2, 3, 4])Increment items 0 and 1, and increment item 2 twice:>>> a = np.array([1, 2, 3, 4])>>> np.add.at(a, [0, 1, 2, 2], 1)>>> print(a)array([2, 3, 5, 4])#Add items 0 and 1 in first array to second array, and store results in first array:>>> a = np.array([1, 2, 3, 4])>>> b = np.array([1, 2])>>> np.add.at(a, [0, 1], b)>>> print(a)array([2, 4, 3, 4])
https://docs.scipy.org/doc/numpy/reference/generated/numpy.ufunc.at.html#numpy.ufunc.at
- numpy函数:numpy.add.at
- numpy.add.at
- MultiValueDictKeyError at/add/错误解决
- MultiValueDictKeyError at /add/27/34/
- add Ringtone at phone ringtone
- DevExpress Add ASPxGridView template columns at runtime
- 【python学习笔记】23:numpy的add和multiply
- How to add an editable checkbox at JFace TableViewer
- at - delete or add jobs for later execution.
- How can I add properties to an object at runtime?
- Numpy
- numpy
- numpy
- Numpy
- numpy
- numpy
- numpy
- NumPy
- R语言分析股票指数的GARCH效应
- PHP的函数基础知识
- 面试题12. 打印1到最大的n位数
- Linux下*.tar.gz文件解压缩命令
- Activiti进阶(九)——接收任务(ReceiveTask)
- numpy.add.at
- C语言(Head First C)-7:数据结构与动态存储
- eclipse中js文件报missing semicolon
- poj2253 Frogger +poj1797Heavy Transpotaion(最短路dijkstra变式)
- [LeetCode] 547. Friend Circles
- 斐波那契额数列
- RedHat下GCC及G++的安装
- 小div在大div里面水平垂直都居中的实现方法
- python scapy 命令