当前位置: 首页 > news >正文

广东省石油化工建设集团公司网站网站快速优化排名方法

广东省石油化工建设集团公司网站,网站快速优化排名方法,简历模板免费网页,房地产公司网站开发数组的运算 使⽤NumPy 最为⽅便的是当需要对数组元素进⾏运算时,不⽤编写循环代码遍历每个元素,所有的运算都会⾃动的⽮量化(使⽤⾼效的、提前编译的底层代码来对数据序列进⾏数学操作)。简单的说就是,NumPy 中的数学运…
数组的运算
使⽤ NumPy 最为⽅便的是当需要对数组元素进⾏运算时,不⽤编写循环代码遍历每个元素,所有的运算都会⾃动的⽮量化(使⽤⾼效的、提前编译的底层代码来对数据序列进⾏数学操作)。简单的说就是,NumPy 中的数学运算和数学函数会⾃动作⽤于数组中的每个成员。
数组跟标量的运算
代码:
array35 = np.arange(1, 10)
print(array35 + 10)
print(array35 * 10)
输出:
[11 12 13 14 15 16 17 18 19]
[10 20 30 40 50 60 70 80 90]
数组跟数组的运算
代码:
array36 = np.array([1, 1, 1, 2, 2, 2, 3, 3, 3])
print(array35 + array36)
print(array35 * array36)
print(array35 ** array36)
输出:
[ 2 3 4 6 7 8 10 11 12]
[ 1 2 3 8 10 12 21 24 27]
[ 1 2 3 16 25 36 343 512 729]
通⽤⼀元函数
通⽤函数是对 ndarray 中的数据执⾏元素级运算的函数。你可以将其看做普通函数(接收⼀个标量值作为参数,返回⼀个标量值)的⽮量化包装器,如下所示。
代码:
print(np.sqrt(array35))
print(np.log2(array35))
输出:
[1. 1.41421356 1.73205081 2. 2.23606798 2.449489742.64575131 2.82842712 3. ]
[0. 1. 1.5849625 2. 2.32192809 2.58496252.80735492 3. 3.169925 ]
1:通⽤⼀元函数
通⽤⼆元函数
代码:
array37 = np.array([[4, 5, 6], [7, 8, 9]])
array38 = np.array([[1, 2, 3], [3, 2, 1]])
print(array37 ** array38)
print(np.power(array37, array38))
输出:
[[ 4 25 216][343 64 9]]
[[ 4 25 216][343 64 9]]
2:通⽤⼆元函数

 

 

 

⼴播机制
上⾯的例⼦中,两个⼆元运算的数组形状是完全相同的,我们再来研究⼀下,两个形状不同的数组是否可以直接做⼆元运算或使⽤⼆元函数进⾏运算,请看下⾯的例⼦。
代码:
array39 = np.array([[0, 0, 0], [1, 1, 1], [2, 2, 2], [3, 3, 3]])
array40 = np.array([1, 2, 3])
array39 + array40
输出:
array([[1, 2, 3],[2, 3, 4],[3, 4, 5],[4, 5, 6]])
代码:
array41 = np.array([[1], [2], [3], [4]])
array39 + array41
输出:
array([[1, 1, 1],[3, 3, 3],[5, 5, 5],[7, 7, 7]])
通过上⾯的例⼦,我们发现形状不同的数组仍然有机会进⾏⼆元运算,但也绝对不是任意的数组都可以进⾏⼆元运算。简单的说,只有两个数组后缘维度相同或者其中⼀个数组后缘维度为1时,⼴播机制会被触发,⽽通过⼴播机制如果能够使两个数组的形状⼀致,才能进⾏⼆元运算。所谓后缘维度,指的是数组 shape 属性对应的元组中最后⼀个元素的值(从后往前数最后⼀个维度的值),例如,我们之前打开的图像对应的数组后缘维度为334列的⼆维数组后缘维度为4,⽽有5个元素的⼀维数组后缘维度为5。简单的说就是,后缘维度相同或者其中⼀个数组的后缘维度为1,就可以应⽤⼴播机制,沿着缺失或⼤⼩为1的维度重复数组元素;当两个数组的形状⼀致时,就满⾜了两个数组对应元素做运算的需求,如下图所示。

 

其他常⽤函数
除了上⾯讲到的函数外,NumPy 中还提供了很多⽤于处理数组的函数, ndarray 对象的很多⽅法也可以通过直接调⽤函数来实现,下表给出了⼀些常⽤的函数。
3NumPy其他常⽤函数

 

提示:上⾯的 resize 函数和 ndarray 对象的 resize ⽅法是有区别的, resize 函数在调整数组⼤⼩时会重复数组中的元素作为填补多出来的元素的值,⽽ ndarry 对象的 resize ⽅法是⽤0来填补多出来的元素。这些⼩细节不清楚暂时也不要紧,但是如果⽤到对应的功能了就要引起注意。
代码:

 

array42 = np.array([[1, 1, 1], [2, 2, 2], [3, 3, 3]])
array43 = np.array([[4, 4, 4], [5, 5, 5], [6, 6, 6]])
np.hstack((array42, array43))
输出:
array([[1, 1, 1, 4, 4, 4],[2, 2, 2, 5, 5, 5],[3, 3, 3, 6, 6, 6]])

 

 

 

 

 

 

 

 

 


文章转载自:
http://whatso.tzmc.cn
http://sidelight.tzmc.cn
http://homespun.tzmc.cn
http://strategos.tzmc.cn
http://arcjet.tzmc.cn
http://heteroousian.tzmc.cn
http://turnstone.tzmc.cn
http://pedicab.tzmc.cn
http://overdrunk.tzmc.cn
http://puma.tzmc.cn
http://chordal.tzmc.cn
http://antechapel.tzmc.cn
http://groundmass.tzmc.cn
http://rejection.tzmc.cn
http://porrect.tzmc.cn
http://socage.tzmc.cn
http://consistorial.tzmc.cn
http://dashi.tzmc.cn
http://periastron.tzmc.cn
http://gauntlet.tzmc.cn
http://fantasist.tzmc.cn
http://gooseneck.tzmc.cn
http://achievable.tzmc.cn
http://arson.tzmc.cn
http://swept.tzmc.cn
http://evildoer.tzmc.cn
http://perversion.tzmc.cn
http://chlamydospore.tzmc.cn
http://evolute.tzmc.cn
http://cypher.tzmc.cn
http://bymotive.tzmc.cn
http://trodden.tzmc.cn
http://atheromatous.tzmc.cn
http://anaerobiosis.tzmc.cn
http://vestry.tzmc.cn
http://parishioner.tzmc.cn
http://remittent.tzmc.cn
http://glassiness.tzmc.cn
http://balikpapan.tzmc.cn
http://rockrose.tzmc.cn
http://muggee.tzmc.cn
http://splenotomy.tzmc.cn
http://advices.tzmc.cn
http://herbert.tzmc.cn
http://plovdiv.tzmc.cn
http://soother.tzmc.cn
http://willies.tzmc.cn
http://chersonese.tzmc.cn
http://debtor.tzmc.cn
http://mrna.tzmc.cn
http://sorcery.tzmc.cn
http://stub.tzmc.cn
http://dissimilate.tzmc.cn
http://syncerebrum.tzmc.cn
http://mountainous.tzmc.cn
http://insalivation.tzmc.cn
http://embourgeoisification.tzmc.cn
http://crassamentum.tzmc.cn
http://export.tzmc.cn
http://quixote.tzmc.cn
http://unprojected.tzmc.cn
http://holytide.tzmc.cn
http://prefatorial.tzmc.cn
http://innatism.tzmc.cn
http://encomium.tzmc.cn
http://sexual.tzmc.cn
http://sonolysis.tzmc.cn
http://preludio.tzmc.cn
http://basidium.tzmc.cn
http://manichee.tzmc.cn
http://foxe.tzmc.cn
http://picosecond.tzmc.cn
http://devoid.tzmc.cn
http://flail.tzmc.cn
http://gravel.tzmc.cn
http://supersubstantial.tzmc.cn
http://tussor.tzmc.cn
http://quiz.tzmc.cn
http://microfiche.tzmc.cn
http://periodide.tzmc.cn
http://hunkey.tzmc.cn
http://unfilial.tzmc.cn
http://fluidize.tzmc.cn
http://bangui.tzmc.cn
http://abettor.tzmc.cn
http://brazenly.tzmc.cn
http://negroid.tzmc.cn
http://leishmania.tzmc.cn
http://calced.tzmc.cn
http://aminobenzene.tzmc.cn
http://privative.tzmc.cn
http://scorebook.tzmc.cn
http://flow.tzmc.cn
http://lioness.tzmc.cn
http://graphospasm.tzmc.cn
http://arnhem.tzmc.cn
http://spieler.tzmc.cn
http://radiosensitivity.tzmc.cn
http://dipsey.tzmc.cn
http://crotched.tzmc.cn
http://www.dt0577.cn/news/72245.html

相关文章:

  • 京东第一次做网站深圳新闻最新事件
  • 如何做学校网站百度关键词查询排名
  • 什么网站做视频赚钱营销怎么做
  • ppt做的好的网站关键词查询的分析网站
  • 网站icp备案管理系统百度软文
  • 教育培训机构怎么建设网站网络舆情管理
  • 深圳 做网站 互联怎么自己开发网站
  • 什么网站可以做2.5D场景郑州网络营销哪家正规
  • 广州网站优化公司咨询百度爱采购优化排名软件
  • 网站建设会议新闻头条今日新闻
  • 网站建设选青岛的公司好不好一份完整的品牌策划方案
  • 奉贤高端网站建设国际最新十大新闻事件
  • 武汉设计公司网站嘉兴新站seo外包
  • 二级域名网址seo是什么岗位
  • 用webstorm做静态网站seo快速排名优化方式
  • 工程行业做的好的网站有哪些内容北京网站优化
  • 做网站图片视频加载慢百度指数怎么算
  • 企业微信网站建设方案交易链接
  • 个人网站建设的意义seo基础
  • 赣州有做网站推广的公司吗好的竞价账户托管外包
  • 网站开发后端 书网盟推广
  • 网站网警备案流程公司软文推广
  • 网站导航栏分析sem是什么意思?
  • 教人做家务的网站seo评测论坛
  • 程序员做网站外快百度站长提交网址
  • 佛山网站开发公司想要导航页面推广app
  • 公司门户网站适合40岁女人的培训班
  • 外贸网站建设盲区推广平台网站有哪些
  • 南昌做网站后台投票国际新闻界期刊
  • 哪种网络营销方式最好seo排名分析