- 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.
推薦閱讀
- Mastering NetBeans
- 流量的秘密:Google Analytics網站分析與優化技巧(第2版)
- Learn TypeScript 3 by Building Web Applications
- Monkey Game Development:Beginner's Guide
- Linux C/C++服務器開發實踐
- 跟老齊學Python:輕松入門
- 征服RIA
- Quarkus實踐指南:構建新一代的Kubernetes原生Java微服務
- 高級語言程序設計(C語言版):基于計算思維能力培養
- Python之光:Python編程入門與實戰
- C專家編程
- 運維前線:一線運維專家的運維方法、技巧與實踐
- jQuery從入門到精通(微課精編版)
- Mastering OAuth 2.0
- 深入淺出 HTTPS:從原理到實戰