diff --git a/test/perf/arrayalloc/Makefile b/test/perf/arrayalloc/Makefile deleted file mode 100644 index a514914fe19eb..0000000000000 --- a/test/perf/arrayalloc/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -JULIAHOME := $(abspath ../../..) -include $(JULIAHOME)/Make.inc - -ifndef PYTHONBIN - PYTHONBIN = python -endif - -all: python julia - -python: - $(PYTHONBIN) lucompletepiv.py - -julia: - @$(call spawn,$(JULIA_EXECUTABLE)) lucompletepiv.jl diff --git a/test/perf/arrayalloc/lucompletepiv.jl b/test/perf/arrayalloc/lucompletepiv.jl deleted file mode 100644 index 7ce7dc5eb6f8d..0000000000000 --- a/test/perf/arrayalloc/lucompletepiv.jl +++ /dev/null @@ -1,55 +0,0 @@ -# This file is a part of Julia. License is MIT: http://julialang.org/license - -function lucompletepivCopy!(A) - n = size(A, 1) - rowpiv=zeros(Int, n-1) - colpiv=zeros(Int, n-1) - for k = 1:n-1 - As = abs(A[k:n, k:n]) - μ, λ = ind2sub(size(As), indmax(As)) - μ += k-1; λ += k-1 - rowpiv[k] = μ - A[[k,μ], 1:n] = A[[μ,k], 1:n] - colpiv[k] = λ - A[1:n, [k,λ]] = A[1:n, [λ,k]] - if A[k,k] ≠ 0 - ρ = k+1:n - A[ρ, k] = A[ρ, k]/A[k, k] - A[ρ, ρ] = A[ρ, ρ] - A[ρ, k:k] * A[k:k, ρ] - end - end - return (A, rowpiv, colpiv) -end - -function lucompletepivSub!(A) - n = size(A, 1) - rowpiv=zeros(Int, n-1) - colpiv=zeros(Int, n-1) - for k = 1:n-1 - As = abs(sub(A, k:n, k:n)) - μ, λ = ind2sub(size(As), indmax(As)) - μ += k-1; λ += k-1 - rowpiv[k] = μ - A[[k,μ], 1:n] = sub(A, [μ,k], 1:n) - colpiv[k] = λ - A[1:n, [k,λ]] = sub(A, 1:n, [λ,k]) - if A[k,k] ≠ 0 - ρ = k+1:n - A[ρ, k] = sub(A, ρ, k)/A[k, k] - A[ρ, ρ] = sub(A, ρ, ρ) - sub(A, ρ, k) * sub(A, k, ρ) - end - end - return (A, rowpiv, colpiv) -end - -println("Julia version with copy slices") -for n = [100, 250, 500, 1000] - A = randn(n,n) - @printf("size %4d matrix factorized in %6.3f seconds\n", n, mean([@elapsed lucompletepivCopy!(copy(A)) for i = 1:3])) -end - -println("\nJulia version with view slices") -for n = [100, 250, 500, 1000] - A = randn(n,n) - @printf("size %4d matrix factorized in %6.3f seconds\n", n, mean([@elapsed lucompletepivSub!(copy(A)) for i = 1:3])) -end diff --git a/test/perf/arrayalloc/lucompletepiv.py b/test/perf/arrayalloc/lucompletepiv.py deleted file mode 100644 index 81785ab307976..0000000000000 --- a/test/perf/arrayalloc/lucompletepiv.py +++ /dev/null @@ -1,35 +0,0 @@ -import numpy as np -import time - -def lucompletepiv(A): - assert np.size(A, 0) == np.size(A, 1) - n = np.size(A, 1) - rowpiv = np.zeros(n-1, dtype=int) - colpiv = np.zeros(n-1, dtype=int) - for k in range(n-1): - Asub = abs(A[k:n, k:n]) - mu, lam = np.unravel_index(np.argmax(Asub), np.shape(Asub)) - mu, lam = mu + k, lam + k - rowpiv[k] = mu - A[[k, mu], :n] = A[[mu, k], :n] - colpiv[k] = lam - A[:n, [k, lam]] = A[:n, [lam, k]] - if A[k, k] != 0: - rho = slice(k+1, n) - A[rho, k] = A[rho, k]/A[k, k] - A[rho, rho] -= np.dot(np.reshape(A[rho, k], (n - (k + 1), 1)), - np.reshape(A[k, rho], (1, n - (k + 1)))) - return (A, rowpiv, colpiv) - - -for n in [100, 250, 500, 1000]: - tt = [] - for rep in range(3): - A = np.random.randn(n, n) - t0 = time.time() - lucompletepiv(A.copy()) - tt.append(time.time() - t0) - - print("size %4d matrix factorized in %6.3f seconds" % (n, sum(tt)/3)) - -print("")