1
1
module DiffResults
2
2
3
- using StaticArrays
3
+ using StaticArraysCore : StaticArray, similar_type # , Size # Size is not yet in Core package
4
4
5
5
# ########
6
6
# Types #
@@ -76,7 +76,8 @@ shape information. If you want to allocate storage yourself, use the `DiffResult
76
76
constructor instead.
77
77
"""
78
78
JacobianResult (x:: AbstractArray ) = DiffResult (similar (x), similar (x, length (x), length (x)))
79
- JacobianResult (x:: StaticArray ) = DiffResult (x, zeros (StaticArrays. similar_type (typeof (x), Size (length (x),length (x)))))
79
+ # JacobianResult(x::StaticArray) = DiffResult(x, zeros(similar_type(typeof(x), Size(length(x),length(x)))))
80
+ JacobianResult (x:: StaticArray ) = DiffResult (x, zeros (similar_type (typeof (x), (axes (vec (x))... , axes (vec (x))... ))))
80
81
81
82
"""
82
83
JacobianResult(y::AbstractArray, x::AbstractArray)
@@ -89,7 +90,8 @@ Like the single argument version, `y` and `x` are only used for type and
89
90
shape information and are not stored in the returned `DiffResult`.
90
91
"""
91
92
JacobianResult (y:: AbstractArray , x:: AbstractArray ) = DiffResult (similar (y), similar (y, length (y), length (x)))
92
- JacobianResult (y:: StaticArray , x:: StaticArray ) = DiffResult (y, zeros (StaticArrays. similar_type (typeof (x), Size (length (y),length (x)))))
93
+ # JacobianResult(y::StaticArray, x::StaticArray) = DiffResult(y, zeros(similar_type(typeof(x), Size(length(y),length(x)))))
94
+ JacobianResult (y:: StaticArray , x:: StaticArray ) = DiffResult (y, zeros (similar_type (typeof (x), (axes (vec (y))... , axes (vec (x))... ))))
93
95
94
96
"""
95
97
HessianResult(x::AbstractArray)
@@ -102,7 +104,8 @@ shape information. If you want to allocate storage yourself, use the `DiffResult
102
104
constructor instead.
103
105
"""
104
106
HessianResult (x:: AbstractArray ) = DiffResult (first (x), zeros (eltype (x), size (x)), similar (x, length (x), length (x)))
105
- HessianResult (x:: StaticArray ) = DiffResult (first (x), x, zeros (StaticArrays. similar_type (typeof (x), Size (length (x),length (x)))))
107
+ # HessianResult(x::StaticArray) = DiffResult(first(x), x, zeros(similar_type(typeof(x), Size(length(x),length(x)))))
108
+ HessianResult (x:: StaticArray ) = DiffResult (first (x), x, zeros (similar_type (typeof (x), (axes (vec (x))... , axes (vec (x))... ))))
106
109
107
110
# ############
108
111
# Interface #
0 commit comments