diff --git a/Project.toml b/Project.toml new file mode 100644 index 0000000..5aa3aad --- /dev/null +++ b/Project.toml @@ -0,0 +1,16 @@ +name = "MatrixChainMultiply" +uuid = "f01a5c79-138a-571d-9c23-7d209c0b0a14" +authors = ["Austin Privett"] +version = "0.1.0" + +[deps] + +[compat] +julia = "1.0" + +[extras] +LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" + +[targets] +test = ["LinearAlgebra", "Test"] diff --git a/README.md b/README.md index c02de0e..6152f5b 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ For example, the types given in the [ArrayFire.jl](https://github.com/JuliaCompu Since this package is not registered, you must install it by cloning. To add this package, use: ```julia -Pkg.clone("https://github.com/AustinPrivett/MatrixChainMultiply.jl") +Pkg.add(url="https://github.com/AustinPrivett/MatrixChainMultiply.jl") ``` ## Using this Package diff --git a/src/MatrixChainMultiply.jl b/src/MatrixChainMultiply.jl index 52ad27e..409d9e6 100644 --- a/src/MatrixChainMultiply.jl +++ b/src/MatrixChainMultiply.jl @@ -160,9 +160,9 @@ Matrix-style sizes. Return type looks like `(i,j)` where `i` and `j` are `Ints`. If other packages with matrix types (e.g., OpenCl or ArrayFire) inherit from AbstractArray, there shouldn't be issues with other packages using this one. """ -msize{T}(m::AbstractArray{T,2}) = size(m) -msize{T}(v::AbstractArray{T,1}) = (size(v)[1], 1) -msize{T<:Number}(s::T) = (1, 1) +msize(m::AbstractMatrix) = size(m) +msize(v::AbstractVector) = (size(v,1), 1) +msize(s::Number) = (1, 1) end # module diff --git a/test/runtests.jl b/test/runtests.jl index ce3c9fb..6b20c8b 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,5 +1,5 @@ using MatrixChainMultiply -using Base.Test +using Test, LinearAlgebra # case on readme function readme_example(use_arrayfire=false) @@ -19,8 +19,12 @@ function readme_example(use_arrayfire=false) difference = result1 - result2 # do again to get timings - tic(); *(a,b,c,d); stdtime = toc() - tic(); matrixchainmultiply(a,b,c,d); chaintime = toc() + t1 = time() + *(a,b,c,d); + stdtime = time() - t1 + t2 = time() + matrixchainmultiply(a,b,c,d); + chaintime = time() - t2 speedup = stdtime / chaintime print("Speedup = $speedup")