Re: Initializing a complex dynamic array (with real part from one array, and imaginary from other array)?

2021-07-22 Thread Ali Çehreli via Digitalmars-d-learn
On 7/21/21 2:17 AM, drug wrote: > auto z = zip(x, y) // concatenate two ranges > .map!(a=>Complex!double(a[0],a[1])) // take the current first > element of the first range as the real part and the current first > element of the second range as the imaginary

Re: Initializing a complex dynamic array (with real part from one array, and imaginary from other array)?

2021-07-21 Thread drug via Digitalmars-d-learn
I wouldn't state it is the best way but you can try something like that: ```D import std.complex; import std.range : zip; import std.algorithm : equal, map; import std.array : array; void main(){ auto N=2; double[] x,y; x.length = N; y.length = N; x[0] = 1.1; x[1] =

Initializing a complex dynamic array (with real part from one array, and imaginary from other array)?

2021-07-21 Thread james.p.leblanc via Digitalmars-d-learn
I am trying to initialize a complex dynamic array, from two strictly real dynamic arrays (one to be the real part, the other to be the imaginary part. Here is simple sample of what I have tried: - import std.stdio; import std.math;