-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
566782c
commit e1d56e8
Showing
27 changed files
with
1,134 additions
and
1,158 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
## numerical_tests.tst:01 | ||
%!test | ||
%! if (~isempty(which("pastix"))) | ||
%! for i=1:2 | ||
%! for j=1:2 | ||
%! A = [1 0 0 0 0 | ||
%! 0 3 0 0 0 | ||
%! 2 0 5 0 0 | ||
%! 0 0 6 7 0 | ||
%! 0 0 0 0 8]; | ||
%! b = [1, 9; | ||
%! 2, 5; | ||
%! 3, 4; | ||
%! 4, 8; | ||
%! 6, 7]; | ||
%! switch (j) | ||
%! case 2 | ||
%! A += 0.5j * A; | ||
%! b += 0.5j * b; | ||
%! endswitch | ||
%! opts.verbose = PASTIX_API_VERBOSE_NOT; | ||
%! opts.factorization = PASTIX_API_FACT_LU; | ||
%! opts.matrix_type = PASTIX_API_SYM_NO; | ||
%! opts.refine_max_iter = int32(10); | ||
%! opts.bind_thread_mode = PASTIX_API_BIND_NO; | ||
%! opts.number_of_threads = int32(4); | ||
%! opts.check_solution = true; | ||
%! switch i | ||
%! case 1 | ||
%! x = pastix(A, b, opts); | ||
%! case 2 | ||
%! x = pastix(pastix(A, opts), b); | ||
%! endswitch | ||
%! f = max(norm(A * x - b, "cols") ./ norm(A * x + b, "cols")); | ||
%! assert(f <= eps^0.8); | ||
%! endfor | ||
%! endfor | ||
%! else | ||
%! warning("pastix is not installed"); | ||
%! endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
## numerical_tests.tst:02 | ||
%!test | ||
%! if (~isempty(which("pastix"))) | ||
%! tol = eps^0.35; | ||
%! rand("seed", 0); | ||
%! for N=[2, 10, 100] | ||
%! for i=1:10 | ||
%! for j=1:2 | ||
%! for k=1:2 | ||
%! A = rand(N, N); | ||
%! b = rand(N, 10); | ||
%! switch (k) | ||
%! case 2 | ||
%! A += 1j * rand(N, N); | ||
%! b += 1j * rand(N, 10); | ||
%! endswitch | ||
%! opts.verbose = PASTIX_API_VERBOSE_NOT; | ||
%! opts.factorization = PASTIX_API_FACT_LU; | ||
%! opts.matrix_type = PASTIX_API_SYM_NO; | ||
%! opts.refine_max_iter = int32(10); | ||
%! opts.check_solution = true; | ||
%! switch j | ||
%! case 1 | ||
%! x = pastix(A, b, opts); | ||
%! case 2 | ||
%! x = pastix(pastix(A, opts), b); | ||
%! endswitch | ||
%! f = max(norm(A * x - b, "cols") ./ norm(A * x + b, "cols")); | ||
%! assert(f <= tol); | ||
%! endfor | ||
%! endfor | ||
%! endfor | ||
%! endfor | ||
%! endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
## numerical_tests.tst:03 | ||
%!test | ||
%! if (~isempty(which("pastix"))) | ||
%! tol = eps^0.35; | ||
%! rand("seed", 0); | ||
%! for N=[2, 10, 100] | ||
%! for i=1:10 | ||
%! for j=1:2 | ||
%! for k=1:2 | ||
%! A = rand(N, N); | ||
%! b = rand(N, 10); | ||
%! switch (k) | ||
%! case 2 | ||
%! A += 1j * rand(N, N); | ||
%! b += 1j * rand(N, 10); | ||
%! endswitch | ||
%! opts.verbose = PASTIX_API_VERBOSE_NOT; | ||
%! opts.factorization = PASTIX_API_FACT_LU; | ||
%! opts.matrix_type = PASTIX_API_SYM_NO; | ||
%! opts.refine_max_iter = int32(10); | ||
%! opts.check_solution = true; | ||
%! switch j | ||
%! case 1 | ||
%! x = pastix(A, b, opts); | ||
%! case 2 | ||
%! x = pastix(pastix(A, opts), b); | ||
%! endswitch | ||
%! f = max(norm(A * x - b, "cols") ./ norm(A * x + b, "cols")); | ||
%! assert(f <= tol); | ||
%! endfor | ||
%! endfor | ||
%! endfor | ||
%! endfor | ||
%! endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
## numerical_tests.tst:04 | ||
%!test | ||
%! if (~isempty(which("pastix"))) | ||
%! tol = eps^0.3; | ||
%! rand("seed", 0); | ||
%! for ref=int32([20]) | ||
%! for bind=[PASTIX_API_BIND_NO] | ||
%! for t=[1,4] | ||
%! for s=0:1 | ||
%! for f=[PASTIX_API_FACT_LLT, PASTIX_API_FACT_LDLT] | ||
%! for N=[10, 100] | ||
%! for i=1:10 | ||
%! for j=1:2 | ||
%! for k=1:2 | ||
%! A = rand(N, N); | ||
%! switch (k) | ||
%! case 2 | ||
%! A += 1j * rand(N, N); | ||
%! endswitch | ||
%! A *= A.'; | ||
%! [r, c, d] = find(A); | ||
%! if s | ||
%! idx = find(r >= c); | ||
%! else | ||
%! idx = 1:numel(r); | ||
%! endif | ||
%! b = rand(N, 10); | ||
%! switch (k) | ||
%! case 2 | ||
%! b += 1j * rand(N, 10); | ||
%! endswitch | ||
%! opts.verbose = PASTIX_API_VERBOSE_NOT; | ||
%! opts.refine_max_iter = ref; | ||
%! opts.matrix_type = PASTIX_API_SYM_YES; | ||
%! opts.factorization = f; | ||
%! opts.number_of_threads = t; | ||
%! opts.bind_thread_mode = bind; | ||
%! opts.check_solution = false; | ||
%! opts.epsilon_refinement = 1e-12; | ||
%! switch j | ||
%! case 1 | ||
%! x = pastix(sparse(r(idx), c(idx), d(idx)), b, opts); | ||
%! case 2 | ||
%! x = pastix(pastix(sparse(r(idx), c(idx), d(idx)), opts), b); | ||
%! endswitch | ||
%! xref = A \ b; | ||
%! ferr = norm(A * x - b, "cols") ./ norm(A * x + b, "cols"); | ||
%! fref = norm(A * xref - b, "cols") ./ norm(A * xref + b, "cols"); | ||
%! assert(max(ferr) <= tol); | ||
%! assert(max(ferr) <= 10 * max(fref)); | ||
%! endfor | ||
%! endfor | ||
%! endfor | ||
%! endfor | ||
%! endfor | ||
%! endfor | ||
%! endfor | ||
%! endfor | ||
%! endfor | ||
%! endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
## numerical_tests.tst:05 | ||
%!test | ||
%! if (~isempty(which("pastix"))) | ||
%! for k=1:2 | ||
%! tol = sqrt(eps); | ||
%! A = [ 1, -1, 0, 0, 1; | ||
%! -1, 2, -1, 0, 0; | ||
%! 0, -1, 2, -1, 0; | ||
%! 0, 0, -1, 1, 0; | ||
%! 1, 0, 0, 0, 0]; | ||
%! b = [1; 2; 3; 4; 5]; | ||
%! switch (k) | ||
%! case 2 | ||
%! A += 0.5j * A; | ||
%! b += 0.5j * b; | ||
%! endswitch | ||
%! opts.verbose = PASTIX_API_VERBOSE_NOT; | ||
%! opts.refine_max_iter = int32(10); | ||
%! opts.matrix_type = PASTIX_API_SYM_YES; | ||
%! opts.factorization = PASTIX_API_FACT_LDLT; | ||
%! opts.check_solution = true; | ||
%! for i=1:2 | ||
%! [r, c, d] = find(A); | ||
%! idx = find(r >= c); | ||
%! Asym = sparse(r(idx), c(idx), d(idx), rows(A), columns(A)); | ||
%! switch i | ||
%! case 1 | ||
%! x = pastix(Asym, b, opts); | ||
%! case 2 | ||
%! x = pastix(pastix(Asym, opts), b); | ||
%! endswitch | ||
%! f = max(norm(A * x - b) ./ norm(A * x + b)); | ||
%! assert(f <= tol); | ||
%! assert(max(norm(x - A \ b, "cols")) <= tol * max(norm(A \ b, "cols"))); | ||
%! endfor | ||
%! endfor | ||
%! endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
## numerical_tests.tst:06 | ||
%!test | ||
%! if (~isempty(which("pastix"))) | ||
%! for k=1:2 | ||
%! A = [1 0 0 0 0 | ||
%! 0 3 0 0 0 | ||
%! 2 0 5 0 0 | ||
%! 0 0 6 7 0 | ||
%! 0 0 0 0 8]; | ||
%! b = [1, 9; | ||
%! 2, 5; | ||
%! 3, 4; | ||
%! 4, 8; | ||
%! 6, 7]; | ||
%! switch (k) | ||
%! case 2 | ||
%! A += 0.5j * A; | ||
%! b += 0.5j * b; | ||
%! endswitch | ||
%! opts.verbose = PASTIX_API_VERBOSE_NOT; | ||
%! opts.factorization = PASTIX_API_FACT_LU; | ||
%! opts.matrix_type = PASTIX_API_SYM_NO; | ||
%! opts.refine_max_iter = int32(10); | ||
%! opts.check_solution = true; | ||
%! x = pastix(A, b, opts); | ||
%! f = max(norm(A * x - b, "cols") ./ norm(A * x + b, "cols")); | ||
%! assert(f <= eps^0.8); | ||
%! assert(max(norm(x - A \ b, "cols")) <= eps^0.8 * max(norm(A \ b, "cols"))); | ||
%! endfor | ||
%! endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
## numerical_tests.tst:07 | ||
%!test | ||
%! if (~isempty(which("pastix"))) | ||
%! tol = eps^0.35; | ||
%! rand("seed", 0); | ||
%! for N=[10, 20, 100] | ||
%! for i=1:10 | ||
%! for j=1:2 | ||
%! for k=1:2 | ||
%! A = rand(N, N); | ||
%! b = rand(N, 10); | ||
%! switch (k) | ||
%! case 2 | ||
%! A += 1j * rand(N, N); | ||
%! b += 1j * rand(N, 10); | ||
%! endswitch | ||
%! opts.verbose = PASTIX_API_VERBOSE_NOT; | ||
%! opts.factorization = PASTIX_API_FACT_LU; | ||
%! opts.matrix_type = PASTIX_API_SYM_NO; | ||
%! opts.refine_max_iter = int32(10); | ||
%! opts.check_solution = true; | ||
%! switch j | ||
%! case 1 | ||
%! x = pastix(A, b, opts); | ||
%! case 2 | ||
%! x = pastix(pastix(A, opts), b); | ||
%! endswitch | ||
%! f = max(norm(A * x - b, "cols") ./ norm(A * x + b, "cols")); | ||
%! assert(f <= tol); | ||
%! assert(max(norm(x - A \ b, "cols")) <= tol * max(norm(A \ b, "cols"))); | ||
%! endfor | ||
%! endfor | ||
%! endfor | ||
%! endfor | ||
%! endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
## numerical_tests.tst:08 | ||
%!test | ||
%! test_idx = int32(0); | ||
%! if (~isempty(which("pastix"))) | ||
%! rand("seed", 0); | ||
%! for mt=[PASTIX_API_SYM_YES, PASTIX_API_SYM_NO] | ||
%! for ref=[true,false] | ||
%! for t=[1,4] | ||
%! for s=0:2 | ||
%! for j=1:2 | ||
%! for k=1:2 | ||
%! switch mt | ||
%! case PASTIX_API_SYM_NO | ||
%! frange = PASTIX_API_FACT_LU; | ||
%! otherwise | ||
%! frange = [PASTIX_API_FACT_LDLT, PASTIX_API_FACT_LLT]; | ||
%! endswitch | ||
%! for f=frange | ||
%! for N=[10, 50] | ||
%! for i=1:10 | ||
%! for j=1:2 | ||
%! A = sprand(N, N, 0.1, 1) + diag(rand(N, 1) + 1); | ||
%! switch (k) | ||
%! case 2 | ||
%! [r, c, d] = find(A); | ||
%! A += sparse(r, c, 1j * rand(numel(d), 1), N, N); | ||
%! endswitch | ||
%! switch mt | ||
%! case PASTIX_API_SYM_NO | ||
%! case PASTIX_API_SYM_YES | ||
%! switch f | ||
%! case {PASTIX_API_FACT_LLT, PASTIX_API_FACT_LDLT} | ||
%! A *= A.'; | ||
%! endswitch | ||
%! endswitch | ||
%! [r, c, d] = find(A); | ||
%! opts.factorization = f; | ||
%! switch mt | ||
%! case PASTIX_API_SYM_NO | ||
%! idx = 1:numel(r); | ||
%! otherwise | ||
%! switch s | ||
%! case 0 | ||
%! idx = find(r >= c); | ||
%! case 1 | ||
%! idx = find(r <= c); | ||
%! otherwise | ||
%! idx = 1:numel(r); | ||
%! endswitch | ||
%! endswitch | ||
%! b = rand(N, 10); | ||
%! switch (k) | ||
%! case 2 | ||
%! b += 1j * rand(N, 10); | ||
%! endswitch | ||
%! opts.verbose = PASTIX_API_VERBOSE_NOT; | ||
%! opts.refine_max_iter = ref; | ||
%! opts.matrix_type = mt; | ||
%! opts.number_of_threads = t; | ||
%! opts.check_solution = true; | ||
%! Asym = sparse(r(idx), c(idx), d(idx)); | ||
%! assert(nnz(Asym) > 0); | ||
%! xref = A \ b; | ||
%! switch j | ||
%! case 1 | ||
%! x = pastix(Asym, b, opts); | ||
%! case 2 | ||
%! x = pastix(pastix(Asym, opts), b); | ||
%! endswitch | ||
%! if ref | ||
%! tolf = eps^0.45; | ||
%! tolx = eps^0.45; | ||
%! else | ||
%! tolf = eps^0.3; | ||
%! tolx = eps^0.4; | ||
%! endif | ||
%! fpas = norm(A * x - b, "cols") ./ norm(A * x + b, "cols"); | ||
%! fref = norm(A * xref - b, "cols") ./ norm(A * xref + b, "cols"); | ||
%! assert(max(fpas) <= tolf); | ||
%! assert(max(fref) <= tolf); | ||
%! assert(max(norm(x - xref, "cols")) <= tolx * max(norm(xref, "cols"))); | ||
%! fprintf(stdout, "current test %d passed\n", ++test_idx); | ||
%! endfor | ||
%! endfor | ||
%! endfor | ||
%! endfor | ||
%! endfor | ||
%! endfor | ||
%! endfor | ||
%! endfor | ||
%! endfor | ||
%! endfor | ||
%! endif |
Oops, something went wrong.