https://hachyderm.io/@simontatham/116436356335059865
2026-04-20
·
via Simon Tatham
In computing, one often says that two features (of a program or language or whatever) are 'orthogonal'. Often the implication is just that you can choose the setting of each feature separately – no setting of feature Foo is incompatible with Bar. But in mathematics, that concept sounds more like (linear) _independence_ than orthogonality. It's saying that you can independently choose where you are on the axis for feature Foo, and the one for feature Bar, and every possible pair of choices corresponds to a valid point in the configuration space. Orthogonality, in maths, is a stronger property than mere independence. What does it add? If a set of vectors {e₁,e₂,…} are orthogonal, and v is in their span, then you can find v's coefficient of e₁ by taking the dot product v . e₁. This formula works the same no matter what the other vectors are. In fact, you don't even need to _know_ what they are. Whereas if {e₁,e₂,…} are merely linearly independent, then you have to know _all_ of them before you can determine any component of v's representation. Any feature you don't know about can affect all the ones you do. So, how about this for a more precise pair of definitions in computing: Two features are _independent_ if feature Bar doesn't affect the *legal* settings of Foo. For example, But they're only _orthogonal_ if feature Bar doesn't even affect the *desirable* setting of Foo: a user who's only read about feature Foo and doesn't even know Bar exists should still be able to set Foo appropriately for their needs, and when someone comes along and sets Bar, the Foo setting is still sensible. Compiler optimisation settings are often independent but not orthogonal. Particularly the ones that trade space for time, like loop unrolling or function inlining. You can turn on either or both, or adjust each one's aggressiveness, but you have a finite space budget and must trade it off between the various space-consuming options. The more you unroll, the less you can afford to inline, and vice versa. But in 'grep', matching options like -i and output options like -3 *are* orthogonal. There's a right answer to whether I want 'grep foo' to match FOO as well, which doesn't at all depend on how I want to display the results.
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。