The Julia Programming Language
AI-assisted summary of Taking Vector Transposes Seriously | Jiahao Chen | JuliaCon 2017 — original source. Check the original for full context.
Source published:
Key ideas
- Debates over vector transposition in Julia (GitHub issue #4774) and Python trace back to a fundamental historical division between matrix theory and abstract vector space theory prior to their 1960s unification. (0:00)
- Julia 0.5 produced unexpected 1-element vectors instead of scalars for inner products ($u'v$) because vector transposition was defined by promoting vectors to column matrices before transposing. (9:45)
- Chen presents an impossibility result demonstrating that a scientific computing language cannot fully support standard Householder notation using only three types (scalars, vectors, and matrices). (13:40)
- Julia solved the dilemma by introducing a dedicated fourth type, `RowVector`, leveraging multiple dispatch to consistently evaluate inner, outer, and bilinear forms. (13:40)
Detailed notes
## Background Published on YouTube by The Julia Programming Language channel on July 17, 2017, this JuliaCon 2017 presentation features Jiahao Chen discussing vector transpositions. The video description invites viewers to download Julia from julialang.org and encourages community participation in contributing timestamps and improved captions.
## TL;DR Jiahao Chen explores the contentious debate surrounding vector transposes in Julia, tracing the friction back to a historical schism between matrix theory and abstract vector space algebra. He proves that satisfying standard Householder notation with only three core types—scalars, vectors, and matrices—is mathematically impossible, which previously caused operations like inner products to return awkward 1-element vectors in Julia 0.5. By contrasting approaches in languages like MATLAB and Lua, Chen demonstrates why Julia adopted a four-type system incorporating a dedicated `RowVector` type. This architectural choice leverages polymorphic multiple dispatch to maintain mathematical rigor and intuitive notation without relying on ad hoc parsing hacks.
## Atmosphere & style The presentation is candid, intellectually playful, and deeply engaging, striking a balance between historical scholarship and practical language design. Chen sets an approachable, humorous tone from the start, playfully disclaiming his new employer, joking about stock photos of 'unhappy mathematicians,' and openly admitting that the Julia core team had initially been mistaken on multiple fronts. Watching it feels like attending an insider post-mortem where rigorous mathematical philosophy meets pragmatic engineering, culminating in a warm round of community applause for the developers who turned theory into working code.
## Bulletin - [00:00](https://www.youtube.com/watch?v=C2RO34b_oPM&t=0s) Debates over vector transposition in Julia (GitHub issue #4774) and Python trace back to a fundamental historical division between matrix theory and abstract vector space theory prior to their 1960s unification. - [09:45](https://www.youtube.com/watch?v=C2RO34b_oPM&t=585s) Julia 0.5 produced unexpected 1-element vectors instead of scalars for inner products ($u'v$) because vector transposition was defined by promoting vectors to column matrices before transposing. - [13:40](https://www.youtube.com/watch?v=C2RO34b_oPM&t=820s) Chen presents an impossibility result demonstrating that a scientific computing language cannot fully support standard Householder notation using only three types (scalars, vectors, and matrices). - [13:40](https://www.youtube.com/watch?v=C2RO34b_oPM&t=820s) Julia solved the dilemma by introducing a dedicated fourth type, `RowVector`, leveraging multiple dispatch to consistently evaluate inner, outer, and bilinear forms.
## Key takeaways - [00:00](https://www.youtube.com/watch?v=C2RO34b_oPM&t=0s) GitHub issue #4774, 'Taking vector transposes seriously,' emerged as one of the most contentious debates in the Julia community, echoing similar extensive disputes in Python. - [01:28](https://www.youtube.com/watch?v=C2RO34b_oPM&t=88s) User dissatisfaction in Julia stemmed from inner products returning 1-element arrays rather than true scalars, breaking chained mathematical expressions. - [01:28](https://www.youtube.com/watch?v=C2RO34b_oPM&t=88s) The conceptual friction originates from two distinct mathematical views: vectors as columns of a matrix ('column vectors') versus vectors as elements of an abstract vector space ('flat vectors'). - [03:20](https://www.youtube.com/watch?v=C2RO34b_oPM&t=200s) Historically, matrices and abstract vectors evolved as completely separate fields between 1924 and 1960 before modern mathematics unified them and treated their equivalence as self-evident. - [04:58](https://www.youtube.com/watch?v=C2RO34b_oPM&t=298s) Foundational texts by van der Waerden and L. L. Thurstone explicitly distinguished abstract vectors, scalar coefficients, tuples, and column matrices. - [07:08](https://www.youtube.com/watch?v=C2RO34b_oPM&t=428s) Householder notation relies on two hidden isomorphisms: converting vectors to column matrices and converting resulting 1×1 matrices back into scalars. - [09:45](https://www.youtube.com/watch?v=C2RO34b_oPM&t=585s) Julia 0.5 treated vector transpose as promotion to a matrix followed by matrix transpose, causing expressions like $u'v$ to evaluate to non-scalar 1-element vectors. - [11:02](https://www.youtube.com/watch?v=C2RO34b_oPM&t=662s) MATLAB circumvents vector ambiguities by treating the matrix as its only primitive data type and employing a trailing singleton dimension rule. - [11:02](https://www.youtube.com/watch?v=C2RO34b_oPM&t=662s) Adopting MATLAB-style shape coercion in Julia would break composition and require fragile parsing rules or compound operators. - [13:40](https://www.youtube.com/watch?v=C2RO34b_oPM&t=820s) A 2×2 classification proves that a system constrained to scalars, vectors, and matrices inevitably breaks inner products, outer products, or bilinear forms. - [14:53](https://www.youtube.com/watch?v=C2RO34b_oPM&t=893s) Across languages, vector transpose is handled inconsistently: Lua raises errors, NumPy and Mathematica treat it as an identity operation, and R coerces expressions to matrices. - [13:40](https://www.youtube.com/watch?v=C2RO34b_oPM&t=820s) Julia resolved Householder notation consistency by introducing a dedicated fourth primitive type: `RowVector`. - [16:19](https://www.youtube.com/watch?v=C2RO34b_oPM&t=979s) Expanding multiplication methods to accommodate `RowVector` mirrors how students naturally learn increasingly general arithmetic and algebra systems. - [17:48](https://www.youtube.com/watch?v=C2RO34b_oPM&t=1068s) Implementing a fully consistent linear algebra syntax under multiple dispatch fundamentally requires at least four distinct mathematical types.
## Detailed walkthrough ### [00:00](https://www.youtube.com/watch?v=C2RO34b_oPM&t=0s) The Contested Vector Transpose in Julia and Beyond
Jiahao Chen introduces himself, noting that until roughly four months prior he was at MIT CSAIL with the Julia Lab, and currently works at Capital One in New York. He clarifies that all the work presented was done before joining Capital One, so the company cannot dictate what he can or cannot say about the topic. Chen brings up the widely recognized GitHub issue titled "Taking vector transposes seriously" (issue #4774), asking the audience how many have read it. When about three-quarters of the room raise their hands, he delivers the central premise: “the punch line here is that we were wrong on at least four counts on this issue and I will explain as much as possible within half an hour why we were wrong”.
Chen describes issue #4774 as possibly one of the most hotly debated topics in the Julia community. He polled several community luminaries for their views, presenting contrasting slides of opinions, including one from a prominent member who could not attend the conference. It turns out Julia is not alone in grappling with this: the Python community also had an extensive debate over vector transposes and dimensions, generating some 381 comments on a single issue. The topic reliably agitates developers and mathematicians across programming ecosystems.
[01:28](https://www.youtube.com/watch?v=C2RO34b_oPM&t=88s) The Surface Problem: Unhappy Mathematicians and Dual Definitions
Chen presents the surface issue facing users in Julia 0.6. Displaying a picture of an "unhappy mathematician" (the first image returned by Google for the term, which Chen jokes he used directly), he mimics the typical user complaint: someone tries to compute an inner product, Julia returns a 1-element array instead of a scalar, and attempting to chain it into a larger mathematical expression throws an error, leaving them frustrated and asking: "don't you Julia people know any mathematics?" The core Julia developers' initial instinct was to question: “why would you want to do that okay why do people want to write inner products like this and why do people get so worked up about this issue”.
After researching the matter, Chen concludes that the conflict stems from fundamentally conflicting ideas of what a vector actually is. In mathematics, two distinct definitions coexist: 1. A vector is a column of a matrix. 2. A vector is that which obeys the algebra of a vector space.
While naturally isomorphic, these two notions are not identical. A Type 1 vector (a column of a matrix) clearly satisfies the algebra of a vector space, but not all vectors in a vector space are columns of matrices. To keep them clear throughout the presentation, Chen terms them **column vectors** and **flat vectors**.
```mermaid flowchart TD accTitle: Two Incompatible Definitions of Vectors accDescr: Diagram contrasting Column Vectors and Flat Vectors in mathematics and linear algebra. subgraph Defs["Mathematical Definitions"] CV["Column Vector<br>(Column of a Matrix)"] FV["Flat Vector<br>(Object in an Abstract Vector Space)"] end CV -.->|"Naturally isomorphic,<br>but not identical"| FV CV -->|"Has vector space algebra"| Alg["Vector Space Algebra"] FV -->|"Has vector space algebra"| Alg FV -.->|"Not necessarily"| Mat["Matrix Columns"] ```
[03:20](https://www.youtube.com/watch?v=C2RO34b_oPM&t=200s) The Historical Schism: Matrices vs. Vector Spaces
Investigating how these duplicate definitions originated, Chen traced the history of linear algebra. Between roughly 1924 and 1960, a historical division existed between matrix theory and vector spaces: “there was once a universe where matrices were their own subject and vectors were their own subject and these two subjects did not mix whatsoever and at some point they merged and and we work in the world of the the post merger universe of matrices and vectors”.
In the matrix-only universe, textbooks spoke of "column matrices" and used the rectangular notation familiar today. In the vector universe, mathematicians worked with vector space axioms, coordinate geometry, and the concept of an ordered tuple. In the 1920s, mathematicians observed that column matrices themselves form a vector space, creating a merged framework where the column definition is paradoxically both older and newer than the abstract definition. Chen simplifies this transition with a three-stage timeline: - The **pre-unification era**, where matrices and vectors existed as separate fields. - The **early unification era**, where textbooks had to explain the relationship very carefully. - The **modern era**, where the equivalence is treated as so obvious that everyone is expected to have learned it in elementary school.
```mermaid flowchart LR accTitle: Historical Evolution of Matrix and Vector Theory accDescr: Three eras showing how matrices and vectors began separately, unified, and became a modern standard. subgraph Era1["Pre-Unification Era"] M1["Matrix Universe<br>(Column matrices, rectangular arrays)"] V1["Vector Universe<br>(Axioms, coordinate geometry, tuples)"] end subgraph Era2["Early Unification (1924–1960)"] U["Merged View<br>(Careful proofs that column matrices form vector spaces)"] end subgraph Era3["Modern Era"] Std["Unified Standard<br>(Householder notation, taken for granted)"] end M1 --> U V1 --> U U --> Std ```
[04:58](https://www.youtube.com/watch?v=C2RO34b_oPM&t=298s) Historical Textbooks: van der Waerden and Thurstone
To illustrate the early unification era, Chen examines B. L. van der Waerden's foundational textbook *Moderne Algebra* (Modern Algebra), which helped define modern abstract algebra. In English translation, the text carefully distinguishes its terms: - **Vectors** are the abstract objects endowed with the algebraic operations of a vector space. - **Coefficients** (elements of what we would now call a ring or field) represent the scalar numbers. - **Tuples** are indexable collections of these coefficients, but have no intrinsic algebra defined on them. - A **column matrix** is a separate construct from linear algebra that can be associated with a vector.
Chen emphasizes that in this formulation, the algebra lives entirely within the vector; scalars provide the coefficients, tuples merely store them without algebraic structure, and column matrices belong to the distinct field of matrix algebra.
Chen also highlights L. L. Thurstone’s 1935 psychometrics/statistics text, *The Vectors of Mind: Multiple Factor Analysis for the Isolation of Primary Traits*. Thurstone explicitly bridged the gap, writing that if a matrix has a single column it is termed a column vector, if it has a single row it is a row vector, and that this vectorial terminology was primarily a consequence of geometric interpretation.
[07:08](https://www.youtube.com/watch?v=C2RO34b_oPM&t=428s) Householder Notation and Hidden Isomorphisms
Moving forward to 1953, the birth of modern numerical analysis codified the language used by practitioners today via **Householder notation**: - Small Greek letters for scalars ($\alpha, \beta$). - Small Roman letters for vectors ($u, v$). - Capital Roman letters for matrices ($A, B$).
In this system, fundamental operations are composed from just two building blocks: transposition ($'$) and multiplication ($*$). - Inner product: $u'v$ (yields a scalar). - Outer product: $uv'$ (yields a matrix). - Bilinear form: $u'Av$ (yields a scalar).
Chen argues that virtually all complex matrix-vector expressions reduce to compositions of these elementary operations. However, writing $u'v$ as a vector-vector operation returning a scalar relies on hidden assumptions. When modeled rigorously, the expression requires two implicit isomorphisms: 1. Converting the vector into a column matrix (so matrix transpose and matrix multiplication apply). 2. Converting the resulting $1 \times 1$ matrix back into a true scalar.
Chen stresses that “it comes down to the Crux really of whether or not you want your language to deal with these isomorphisms for you or whether you want to deal with them yourself”.
[09:45](https://www.youtube.com/watch?v=C2RO34b_oPM&t=585s) How Julia 0.5 Broke Vector Transposition and the MATLAB Comparison
Chen explains that Julia prior to version 0.6 adopted a literal interpretation: it defined vector transposition as promoting the vector to a matrix and then executing a matrix transpose. Decomposing $u'v$ under that model produced severe, counterintuitive bugs. The left-hand vector $u$ was promoted to a column matrix, transposed to a $1 \times n$ row matrix, and then multiplied by the column vector $v$. By standard matrix rules, a matrix-vector product yields a vector—specifically a 1-element vector.
A 1-element vector is fundamentally different from a scalar: you cannot divide by it, and it lacks scalar arithmetic. While a $1 \times 1$ matrix can reasonably act as a scalar surrogate, a 1-element flat vector cannot, leaving users stranded with unexpected types and syntax errors (symbolized on the slide by an "unhappy Einstein"). Finally, Chen points toward MATLAB, arguing that MATLAB is an anomaly among modern programming languages, which explains why developers and language designers feel so much friction trying to adapt its matrix-centric behaviors to modern, rigorously typed languages.
[11:02](https://www.youtube.com/watch?v=C2RO34b_oPM&t=662s) MATLAB's Matrix-Only Model and Language Design Trade-offs
Jiahao Chen explains that MATLAB avoids many vector ambiguity issues because its design is firmly rooted in "Type 1" vectors—vectors treated fundamentally as column matrices. To illustrate this philosophy, he shares two quotes from MATLAB documentation spanning decades. The first comes from the original 1980 Matrix Laboratory report from the University of New Mexico when Cleve Moler was still on the faculty:
> “In MATLAB, the matrix is the only data type, with scalars, vectors, and text as special cases.”
The second citation is from the MATLAB manual published the previous year, which continues to state that matrices with dimension equal to one on one side and greater than one on the other side are called vectors. Because everything in MATLAB is a matrix, values are coerced on demand to vectors or scalars via the "trailing singleton dimension rule," where dimensions of length one at the end of an array can be added or dropped at will. In this system, vector-matrix isomorphisms simply reduce to dropping or appending trailing indices. Furthermore, operations can halt at a $1 \times 1$ matrix expression rather than forcing conversion to a true scalar.
While elegant within its own paradigm, this approach clashes with Julia’s dispatch philosophy. Supporting shape-based behavior in multiplication forces special-casing $1 \times 1$ matrices on the left and right. More broadly, if a language relies solely on transpose and multiplication without careful type distinctions, it must either define them with fragile parsing rules or treat expressions like $x' \cdot y$ as ad hoc compound operators. Chen notes that introducing special parsing rules breaks composition—such as when inadvertently inserting parentheses changes the resulting type—and adds language complexity that designers like Jeff Bezanson would caution against.
[13:40](https://www.youtube.com/watch?v=C2RO34b_oPM&t=820s) The 2×2 Impossibility Result and the Need for Row Vectors
Chen formalizes the design space for systems limited to three core types: scalars, vectors, and matrices. If a language only has these three types, a $2 \times 2$ grid of design choices emerges based on whether matrix-vector products yield vectors or column matrices, and whether transposing a vector returns a row matrix or the vector itself.
Chen demonstrates that within this three-type constraint, fully adhering to Householder notation is mathematically impossible: - Some choices break inner products (the flaw present in older versions of Julia). - Other quadrants break outer products. - The remaining quadrants break quadratic products and bilinear forms.
Chen summarizes this central theoretical result:
> “So that's our, that's our main result here, that you can't have what you want.”
To resolve this impasse, Julia introduced a dedicated `RowVector` type. By combining row vectors with type-based multiple dispatch, all expressions in Householder notation evaluate consistently:
> “The moral of the story is that you can't get what you want for Householder with three types, but you can with four.”
```mermaid flowchart TD accTitle: Vector Transpose Approaches Across Programming Languages accDescr: A comparison showing how different languages handle vector transposition and Julia's four-type solution.
subgraph ThreeType["3-Type Systems (Scalars, Vectors, Matrices)"] A["Vector Transpose v'"] A -->|"Error"| B["Lua"] A -->|"Identity"| C["NumPy / Mathematica / SciRuby"] A -->|"Matrix Output"| D["R (Linear algebra yields matrices)"] A -->|"Singleton Dimensions"| E["MATLAB (Everything is a matrix)"] end
subgraph FourType["4-Type Systems (+ RowVector)"] F["v' Yields RowVector"] F --> G["Pari/GP (Explicit conversions)"] F --> H["New Julia (Dispatch-driven)"] end ```
[14:53](https://www.youtube.com/watch?v=C2RO34b_oPM&t=893s) How Other Languages Handle Vector Transposition
Looking across the broader scientific computing ecosystem, Chen highlights the disparate strategies language designers have used for vector transposition: - **Error:** In Lua, transposing a 1D vector is simply an invalid operation. - **Identity:** In NumPy, Mathematica, and SciRuby, the transpose of a 1D vector is the vector itself ($v^T = v$). - **Matrix-heavy conversions:** In R, invoking transpose or matrix multiplication automatically promotes results to matrices. MATLAB conceptually aligns here, though it lacks distinct scalar or vector types altogether. - **Explicit Row Types:** PARI/GP, a language used for number-theoretic computations, shares modern Julia's approach of having an explicit row representation, though it requires explicit conversions between columns, rows, and matrices.
Chen points out that several corners of this taxonomic design space remain completely unexplored, jokingly offering them as ideas for anyone in the audience designing a new programming language.
[16:19](https://www.youtube.com/watch?v=C2RO34b_oPM&t=979s) Polymorphic Multiplication and Natural Mathematics
Implementing row vectors requires adding specific method definitions for `transpose` and `*`, but it keeps user code simple by letting dispatch resolve the operations cleanly. Chen anticipates the objection that adding definitions bloats the method table, displaying a slide where the sheer volume of multiplication methods requires shrinking everything past the first definition to a tiny 1.5-point font.
Despite this, Chen argues that multiple dispatch mirrors how people actually learn mathematics: - Students begin with multiplication tables: $\text{Int} \times \text{Int}$. - They advance to fractions: $\text{Rational} \times \text{Int}$. - They progress to real numbers and decimals: $\text{Real} \times \text{Real}$. - Advanced schooling introduces complex numbers ($\text{Complex} \times \text{Complex}$) and matrix-vector operations ($\text{Matrix} \times \text{Vector}$).
Extending multiplication to handle `RowVector * Matrix` or `RowVector * Vector` is simply a natural continuation of this progression.
[17:48](https://www.youtube.com/watch?v=C2RO34b_oPM&t=1068s) Conclusion and Acknowledgments
Chen fast-forwards through his remaining slides to leave time for audience questions, concluding that the Julia community has finally taken vector transposes seriously. He gives special recognition to Andy Ferris, calling him out in the audience for a round of applause:
> “As you know, it was my, it was my privilege as an academic to just speculate about what to do, but Andy actually did it, so that also deserves plenty of credit.”
Reflecting on the entire exercise, Chen emphasizes that the community had forgotten how difficult these foundational ideas once were. Programmers had grown blind to the explicit isomorphisms required to bridge flat vectors with column matrices, and overlooked that multiplication is fundamentally polymorphic. The definitive takeaway of the work is that implementing consistent Householder notation within a type-based dispatch system requires a minimum of four distinct types.
## Notable quotes > [11:02](https://www.youtube.com/watch?v=C2RO34b_oPM&t=662s) In MATLAB, the matrix is the only data type, with scalars, vectors, and text as special cases. — Cleve Moler
## Mentioned Jiahao Chen, Andy Ferris, Cleve Moler, B. L. van der Waerden, L. L. Thurstone, Alston Scott Householder, Jeff Bezanson, Julia, MATLAB, Python, NumPy, Lua, R, PARI/GP, Mathematica, SciRuby, MIT CSAIL, Capital One, Moderne Algebra, The Vectors of Mind
## Video description Visit http://julialang.org/ to download Julia. Time Stamps:
00:00 Welcome! 00:10 Help us add time stamps or captions to this video! See the description for details.
Want to help add timestamps to our YouTube videos to help with discoverability? Find out more here: https://github.com/JuliaCommunity/YouTubeVideoTimestamps
Interested in improving the auto generated captions? Get involved here: https://github.com/JuliaCommunity/YouTubeVideoSubtitles
[Source](https://www.youtube.com/watch?v=C2RO34b_oPM)