Discussion Overview
The discussion revolves around assigning values to a complex array in Fortran, specifically addressing errors encountered during the assignment process within a loop. Participants explore different methods for correctly initializing the real and imaginary parts of complex numbers.
Discussion Character
- Technical explanation
- Debate/contested
Main Points Raised
- One participant reports an error "Unclassifiable statement at (1)" when attempting to assign values to a complex array using the real() and aimag() functions.
- Another participant clarifies that real() and aimag() are not suitable for modifying the components of a complex number and suggests using a tuple assignment instead.
- A later reply confirms that the tuple assignment method does not work in a specific example involving expressions, leading to another error message.
- Another participant proposes using the cmplx() function for assignments, indicating that it may resolve the issue with expressions.
- One participant confirms success with the cmplx() method after initial difficulties.
Areas of Agreement / Disagreement
Participants generally agree on the limitations of using real() and aimag() for assignments, but there is some disagreement regarding the effectiveness of tuple assignments with expressions, which remains unresolved until the suggestion of using cmplx() is introduced.
Contextual Notes
Participants note that the tuple assignment method may not work for expressions, indicating a potential limitation in the language's handling of complex number assignments.
Who May Find This Useful
This discussion may be useful for programmers working with Fortran, particularly those dealing with complex numbers and array assignments.