- Julia 1.0 Programming Complete Reference Guide
- Ivo Balbaert Adrian Salceanu
- 73字
- 2021-06-24 14:21:45
Broadcasting
A function f can be broadcast over all elements of an array (or matrix) by using the dot notation f.(matrix); for example:
arr = [1.0, 2.0, 3.0] sin.(arr) #> 3-element Array{Float64,1}:
# 0.8414709848078965 # 0.9092974268256817 # 0.1411200080598672
Here is another example:
f(x,y) = x + 7y f.(pi, arr) #> 3-element Array{Float64,1}: # 10.141592653589793 # 17.141592653589793 # 24.141592653589793
Broadcasting is very useful in Julia to write compact expressions with arrays and matrices.
推薦閱讀
- Java Web開發(fā)學(xué)習(xí)手冊(cè)
- GeoServer Cookbook
- C++ Builder 6.0下OpenGL編程技術(shù)
- AngularJS深度剖析與最佳實(shí)踐
- 從0到1:HTML+CSS快速上手
- Learn React with TypeScript 3
- VMware虛擬化技術(shù)
- Julia 1.0 Programming Complete Reference Guide
- Deep Learning with R Cookbook
- Python 3 Object:oriented Programming(Second Edition)
- OpenCV Android Programming By Example
- 監(jiān)控的藝術(shù):云原生時(shí)代的監(jiān)控框架
- Java程序設(shè)計(jì)
- Visual C#(學(xué)習(xí)筆記)
- Python實(shí)戰(zhàn)指南:手把手教你掌握300個(gè)精彩案例