Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Julia 1.0 Programming Complete Reference Guide

You're reading from   Julia 1.0 Programming Complete Reference Guide Discover Julia, a high-performance language for technical computing

Arrow left icon
Product type Course
Published in May 2019
Publisher
ISBN-13 9781838822248
Length 466 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Ivo Balbaert Ivo Balbaert
Author Profile Icon Ivo Balbaert
Ivo Balbaert
Arrow right icon
View More author details
Toc

Table of Contents (18) Chapters Close

Preface 1. Installing the Julia Platform FREE CHAPTER 2. Variables, Types, and Operations 3. Functions 4. Control Flow 5. Collection Types 6. More on Types, Methods, and Modules 7. Metaprogramming in Julia 8. I/O, Networking, and Parallel Computing 9. Running External Programs 10. The Standard Library and Packages 11. Creating Our First Julia App 12. Setting Up the Wiki Game 13. Building the Wiki Game Web Crawler 14. Adding a Web UI for the Wiki Game 15. Implementing Recommender Systems with Julia 16. Machine Learning for Recommender Systems 17. Other Books You May Enjoy

Arrays

An array is a data structure (and the corresponding type) that represents an ordered collection of elements. More specifically, in Julia, an array is a collection of objects stored in a multi-dimensional grid.

Arrays can have any number of dimensions and are defined by their type and number of dimensions—Array{Type, Dimensions}.

A one-dimensional array, also called a vector, can be easily defined using the array literal notation, the square brackets [...]:

julia> [1, 2, 3]  
3-element Array{Int64,1}: 
 1 
 2 
 3 
 

You can also constrain the type of the elements:

julia> Float32[1, 2, 3, 4] 
4-element Array{Float32,1}: 
 1.0 
 2.0 
 3.0 
 4.0 
 

A two D array (also called a matrix) can be initialized using the same array literal notation, but this time without the commas:

julia> [1 2 3 4] 
1Ă—4 Array{Int64,2}: 
 1  2  3  4 
 

We can add more rows using...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime