Replace deprecated np.complex by built-in complex

This commit is contained in:
Fabien Péan
2023-01-14 21:45:23 +00:00
parent 81ed8ef3ec
commit 4002c2733c
9 changed files with 74 additions and 74 deletions
+1 -1
View File
@@ -52,7 +52,7 @@ Note:
1.1. create numpy arrays specifying explicitly the type:
>> Aij = np.array([], dtype='complex128')
1.2. filling numpy arrays casting value on append:
>> Aij = np.append(Aij, np.complex128(np.complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
>> Aij = np.append(Aij, np.complex128(complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
1.3. calling the solver flavor which is consistent with the numpy array data type:
>> arpackSlv = pyarpackSlv.complexDouble() # Caution: complexDouble <=> np.array(..., dtype='complex128')
note: NO data type check can be done at C++ side, the pyarpack user MUST insure data consistency.
+1 -1
View File
@@ -194,7 +194,7 @@ BOOST_PYTHON_MODULE(pyarpack) {
doc << " 1.1. create numpy arrays specifying explicitly the type:" << std::endl;
doc << " >> Aij = np.array([], dtype='complex128')" << std::endl;
doc << " 1.2. filling numpy arrays casting value on append:" << std::endl;
doc << " >> Aij = np.append(Aij, np.complex128(np.complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type." << std::endl;
doc << " >> Aij = np.append(Aij, np.complex128(complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type." << std::endl;
doc << " 1.3. calling the solver flavor which is consistent with the numpy array data type:" << std::endl;
doc << " >> arpackSlv = pyarpackSlv.complexDouble() # Caution: complexDouble <=> np.array(..., dtype='complex128')" << std::endl;
doc << " note: NO data type check can be done at C++ side, the pyarpack user MUST insure data consistency." << std::endl;
+12 -12
View File
@@ -10,13 +10,13 @@ Aij = np.array([], dtype='complex128')
for k in range(n):
for l in range(n):
if l == k:
Aij = np.append(Aij, np.complex128(np.complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex128(complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
elif l == k-1:
Aij = np.append(Aij, np.complex128(np.complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex128(complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
elif l == k+1:
Aij = np.append(Aij, np.complex128(np.complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex128(complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
else:
Aij = np.append(Aij, np.complex128(np.complex( 0., 0.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex128(complex( 0., 0.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
for idx, val in enumerate(Aij):
print("A[", idx, "] =", val)
A = (Aij, False) # raw format: Aij values, row ordered (or not).
@@ -65,17 +65,17 @@ Bij = np.array([], dtype='complex64')
for k in range(n):
for l in range(n):
if l == k:
Aij = np.append(Aij, np.complex64(np.complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(np.complex( 33.3, 33.3))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex64(complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 33.3, 33.3))) # Casting value on append is MANDATORY or C++ won't get the expected type.
elif l == k-1:
Aij = np.append(Aij, np.complex64(np.complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(np.complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex64(complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
elif l == k+1:
Aij = np.append(Aij, np.complex64(np.complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(np.complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex64(complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
else:
Aij = np.append(Aij, np.complex64(np.complex( 0., 0.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(np.complex( 0., 0.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex64(complex( 0., 0.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 0., 0.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
for idx, val in enumerate(Aij):
print("A[", idx, "] =", val)
for idx, val in enumerate(Bij):
+12 -12
View File
@@ -10,13 +10,13 @@ Aij = np.array([], dtype='complex128')
for k in range(n):
for l in range(n):
if l == k:
Aij = np.append(Aij, np.complex128(np.complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex128(complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
elif l == k-1:
Aij = np.append(Aij, np.complex128(np.complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex128(complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
elif l == k+1:
Aij = np.append(Aij, np.complex128(np.complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex128(complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
else:
Aij = np.append(Aij, np.complex128(np.complex( 0., 0.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex128(complex( 0., 0.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
for idx, val in enumerate(Aij):
print("A[", idx, "] =", val)
A = (Aij, False) # raw format: Aij values, row ordered (or not).
@@ -64,17 +64,17 @@ Bij = np.array([], dtype='complex64')
for k in range(n):
for l in range(n):
if l == k:
Aij = np.append(Aij, np.complex64(np.complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(np.complex( 33.3, 33.3))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex64(complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 33.3, 33.3))) # Casting value on append is MANDATORY or C++ won't get the expected type.
elif l == k-1:
Aij = np.append(Aij, np.complex64(np.complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(np.complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex64(complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
elif l == k+1:
Aij = np.append(Aij, np.complex64(np.complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(np.complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex64(complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
else:
Aij = np.append(Aij, np.complex64(np.complex( 0., 0.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(np.complex( 0., 0.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex64(complex( 0., 0.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 0., 0.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
for idx, val in enumerate(Aij):
print("A[", idx, "] =", val)
for idx, val in enumerate(Bij):
+12 -12
View File
@@ -10,13 +10,13 @@ Aij = np.array([], dtype='complex128')
for k in range(n):
for l in range(n):
if l == k:
Aij = np.append(Aij, np.complex128(np.complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex128(complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
elif l == k-1:
Aij = np.append(Aij, np.complex128(np.complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex128(complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
elif l == k+1:
Aij = np.append(Aij, np.complex128(np.complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex128(complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
else:
Aij = np.append(Aij, np.complex128(np.complex( 0., 0.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex128(complex( 0., 0.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
for idx, val in enumerate(Aij):
print("A[", idx, "] =", val)
A = (Aij, False) # raw format: Aij values, row ordered (or not).
@@ -64,17 +64,17 @@ Bij = np.array([], dtype='complex64')
for k in range(n):
for l in range(n):
if l == k:
Aij = np.append(Aij, np.complex64(np.complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(np.complex( 33.3, 33.3))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex64(complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 33.3, 33.3))) # Casting value on append is MANDATORY or C++ won't get the expected type.
elif l == k-1:
Aij = np.append(Aij, np.complex64(np.complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(np.complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex64(complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
elif l == k+1:
Aij = np.append(Aij, np.complex64(np.complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(np.complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex64(complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
else:
Aij = np.append(Aij, np.complex64(np.complex( 0., 0.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(np.complex( 0., 0.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex64(complex( 0., 0.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 0., 0.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
for idx, val in enumerate(Aij):
print("A[", idx, "] =", val)
for idx, val in enumerate(Bij):
@@ -16,11 +16,11 @@ for k in range(n):
i = np.append(i, np.@PYINT@(k)) # Casting value on append is MANDATORY or C++ won't get the expected type.
j = np.append(j, np.@PYINT@(l)) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k:
Aij = np.append(Aij, np.complex128(np.complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex128(complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k-1:
Aij = np.append(Aij, np.complex128(np.complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex128(complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k+1:
Aij = np.append(Aij, np.complex128(np.complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex128(complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
for k, l, Akl in zip(i, j, Aij):
print("A[", k, ",", l, "] =", Akl)
A = (n, i, j, Aij) # coo format: dimension, i 0-based indices, j 0-based indices, Aij values.
@@ -77,14 +77,14 @@ for k in range(n):
i = np.append(i, np.@PYINT@(k+1)) # Casting value on append is MANDATORY or C++ won't get the expected type.
j = np.append(j, np.@PYINT@(l+1)) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k:
Aij = np.append(Aij, np.complex64(np.complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(np.complex( 33.3, 33.3))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex64(complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 33.3, 33.3))) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k-1:
Aij = np.append(Aij, np.complex64(np.complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(np.complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex64(complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k+1:
Aij = np.append(Aij, np.complex64(np.complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(np.complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex64(complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
for k, l, Akl in zip(i, j, Aij):
print("A[", k, ",", l, "] =", Akl)
for k, l, Bkl in zip(i, j, Bij):
+9 -9
View File
@@ -16,11 +16,11 @@ for k in range(n):
i = np.append(i, np.@PYINT@(k)) # Casting value on append is MANDATORY or C++ won't get the expected type.
j = np.append(j, np.@PYINT@(l)) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k:
Aij = np.append(Aij, np.complex128(np.complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex128(complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k-1:
Aij = np.append(Aij, np.complex128(np.complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex128(complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k+1:
Aij = np.append(Aij, np.complex128(np.complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex128(complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
for k, l, Akl in zip(i, j, Aij):
print("A[", k, ",", l, "] =", Akl)
A = (n, i, j, Aij) # coo format: dimension, i 0-based indices, j 0-based indices, Aij values.
@@ -77,14 +77,14 @@ for k in range(n):
i = np.append(i, np.@PYINT@(k+1)) # Casting value on append is MANDATORY or C++ won't get the expected type.
j = np.append(j, np.@PYINT@(l+1)) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k:
Aij = np.append(Aij, np.complex64(np.complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(np.complex( 33.3, 33.3))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex64(complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 33.3, 33.3))) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k-1:
Aij = np.append(Aij, np.complex64(np.complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(np.complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex64(complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k+1:
Aij = np.append(Aij, np.complex64(np.complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(np.complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex64(complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
for k, l, Akl in zip(i, j, Aij):
print("A[", k, ",", l, "] =", Akl)
for k, l, Bkl in zip(i, j, Bij):
+9 -9
View File
@@ -16,11 +16,11 @@ for k in range(n):
i = np.append(i, np.@PYINT@(k)) # Casting value on append is MANDATORY or C++ won't get the expected type.
j = np.append(j, np.@PYINT@(l)) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k:
Aij = np.append(Aij, np.complex128(np.complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex128(complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k-1:
Aij = np.append(Aij, np.complex128(np.complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex128(complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k+1:
Aij = np.append(Aij, np.complex128(np.complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex128(complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
for k, l, Akl in zip(i, j, Aij):
print("A[", k, ",", l, "] =", Akl)
A = (n, i, j, Aij) # coo format: dimension, i 0-based indices, j 0-based indices, Aij values.
@@ -75,14 +75,14 @@ for k in range(n):
i = np.append(i, np.@PYINT@(k+1)) # Casting value on append is MANDATORY or C++ won't get the expected type.
j = np.append(j, np.@PYINT@(l+1)) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k:
Aij = np.append(Aij, np.complex64(np.complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(np.complex( 33.3, 33.3))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex64(complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 33.3, 33.3))) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k-1:
Aij = np.append(Aij, np.complex64(np.complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(np.complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex64(complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k+1:
Aij = np.append(Aij, np.complex64(np.complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(np.complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex64(complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
for k, l, Akl in zip(i, j, Aij):
print("A[", k, ",", l, "] =", Akl)
for k, l, Bkl in zip(i, j, Bij):
+9 -9
View File
@@ -16,11 +16,11 @@ for k in range(n):
i = np.append(i, np.@PYINT@(k)) # Casting value on append is MANDATORY or C++ won't get the expected type.
j = np.append(j, np.@PYINT@(l)) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k:
Aij = np.append(Aij, np.complex128(np.complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex128(complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k-1:
Aij = np.append(Aij, np.complex128(np.complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex128(complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k+1:
Aij = np.append(Aij, np.complex128(np.complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex128(complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
for k, l, Akl in zip(i, j, Aij):
print("A[", k, ",", l, "] =", Akl)
A = (n, i, j, Aij) # coo format: dimension, i 0-based indices, j 0-based indices, Aij values.
@@ -74,14 +74,14 @@ for k in range(n):
i = np.append(i, np.@PYINT@(k+1)) # Casting value on append is MANDATORY or C++ won't get the expected type.
j = np.append(j, np.@PYINT@(l+1)) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k:
Aij = np.append(Aij, np.complex64(np.complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(np.complex( 33.3, 33.3))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex64(complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 33.3, 33.3))) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k-1:
Aij = np.append(Aij, np.complex64(np.complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(np.complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex64(complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k+1:
Aij = np.append(Aij, np.complex64(np.complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(np.complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex64(complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
for k, l, Akl in zip(i, j, Aij):
print("A[", k, ",", l, "] =", Akl)
for k, l, Bkl in zip(i, j, Bij):