Skip to content

Commit

Permalink
feat(gw): improved handling of complex arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
mchitre committed Jan 31, 2025
1 parent 6a83d5a commit 14888cb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Fjage"
uuid = "e0fd600c-be67-11e9-1f90-d366689e4029"
authors = ["Mandar Chitre <[email protected]>"]
version = "0.5.2"
version = "0.6.0"

[deps]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
Expand Down
9 changes: 6 additions & 3 deletions src/gw.jl
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,12 @@ function _prepare(msg::Message)
data = Dict{Symbol,Any}()
for k keys(msg)
v = msg[k]
if typeof(v) <: Array && typeof(v).parameters[1] <: Complex
btype = typeof(v).parameters[1].parameters[1]
data[k] = reinterpret(btype, v)
# multidimensional arrays are serialized in Fortran memory order
if v isa AbstractArray{<:Complex}
data[k] = reinterpret(real(eltype(v)), vec(transpose(v)))
data[Symbol(string(k) * "__isComplex")] = true
elseif v isa AbstractArray
data[k] = vec(transpose(v))
elseif v !== nothing
k === :performative && (k = :perf)
k === :messageID && (k = :msgID)
Expand Down

2 comments on commit 14888cb

@mchitre
Copy link
Member Author

@mchitre mchitre commented on 14888cb Feb 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register

Release notes:

Changes

  • Better support for complex and multidimensional arrays

Breaking changes

  • None

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request updated: JuliaRegistries/General/124197

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.6.0 -m "<description of version>" 14888cbe26c8d9fa879cfbcf2f503745cf0287d9
git push origin v0.6.0

Please sign in to comment.