2025-07-25 –, Main Room 6
Did you know you can create an array of non-uniform data types, run it through a differential equation solver and still ensure there is no need for runtime type inference? We will dive into Julia's array interface and explore how it allows us to implement such unusual, yet useful, data structures in a type-stable manner.
This talk will discuss the concept of arrays in Julia and provide the motivation for using heterogenous arrays. The starting point is the base Julia Array
type which will serve as the description of the "ideal" array. However, for many applications it is desirable to have types that are different from the "ideal" Array
, but share enough properties that it can still be thought of as an array. For this Julia provides an AbstractArray
supertype allowing custom types to use interfaces primarily written for Array
. We will briefly discuss the properties of the "ideal" Array
s with counterexamples from commonly used custom array types. Here, we arrive at the main focus of the talk; heterogenous arrays that are arrays where the elements are not of the same type.
One can take two different approaches to heterogenous arrays. The first and boldest one is to have an array of genuinely different data types such as integers and floating point numbers. The second approach is less radical and is concerned with arrays that store the same underlying data type, but where the data type serves as an abstraction affecting its interpretation and its operations.
We choose to focus on the second approach by presenting an example where the state of a system is represented with Unitful
quantities, thus keeping track of the units of measurements. This system is represented by ordinary differential equations and we want to run it through an ODE solver while keeping track of the unit of measurements throughout the process. We will review existing solutions for this kind of problem and discuss their advantages and disadvantages.
One of the major challenges of heterogenous arrays is type stability. In order to run efficiently, Julia must know the types to operate on when compiling a function. When the array elements are not of the same type, this poses additional challenges related to type inference. The talk will take the listeners through the process of implementing a heterogenous array type which supports type-stable broadcasting. We will also look into how the package DifferentialEquations
is written in order to deal with heterogenous arrays. Finally, remaining challenges on the subject are addressed, and suggestions for further directions and work are provided.
I work as a postdoctorial reseach fellow at UiT the Arctic University of Norway where I work on the Centre for New Antibacterial Strategies (CANS). In 2023, I graduated with a PhD in Biotechnology from the Norwegian University of Science and Technology.
My academic experience is centered around systems biology topics such as microbiome analysis, microbial metabolic modeling and gene expression analyses. In addition, I am passionate about scientific software engineering practices and high performance computing.