June 2019
Intermediate to advanced
218 pages
5h 19m
English
Consider a complex number, which, as you know, consists of a real and imaginary part. In Julia (and indeed, most other languages), it is stored as a composite type—a struct that has two fields, re and im for the real and imaginary parts, respectively. Each of these fields are stored as the same number type, Int64 or Float64 typically, and together, they create the type Complex.
Now, consider an array of Complex numbers. With each Complex struct containing two numbers, the array would be laid out in this manner:

When operating on arrays on this type, the CPU pulls re and im one after the other. However, that kind of operation ...
Read now
Unlock full access