The Julia Language 1.10.2

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Author(s): The Julia Project
Publisher: The Julia Project
Year: 2024

Language: English
Pages: 1692

Contents
Manual
Julia 1.10 Documentation
Important Links
Introduction
Julia Compared to Other Languages
Getting Started
Resources
Variables
Allowed Variable Names
Assignment expressions and assignment versus mutation
Stylistic Conventions
Integers and Floating-Point Numbers
Integers
Floating-Point Numbers
Arbitrary Precision Arithmetic
Numeric Literal Coefficients
Literal zero and one
Mathematical Operations and Elementary Functions
Arithmetic Operators
Boolean Operators
Bitwise Operators
Updating operators
Vectorized "dot" operators
Numeric Comparisons
Operator Precedence and Associativity
Numerical Conversions
Complex and Rational Numbers
Complex Numbers
Rational Numbers
Strings
Characters
String Basics
Unicode and UTF-8
Concatenation
Interpolation
Triple-Quoted String Literals
Common Operations
Non-Standard String Literals
Regular Expressions
Byte Array Literals
Version Number Literals
Raw String Literals
Functions
Argument Passing Behavior
Argument-type declarations
The return Keyword
Operators Are Functions
Operators With Special Names
Anonymous Functions
Tuples
Named Tuples
Destructuring Assignment and Multiple Return Values
Property destructuring
Argument destructuring
Varargs Functions
Optional Arguments
Keyword Arguments
Evaluation Scope of Default Values
Do-Block Syntax for Function Arguments
Function composition and piping
Dot Syntax for Vectorizing Functions
Further Reading
Control Flow
Compound Expressions
Conditional Evaluation
Short-Circuit Evaluation
Repeated Evaluation: Loops
Exception Handling
Tasks (aka Coroutines)
Scope of Variables
Global Scope
Local Scope
Constants
Typed Globals
Types
Type Declarations
Abstract Types
Primitive Types
Composite Types
Mutable Composite Types
Declared Types
Type Unions
Parametric Types
UnionAll Types
Singleton types
Types of functions
Type{T} type selectors
Type Aliases
Operations on Types
Custom pretty-printing
"Value types"
Methods
Defining Methods
Method specializations
Method Ambiguities
Parametric Methods
Redefining Methods
Design Patterns with Parametric Methods
Parametrically-constrained Varargs methods
Note on Optional and keyword Arguments
Function-like objects
Empty generic functions
Method design and the avoidance of ambiguities
Defining methods in local scope
Constructors
Outer Constructor Methods
Inner Constructor Methods
Incomplete Initialization
Parametric Constructors
Case Study: Rational
Outer-only constructors
Conversion and Promotion
Conversion
Promotion
Interfaces
Iteration
Indexing
Abstract Arrays
Strided Arrays
Customizing broadcasting
Instance Properties
Modules
Namespace management
Submodules and relative paths
Module initialization and precompilation
Documentation
Accessing Documentation
Writing Documentation
Functions & Methods
Advanced Usage
Syntax Guide
Metaprogramming
Program representation
Expressions and evaluation
Macros
Code Generation
Non-Standard String Literals
Generated functions
Single- and multi-dimensional Arrays
Basic Functions
Construction and Initialization
Array literals
Comprehensions
Generator Expressions
Indexing
Indexed Assignment
Supported index types
Iteration
Array traits
Array and Vectorized Operators and Functions
Broadcasting
Implementation
Missing Values
Propagation of Missing Values
Equality and Comparison Operators
Logical operators
Control Flow and Short-Circuiting Operators
Arrays With Missing Values
Skipping Missing Values
Logical Operations on Arrays
Networking and Streams
Basic Stream I/O
Text I/O
IO Output Contextual Properties
Working with Files
A simple TCP example
Resolving IP Addresses
Asynchronous I/O
Multicast
Parallel Computing
Asynchronous Programming
Basic Task operations
Communicating with Channels
More task operations
Tasks and events
Multi-Threading
Starting Julia with multiple threads
Threadpools
Communication and synchronization
The @threads Macro
Atomic Operations
Per-field atomics
Side effects and mutable function arguments
@threadcall
Caveats
Task Migration
Safe use of Finalizers
Multi-processing and Distributed Computing
Code Availability and Loading Packages
Starting and managing worker processes
Data Movement
Global variables
Parallel Map and Loops
Remote References and AbstractChannels
Channels and RemoteChannels
Local invocations
Shared Arrays
ClusterManagers
Specifying Network Topology (Experimental)
Noteworthy external packages
Running External Programs
Interpolation
Quoting
Pipelines
Cmd Objects
Calling C and Fortran Code
Creating C-Compatible Julia Function Pointers
Mapping C Types to Julia
Mapping C Functions to Julia
C Wrapper Examples
Fortran Wrapper Example
Garbage Collection Safety
Non-constant Function Specifications
Indirect Calls
Closure cfunctions
Closing a Library
Variadic function calls
ccall interface
Calling Convention
Accessing Global Variables
Accessing Data through a Pointer
Thread-safety
More About Callbacks
C++
Handling Operating System Variation
Environment Variables
File locations
Pkg.jl
Network transport
External applications
Parallelization
REPL formatting
System and Package Image Building
Debugging and profiling
Embedding Julia
High-Level Embedding
High-Level Embedding on Windows with Visual Studio
Converting Types
Calling Julia Functions
Memory Management
Working with Arrays
Exceptions
Code Loading
Definitions
Federation of packages
Environments
Conclusion
Profiling
Basic usage
Accumulation and clearing
Options for controlling the display of profile results
Configuration
Memory allocation analysis
External Profiling
Stack Traces
Viewing a stack trace
Extracting useful information
Error handling
Exception stacks and current_exceptions
Comparison with backtrace
Performance Tips
Performance critical code should be inside a function
Avoid untyped global variables
Measure performance with @time and pay attention to memory allocation
Tools
Avoid containers with abstract type parameters
Type declarations
Break functions into multiple definitions
Write "type-stable" functions
Avoid changing the type of a variable
Separate kernel functions (aka, function barriers)
Types with values-as-parameters
The dangers of abusing multiple dispatch (aka, more on types with values-as-parameters)
Access arrays in memory order, along columns
Pre-allocating outputs
More dots: Fuse vectorized operations
Consider using views for slices
Copying data is not always bad
Consider StaticArrays.jl for small fixed-size vector/matrix operations
Avoid string interpolation for I/O
Optimize network I/O during parallel execution
Fix deprecation warnings
Tweaks
Performance Annotations
Treat Subnormal Numbers as Zeros
@code_warntype
Performance of captured variable
Multithreading and linear algebra
Alternative linear algebra backends
Workflow Tips
REPL-based workflow
Browser-based workflow
Revise-based workflows
Style Guide
Indentation
Write functions, not just scripts
Avoid writing overly-specific types
Handle excess argument diversity in the caller
Append ! to names of functions that modify their arguments
Avoid strange type Unions
Avoid elaborate container types
Prefer exported methods over direct field access
Use naming conventions consistent with Julia base/
Write functions with argument ordering similar to Julia Base
Don't overuse try-catch
Don't parenthesize conditions
Don't overuse ...
Don't use unnecessary static parameters
Avoid confusion about whether something is an instance or a type
Don't overuse macros
Don't expose unsafe operations at the interface level
Don't overload methods of base container types
Avoid type piracy
Be careful with type equality
Don't write a trivial anonymous function x->f(x) for a named function f
Avoid using floats for numeric literals in generic code when possible
Frequently Asked Questions
General
Public API
Sessions and the REPL
Scripting
Variables and Assignments
Functions
Types, type declarations, and constructors
Troubleshooting "method not matched": parametric type invariance and MethodErrors
Packages and Modules
Nothingness and missing values
Memory
Asynchronous IO and concurrent synchronous writes
Arrays
Computing cluster
Julia Releases
Noteworthy Differences from other Languages
Noteworthy differences from MATLAB
Noteworthy differences from R
Noteworthy differences from Python
Noteworthy differences from C/C++
Noteworthy differences from Common Lisp
Unicode Input
Command-line Interface
Using arguments inside scripts
Parallel mode
Startup file
Command-line switches for Julia
Base
Essentials
Introduction
Getting Around
Keywords
Standard Modules
Base Submodules
All Objects
Properties of Types
Special Types
Generic Functions
Syntax
Missing Values
System
Versioning
Errors
Events
Reflection
Code loading
Internals
Meta
Collections and Data Structures
Iteration
Constructors and Types
General Collections
Iterable Collections
Indexable Collections
Dictionaries
Set-Like Collections
Dequeues
Utility Collections
Mathematics
Mathematical Operators
Mathematical Functions
Customizable binary operators
Numbers
Standard Numeric Types
Data Formats
General Number Functions and Constants
BigFloats and BigInts
Strings
Arrays
Constructors and Types
Basic functions
Broadcast and vectorization
Indexing and assignment
Views (SubArrays and other view types)
Concatenation and permutation
Array functions
Combinatorics
Tasks
Scheduling
Synchronization
Channels
Low-level synchronization using schedule and wait
Multi-Threading
Atomic operations
ccall using a libuv threadpool (Experimental)
Low-level synchronization primitives
Constants
Filesystem
I/O and Network
General I/O
Text I/O
Multimedia I/O
Network I/O
Punctuation
Sorting and Related Functions
Sorting Functions
Order-Related Functions
Sorting Algorithms
Alternate Orderings
Iteration utilities
Reflection and introspection
Module bindings
DataType fields
Subtypes
DataType layout
Function methods
Expansion and lowering
Intermediate and compiled representations
C Interface
LLVM Interface
C Standard Library
StackTraces
SIMD Support
Standard Library
ArgTools
Argument Handling
Function Testing
Artifacts
Base64
CRC32c
Dates
Constructors
Durations/Comparisons
Accessor Functions
Query Functions
TimeType-Period Arithmetic
Adjuster Functions
Period Types
Rounding
API reference
Dates and Time Types
Dates Functions
Delimited Files
Distributed Computing
Cluster Manager Interface
Downloads
File Events
Pidfile
Primary Functions
Helper Functions
Future
Interactive Utilities
Lazy Artifacts
LibCURL
LibGit2
Dynamic Linker
Linear Algebra
Special matrices
Matrix factorizations
Orthogonal matrices (AbstractQ)
Standard functions
Low-level matrix operations
BLAS functions
LAPACK functions
Logging
Log event structure
Processing log events
Testing log events
Environment variables
Examples
Reference
Markdown
Inline elements
Toplevel elements
Markdown Syntax Extensions
Memory-mapped I/O
Network Options
Pkg
Printf
Profiling
CPU Profiling
Via @profile
Triggered During Execution
Reference
Memory profiling
Heap Snapshots
The Julia REPL
The different prompt modes
Key bindings
Tab completion
Customizing Colors
Changing the contextual module which is active at the REPL
Numbered prompt
TerminalMenus
References
Random Numbers
Random numbers module
Random generation functions
Subsequences, permutations and shuffling
Generators (creation and seeding)
Hooking into the Random API
Reproducibility
SHA
SHA functions
Working with context
HMAC functions
Serialization
Shared Arrays
Sockets
Sparse Arrays
Compressed Sparse Column (CSC) Sparse Matrix Storage
Sparse Vector Storage
Sparse Vector and Matrix Constructors
Sparse matrix operations
Correspondence of dense and sparse methods
SparseArrays API
Noteworthy external packages
Statistics
TOML
Parsing TOML data
Exporting data to TOML file
References
Tar
Unit Testing
Testing Base Julia
Basic Unit Tests
Working with Test Sets
Testing Log Statements
Other Test Macros
Broken Tests
Test result types
Creating Custom AbstractTestSet Types
Test utilities
Workflow for Testing Packages
UUIDs
Unicode
Developer Documentation
Documentation of Julia's Internals
Initialization of the Julia runtime
Julia ASTs
More about types
Memory layout of Julia Objects
Eval of Julia code
Calling Conventions
High-level Overview of the Native-Code Generation Process
Julia Functions
Base.Cartesian
Talking to the compiler (the :meta mechanism)
SubArrays
isbits Union Optimizations
System Image Building
Package Images
Working with LLVM
printf() and stdio in the Julia runtime
Bounds checking
Proper maintenance and care of multi-threading locks
Arrays with custom indices
Module loading
Inference
Julia SSA-form IR
EscapeAnalysis
Static analyzer annotations for GC correctness in C code
Garbage Collection in Julia
Fixing precompilation hangs due to open tasks or IO
Developing/debugging Julia's C code
Reporting and analyzing crashes (segfaults)
gdb debugging tips
Using Valgrind with Julia
External Profiler Support
Sanitizer support
Instrumenting Julia with DTrace, and bpftrace
Building Julia
Building Julia (Detailed)
Linux
macOS
Windows
tools
For 64 bit Julia, install x86_64
For 32 bit Julia, install i686
FreeBSD
ARM (Linux)
Binary distributions
Point releasing 101
Julia v1.10 Release Notes
New language features
Language changes
Compiler/Runtime improvements
Command-line option changes
Build system changes
New library functions
New library features
Standard library changes
Deprecated or removed