numpy_operations(Numberical operations on arrays)
来源:互联网 发布:linux不记历史命令 编辑:程序博客网 时间:2024/05/19 04:56
一、Elementwise operations
1、With scalars:
输入:
import numpy as npa = np.array([1, 2, 3, 4])a + 1输出:
array([2, 3, 4, 5])
输入:
2**a输出:
array([ 2, 4, 8, 16])
2、All arithmetic operates elementwise:
输入:b = np.ones(4) + 1#创建一个值全为1的数组,然后再加上1(每个元素都加)ba - b#对应元素进行相减输出:
array([-1., 0., 1., 2.])输入:
a * b输出:
array([ 2., 4., 6., 8.])输入:
j = np.arange(5)2**(j + 1) - j输出:
array([ 2, 3, 6, 13, 28])
3、矩阵乘法:
输入:
c = np.((3,3))c.dot(c) #矩阵乘法输出:
array([[ 3., 3., 3.], [ 3., 3., 3.], [ 3., 3., 3.]])
4、矩阵的比较和位运算:
5、超验功能:
6、形状不匹配的操作
7、上三角矩阵、转置
np.triu为上三角矩阵,np.tril为下三角矩阵
8、矩阵比较:
二、子模块numpy.linalg实现基本的线性代数(Linear algebra),如求解线性系统,奇异值分解等。但是,不能保证使用有效的例程编译,因此我们建议使用scipy.linalg,详细 在scipy_linalg部分
1、和运算(整体求和,按行/列求和)
2、求均值(mean)、中位数(median)、标准差(std)
3、求最大值、最小值、最大指数、最小指数
4、数组内的逻辑运算
5、数组整体的比较
np.zeros((100,100))——产生一个值全部为0的100*100的矩阵
np.all()所有数都进行比较
阅读全文
0 0
- numpy_operations(Numberical operations on arrays)
- OpenCV - Operations on Arrays
- Operations on Arrays in opencv
- OpenCV - Operations on Arrays 对数组(矩阵)的一些操作
- OpenCV - Operations on Arrays 对数组(矩阵)的一些操作
- OpenCV Operations on Arrays 对数组(矩阵)的一些操作
- Operations on Surface_mesh in CGAL
- Operations on edges in polyhedron
- [agc003e]Sequential operations on Sequence
- Time Limited Exceeded => Bit operations (repeated operations on many)
- kuangbinOJ 1217 Operations on Grids (暴搜)
- JS(Coursera):More On Arrays
- Java Arrays.sort() on objects
- Builtin Numberical type in Java
- Operations
- YP2.6 Operations on Bits—Part II: Logical Operations(双语)
- Support of basic operations on Sets in Dynamics AX
- Disallowing cut copy paste operations on a textbox
- java 中==和equals区别详解
- java中的参数传递(值传递等)
- Bargaining Table
- centos7 二进制安装包安装 mysql5.6
- 微信小程序中设置全局变量
- numpy_operations(Numberical operations on arrays)
- 300.11文件的创建和移动
- Leetcode 152-MaximumProductSubarray 解题报告
- UVa1630 Folding 记忆化搜索
- 何为语法糖?
- 问题:浏览器CSS/JS以怪异模式渲染
- D. Clique Problem
- Vue之for循环
- HTC按键代码