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 30, 2025
1 parent 6a83d5a commit f044978
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

0 comments on commit f044978

Please sign in to comment.