import Pkg
Pkg.add("BenchmarkTools")
using Random
using LinearAlgebra
using BenchmarkTools
using TimerOutputs
rng = MersenneTwister(1234)
println("Test A * B")
to = TimerOutput()
# Use 100 for precompile
dims = [100, 1000, 2000, 3000, 4000, 5000]
for dim = dims
println("Dimension ", dim)
for i = 1:5
A = randn(rng, Float64, (dim, dim))
B = randn(rng, Float64, (dim, dim))
@timeit to string("dim ", dim) X = A * B
end
end
println(to)
println("Test A/B")
to = TimerOutput()
# Use 100 for precompile
dims = [100, 1000, 2000, 3000, 4000, 5000]
for dim = dims
println("Dimension ", dim)
for i = 1:5
A = randn(rng, Float64, (dim, dim))
B = randn(rng, Float64, dim)
@timeit to string("dim ", dim) X = A \ B
end
end
println(to)
# A = randn(rng, Float64, (dim, dim))
# @time lu(A)
# print("-------")
# B = randn(rng, Float64, dim);
# @time X = A \ B;
# print("Test A/B")
# A = randn(rng, Float64, (dim, dim))
# @time lu(A)
# print("2-------")
# B = randn(rng, Float64, dim);
# @time X = A \ B;
# print("Test cholesky")
# A = randn(rng, Float64, (dim, dim))
# AT = transpose(A)
# B = A + AT
# NEYEN = I(dim) * dim
# C = NEYEN + B
# @time cholesky(C);
# print("Test inv")
# A = randn(rng, Float64, (dim, dim))
# @btime invA = inv(A);
# print("Test inv2")
# A = randn(rng, Float64, (dim, dim))
# @btime invA = inv(A);
# print("Test inv3")
# A = randn(rng, Float64, (dim, dim))
# @btime invA = inv(A);