- 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.
推薦閱讀
- Practical Data Analysis Cookbook
- TypeScript Essentials
- Python自然語言處理實戰:核心技術與算法
- Mastering Spring MVC 4
- Mastering LibGDX Game Development
- Java持續交付
- SQL Server 2016數據庫應用與開發習題解答與上機指導
- 小程序開發原理與實戰
- INSTANT Django 1.5 Application Development Starter
- Apache Kafka Quick Start Guide
- C程序設計實踐教程
- jQuery Mobile移動應用開發實戰(第3版)
- 低代碼平臺開發實踐:基于React
- INSTANT Yii 1.1 Application Development Starter
- Spring Boot實戰