1 function err=w_assembly_fortran(A,X,u0,lambda,params)
2 % call fortran version and compare results
5 W_m=w_assembly(A,X,u0, lambda2,params);
11 %Writing all arrays to text files for use by fortran tester
12 write_array(A,'A_test');
15 lambda=reshape(lambda,n);
16 write_array(swap23(lambda), 'lambda_test');
18 write_array(swap23(X{1}),'X_test');
19 write_array(swap23(X{2}),'Y_test');
20 write_array(swap23(X{3}),'Z_test');
22 write_array(swap23(u0{1}),'u0_test');
23 write_array(swap23(u0{2}),'v0_test');
24 write_array(swap23(u0{3}),'w0_test');
26 system('./fortran/w_assembly_test.exe');
27 U = swap23(read_array('U_test'));
28 V = swap23(read_array('V_test'));
29 W = swap23(read_array('W_test'));
33 err_u = norm(U_m(:) - U(:),inf)
34 err_v = norm(V_m(:) - V(:),inf)
35 err_w = norm(W_m(:) - W(:),inf)
36 err = max([err_u, err_v, err_w])