Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for complex-valued parameters #36

Open
nncarlson opened this issue Nov 17, 2024 · 1 comment
Open

Support for complex-valued parameters #36

nncarlson opened this issue Nov 17, 2024 · 1 comment

Comments

@nncarlson
Copy link
Owner

Add support for complex-valued parameters.

@nncarlson
Copy link
Owner Author

The parameter_list type already supports complex variables via the set and get_any methods. The only missing piece is specific get methods for complex arguments. This is trivial to add.

Adding support for complex data to parameter_list_json is more difficult as JSON has no intrinsic notion of complex numbers. I see two options (not necessarily exclusive):

  1. Represent complex data as a structure, such as {re: 1.0, im: 2.0};
  2. Represent complex data as an array of size 2 [1.0, 2.0].

The main difference between the two is on where the capability is implemented.
In option 1, the parameter list reader will need to examine each sublist it reads, and when it finds this special structure, replace the sublist with a complex-valued parameter. No change is needed to parameter_list.
With option 2, no change to the parameter list reader is needed. Instead the parameter_list%get method for complex arguments needs to be extended to allow a size-2 array to be mapped to a complex value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant