Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -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"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/MatrixChainMultiply.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 7 additions & 3 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using MatrixChainMultiply
using Base.Test
using Test, LinearAlgebra

# case on readme
function readme_example(use_arrayfire=false)
Expand All @@ -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")

Expand Down