@@ -53,32 +53,39 @@ function angles(Rs::AbstractBasis{3})
53
53
end
54
54
angles (:: AbstractBasis{D} ) where D = _throw_invalid_dim (D)
55
55
56
+ if VERSION < v " 1.9.0-DEV.1163"
57
+ # since https://github.com/JuliaLang/julia/pull/43334, Julia defines its own `stack`;
58
+ # however, it is still much slower than a naive implementation based on `reduce` cf.
59
+ # https://github.com/JuliaLang/julia/issues/52590. As such, we extend `Base.stack` even
60
+ # on more recent versions; when the issue is fixed, it would be enough to only define
61
+ # `stack` on earlier versions of Julia, falling back to `Base.stack` on later versions.
62
+ import Base: stack
63
+ end
56
64
"""
57
65
stack(Vs::AbstractBasis)
58
66
59
- Return a matrix `[Vs[1] Vs[2] .. Vs[D]]` from `Vs::AbstractBasis{D}`, i.e. the matrix whose
67
+ Return a matrix `[Vs[1] Vs[2] .. Vs[D]]` from `Vs::AbstractBasis{D}`, i.e., the matrix whose
60
68
columns are the basis vectors of `Vs`.
61
69
"""
62
70
stack (Vs:: AbstractBasis ) = reduce (hcat, parent (Vs))
63
- # TODO : At some point, this should hopefully no longer be necessary to do manually (and
64
- # `stack` may end up exported by Base): https://github.com/JuliaLang/julia/issues/21672
65
71
66
72
"""
67
73
volume(Vs::AbstractBasis)
68
74
69
75
Return the volume ``V`` of the unit cell associated with the basis `Vs::AbstractBasis{D}`.
70
76
71
- The volume is computed as ``V = \\ sqrt{\\ mathrm{det}G}`` with with ``G`` denoting the metric
72
- matrix of `Vs` (cf. the International Tables of Crystallography, Volume A, Section 5.2.2.3).
77
+ The volume is computed as ``V = \\ sqrt{\\ mathrm{det}\\ mathbf{G}}`` with with ``\\ mathbf{G}``
78
+ denoting the metric matrix of `Vs` (cf. the International Tables of Crystallography,
79
+ Volume A, Section 5.2.2.3).
73
80
74
- See also [`Bravais. metricmatrix`](@ref).
81
+ See also [`metricmatrix`](@ref).
75
82
"""
76
- volume (Vs:: AbstractBasis ) = sqrt (det (metricmatrix (Vs))) # TODO : wrong. TODO : export.
83
+ volume (Vs:: AbstractBasis ) = sqrt (det (metricmatrix (Vs)))
77
84
78
85
"""
79
86
metricmatrix(Vs::AbstractBasis)
80
87
81
- Return the (real, symmetric) metric matrix of a basis `Vs`, i.e. the matrix with elements
88
+ Return the (real, symmetric) metric matrix of a basis `Vs`, i.e., the matrix with elements
82
89
``G_{ij} =`` `dot(Vs[i], Vs[j])`, as defined in the International Tables of Crystallography,
83
90
Volume A, Section 5.2.2.3.
84
91
0 commit comments