Commit 662c63fa authored by alexander.dornheim's avatar alexander.dornheim
Browse files

Fixed various syntax errors in QNAP

parent 5e72c490
......@@ -27,7 +27,9 @@
#
#
class QNAP(Algortihm):
from .algorithms import Algorithm
class QNAP(Algorithm):
def __init__(self,config):
self.samsare = samsara()
......@@ -50,13 +52,13 @@ class QNAP(Algortihm):
uold_vec=u[:,1]
unew_vec=tmp_u[:,1]
gradfold_vec = gradfnew_vec
gradfnew_vec = (u[:,1]- tmp_u[:,1)]
unew_vec, uold_vec, gap[iter-1], gradfold_vec, change[iter], samsara_data =...
self.samsara(uold_vec, unew_vec, ...
gap[iter-2]*self.Nx*self.Ny,...
gap[iter-1]*self.Nx*self.Ny,...
gradfnew_vec = (u[:,1]- tmp_u[:,1])
unew_vec, uold_vec, gap[iter-1], gradfold_vec, change[iter], samsara_data = \
self.samsara(uold_vec, unew_vec,
gap[iter-2]*self.Nx*self.Ny,
gap[iter-1]*self.Nx*self.Ny,
gradfold_vec, gradfnew_vec, samsara_data)
for in range self.product_space_dimension:
for j in range(self.product_space_dimension):
tmp_u[:,j]=unew_vec
gap[iter-1]=gap[iter-1]/(self.Nx*self.Ny)
else:
......@@ -65,31 +67,31 @@ class QNAP(Algortihm):
gradfnew_vec = (u[:,1]- tmp_u[:,1])
else:
if iter>3:
uold_vec=reshape(concatenate(real(u(:,1)), imag(u(:,1))), ...
uold_vec=reshape(concatenate(real(u[:,1]), imag(u[:,1])),
self.Ny*self.Nx*2, 1);
unew_vec=reshape(concatenate(real(tmp_u(:,1)), imag(tmp_u(:,1))), ...
unew_vec=reshape(concatenate(real(tmp_u[:,1]), imag(tmp_u[:,1])),
self.Ny*self.Nx*2, 1)
gradfold_vec = gradfnew_vec
gradfnew_vec = uold_vec-unew_vec
unew_vec,uold_vec,gap[iter-1],gradfold_vec, change[iter], samsara_data=...
feval('samsara', uold_vec, unew_vec, ...
gap(iter-2)*self.Nx*self.Ny,...
gap(iter-1)*self.Nx*self.Ny,...
gradfold_vec, gradfnew_vec, samsara_data);
unew_vec,uold_vec,gap[iter-1],gradfold_vec, change[iter], samsara_data= \
feval('samsara', uold_vec, unew_vec,
gap(iter-2)*self.Nx*self.Ny,
gap(iter-1)*self.Nx*self.Ny,
gradfold_vec, gradfnew_vec, samsara_data)
# now reshape unew_vec
tmp_u_vec = unew_vec(1:self.Ny*self.Nx)+1i*unew_vec(self.Ny*self.Nx+1:self.Ny*self.Nx*2);
for j in range(self.product_space_dimension)
tmp_u[:,j]=tmp_u_vec;
tmp_u_vec = unew_vec[1:self.Ny*self.Nx]+1j*unew_vec[self.Ny*self.Nx+1:self.Ny*self.Nx*2]
for j in range(self.product_space_dimension):
tmp_u[:,j]=tmp_u_vec
gap[iter-1]=gap[iter-1]/(self.Nx*self.Ny)
else:
uold_vec=reshape([real(u(:,1)), imag(u(:,1))], ...
self.Ny*self.Nx*2, 1);
unew_vec=reshape([real(tmp_u(:,1)), imag(tmp_u(:,1))], ...
self.Ny*self.Nx*2, 1);
uold_vec=reshape([real(u[:,1]), imag(u[:,1])],
self.Ny*self.Nx*2, 1)
unew_vec=reshape([real(tmp_u[:,1]), imag(tmp_u[:,1])],
self.Ny*self.Nx*2, 1)
gradfnew_vec = uold_vec-unew_vec
elif dim_number == 3
if (isreal(u))
elif dim_number == 3:
if (isreal(u)):
tmp2 = u[:,:,1]
uold_vec=reshape(tmp2,self.Nx*self.Ny,1)
tmp2 = tmp_u[:,:,1]
......@@ -99,10 +101,10 @@ class QNAP(Algortihm):
else:
gradfold_vec = gradfnew_vec
gradfnew_vec = uold_vec-unew_vec
unew_vec,uold_vec,gap[iter-1],gradfold_vec, change[iter], samsara_data=...
feval('samsara', uold_vec, unew_vec, ...
gap(iter-2)*self.Nx*self.Ny,...
gap(iter-1)*self.Nx*self.Ny,...
unew_vec,uold_vec,gap[iter-1],gradfold_vec, change[iter], samsara_data= \
feval('samsara', uold_vec, unew_vec,
gap(iter-2)*self.Nx*self.Ny,
gap(iter-1)*self.Nx*self.Ny,
gradfold_vec, gradfnew_vec, samsara_data);
# now reshape and replace u
gap[iter-1]=gap[iter-1]/(self.Nx*self.Ny);
......@@ -112,25 +114,25 @@ class QNAP(Algortihm):
tmp_u[:,:,j]=tmp2
end
else:
tmp2=concatenate(real(u[:,:,1]),imag(u[:,:,1)])
tmp2=concatenate(real(u[:,:,1]),imag(u[:,:,1]))
uold_vec=reshape(tmp2,self.Nx*self.Ny*2,1)
tmp2=concatenate(real(tmp_u(:,:,1)), imag(tmp_u(:,:,1)))
tmp2=concatenate(real(tmp_u[:,:,1]), imag(tmp_u[:,:,1]))
unew_vec = reshape(tmp2,self.Nx*self.Ny*2,1)
if iter<=3:
gradfnew_vec = uold_vec-unew_vec
else
else:
gradfold_vec = gradfnew_vec
gradfnew_vec = uold_vec-unew_vec
unew_vec,uold_vec,gap[iter-1],gradfold_vec, change[iter], samsara_data=...
feval('samsara', uold_vec, unew_vec, ...
gap(iter-2)*self.Nx*self.Ny,...
gap(iter-1)*self.Nx*self.Ny,...
gradfold_vec, gradfnew_vec, samsara_data);
unew_vec,uold_vec,gap[iter-1],gradfold_vec, change[iter], samsara_data= \
feval('samsara', uold_vec, unew_vec,
gap(iter-2)*self.Nx*self.Ny,
gap(iter-1)*self.Nx*self.Ny,
gradfold_vec, gradfnew_vec, samsara_data)
# now reshape and replace u
gap[iter-1]=gap[iter-1]/(self.Nx*self.Ny);
tmp2=reshape(unew_vec,self.Ny,self.Nx*2);
unew=tmp2(:,1:self.Nx) +1i*tmp2(:,self.Nx+1:2*self.Nx);
for j=1:self.product_space_dimension
gap[iter-1]=gap[iter-1]/(self.Nx*self.Ny)
tmp2=reshape(unew_vec,self.Ny,self.Nx*2)
unew=tmp2[:,1:self.Nx] +1j*tmp2[:,self.Nx+1:2*self.Nx]
for j in range(self.product_space_dimension):
tmp_u[:,:,j]=unew
else: # product space of 3D arrays
print('Cannot handle 3D arrays on the product space yet')
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment