Skip to content

Commit

Permalink
Refactored error message when no RAT.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuszbaran committed Aug 29, 2024
1 parent 1bc2c94 commit ddde712
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.15.15] 29/08/2024

### Changed

* Refactored error message code when `ProductManifold` is used without `RecursiveArrayTools.jl`.

## [0.15.14] 27/08/2024

### Added
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ManifoldsBase"
uuid = "3362f125-f0bb-47a3-aa74-596ffd7ef2fb"
authors = ["Seth Axen <[email protected]>", "Mateusz Baran <[email protected]>", "Ronny Bergmann <[email protected]>", "Antoine Levitt <[email protected]>"]
version = "0.15.14"
version = "0.15.15"

[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand Down
19 changes: 11 additions & 8 deletions src/ManifoldsBase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -180,15 +180,18 @@ end
@inline function allocate_result(M::AbstractManifold, f)
T = allocate_result_type(M, f, ())
rs = representation_size(M)
if isnothing(rs)
msg = "Could not allocate result of function $f on manifold $M."
if M isa ProductManifold
msg *= " This error could be resolved by importing RecursiveArrayTools.jl. If this is not the case, please open report an issue."
end
error(msg)
else
return Array{T}(undef, rs...)
return allocate_result_array(M, f, T, rs)
end

function allocate_result_array(M::AbstractManifold, f, ::Type, ::Nothing)
msg = "Could not allocate result of function $f on manifold $M."
if base_manifold(M) isa ProductManifold
msg *= " This error could be resolved by importing RecursiveArrayTools.jl. If this is not the case, please open report an issue."
end
return error(msg)
end
function allocate_result_array(::AbstractManifold, f, T::Type, rs::Tuple)
return Array{T}(undef, rs...)
end

"""
Expand Down

0 comments on commit ddde712

Please sign in to comment.