You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactor: abstract spacetypes to traits
- Removes `InnerProductSpace` and `EuclideanSpace` as abstract types.
- Adds `InnerProductStyle` as a trait based mechanism to query if a space has an inner product.
- Implements `NoInnerProduct`, `HasInnerProduct` and `EuclideanInnerProduct` as traits
abstract type InnerProductSpace{𝕜} <:ElementarySpace{𝕜}end
108
+
abstract type InnerProductStyle end
109
+
struct NoInnerProduct <:InnerProductStyleend
110
+
abstract type HasInnerProduct <:InnerProductStyleend
111
+
struct EuclideanProduct <:HasInnerProductend
109
112
```
110
-
to contain all vector spaces`V`which have an inner product and thus a canonical mapping
111
-
from `dual(V)` to `V` (for `𝕜 ⊆ ℝ`) or from `dual(V)` to `conj(V)` (otherwise). This
112
-
mapping is provided by the metric, but no further support for working with metrics is
113
+
to denote for a vector space`V`whether it has an inner product and thus a canonical
114
+
mapping from `dual(V)` to `V` (for `𝕜 ⊆ ℝ`) or from `dual(V)` to `conj(V)` (otherwise).
115
+
This mapping is provided by the metric, but no further support for working with metrics is
113
116
currently implemented.
114
117
115
-
Finally there is
116
-
```julia
117
-
abstract type EuclideanSpace{𝕜} <:InnerProductSpace{𝕜}end
118
-
```
119
-
to contain all spaces `V` with a standard Euclidean inner product (i.e. where the metric is
120
-
the identity). These spaces have the natural isomorphisms `dual(V) == V` (for `𝕜 == ℝ`)
121
-
or `dual(V) == conj(V)` (for ` 𝕜 == ℂ`). In the language of the previous section on
122
-
[categories](@ref s_categories), this subtype represents
123
-
[dagger or unitary categories](@ref ss_adjoints), and support an `adjoint` operation. In
124
-
particular, we have two concrete types
118
+
The `EuclideanProduct` has the natural isomorphisms `dual(V) == V` (for `𝕜 == ℝ`)
119
+
or `dual(V) == conj(V)` (for ` 𝕜 == ℂ`).
120
+
In the language of the previous section on [categories](@ref s_categories), this trait represents [dagger or unitary categories](@ref ss_adjoints), and these vector spaces support an `adjoint` operation.
121
+
122
+
In particular, the two concrete types
125
123
```julia
126
-
struct CartesianSpace <:EuclideanSpace{ℝ}
124
+
struct CartesianSpace <:ElementarySpace{ℝ}
127
125
d::Int
128
126
end
129
-
struct ComplexSpace <:EuclideanSpace{ℂ}
127
+
struct ComplexSpace <:ElementarySpace{ℂ}
130
128
d::Int
131
129
dual::Bool
132
130
end
133
131
```
134
-
to represent the Euclidean spaces $ℝ^d$ or $ℂ^d$ without further inner structure. They can
135
-
be created using the syntax `CartesianSpace(d) == ℝ^d == ℝ[d]` and
136
-
`ComplexSpace(d) == ℂ^d == ℂ[d]`, or
137
-
`ComplexSpace(d, true) == ComplexSpace(d; dual = true) == (ℂ^d)' == ℂ[d]'` for the
138
-
dual space of the latter. Note that the brackets are required because of the precedence
139
-
rules, since `d' == d` for `d::Integer`.
132
+
represent the Euclidean spaces $ℝ^d$ or $ℂ^d$ without further inner structure.
133
+
They can be created using the syntax `CartesianSpace(d) == ℝ^d == ℝ[d]` and `ComplexSpace(d) == ℂ^d == ℂ[d]`, or `ComplexSpace(d, true) == ComplexSpace(d; dual = true) == (ℂ^d)' == ℂ[d]'` for the dual space of the latter.
134
+
Note that the brackets are required because of the precedence rules, since `d' == d` for `d::Integer`.
0 commit comments