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