Skip to content

Commit

Permalink
more bug fix, add project.toml, test @JuliaRegistrator register()
Browse files Browse the repository at this point in the history
  • Loading branch information
Jutho committed Apr 15, 2019
1 parent b3967f8 commit 0fa5348
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 20 deletions.
13 changes: 1 addition & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,6 @@ env:
- JULIA_NUM_THREADS=1
- JULIA_NUM_THREADS=4

## uncomment and modify the following lines to manually install system packages
#addons:
# apt: # apt-get for linux
# packages:
# - gfortran
#before_script: # homebrew for mac
# - if [ $TRAVIS_OS_NAME = osx ]; then brew install gcc; fi

## uncomment the following lines to override the default test script
#script:
# - julia -e 'Pkg.clone(pwd()); Pkg.build("KrylovKit"); Pkg.test("KrylovKit"; coverage=true)'
after_success:
# push coverage results to Coveralls
# push coverage results to CodeCov and Coveralls
- julia -e 'using Pkg; Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder()); Coveralls.submit(Coveralls.process_folder())'
46 changes: 46 additions & 0 deletions Manifest.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# This file is machine-generated - editing it directly is not advised

[[Base64]]
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

[[Distributed]]
deps = ["Random", "Serialization", "Sockets"]
uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"

[[InteractiveUtils]]
deps = ["Markdown"]
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"

[[Libdl]]
uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb"

[[LinearAlgebra]]
deps = ["Libdl"]
uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"

[[Logging]]
uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"

[[Markdown]]
deps = ["Base64"]
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"

[[Random]]
deps = ["Serialization"]
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"

[[Serialization]]
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"

[[Sockets]]
uuid = "6462fe0b-24de-5631-8697-dd941f90decc"

[[Test]]
deps = ["Distributed", "InteractiveUtils", "Logging", "Random"]
uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[[TupleTools]]
deps = ["Random", "Test"]
git-tree-sha1 = "b006524003142128cc6d36189dce337729aa0050"
uuid = "9d95972d-f1c8-5527-a6e0-b4b365fa01f6"
version = "1.1.0"
18 changes: 18 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name = "Strided"
uuid = "5e0ebb24-38b0-5f93-81fe-25c709ecae67"
authors = ["Jutho Haegeman"]
version = "0.3.1"

[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
TupleTools = "9d95972d-f1c8-5527-a6e0-b4b365fa01f6"

[compat]
TupleTools = "1.1"
julia = "1"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test"]
14 changes: 6 additions & 8 deletions src/abstractstridedview.jl
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,6 @@ function getblasmatrix(A::AbstractStridedView{T,2}) where {T<:LinearAlgebra.Blas
return blasstrides(adjoint(A)), 'C'
end
end
function blasstrides(A::AbstractStridedView{T,2}) where {T}
# canonialize strides to make compatible with gemm
if size(A, 2) == 1
return sreshape(A, size(A)) # will reset A.strides[2] == A.strides[1]*A.size[1]
else
return A
end
end

# here we will have C.op == :identity && stride(C,1) < stride(C,2)
function _mul!(C::AbstractStridedView{T,2}, A::AbstractStridedView{T,2}, B::AbstractStridedView{T,2}, α, β) where {T<:LinearAlgebra.BlasFloat}
Expand Down Expand Up @@ -267,10 +259,16 @@ function _simplify(size::Dims{N}, strides::Dims{N}) where {N}
end
end

_computereshapestrides(newsize::Tuple{}, oldsize::Tuple{}, strides::Tuple{}) = strides
function _computereshapestrides(newsize::Tuple{}, oldsize::Dims{N}, strides::Dims{N}) where {N}
all(isequal(1), oldsize) || throw(DimensionMismatch())
return ()
end

function _computereshapestrides(newsize::Dims, oldsize::Tuple{}, strides::Tuple{})
all(isequal(1), newsize) || throw(DimensionMismatch())
return newsize
end
function _computereshapestrides(newsize::Dims, oldsize::Dims{N}, strides::Dims{N}) where {N}
d,r = divrem(oldsize[1], newsize[1])
if r == 0
Expand Down
9 changes: 9 additions & 0 deletions src/stridedview.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ Base.stride(a::StridedView{<:Any, N}, n::Int) where N =
(n <= N) ? a.strides[n] : a.strides[N]*a.size[N]
offset(a::StridedView) = a.offset

function blasstrides(a::StridedView{<:Any,2})
# canonialize strides to make compatible with gemm
if size(a, 2) == 1 && stride(a, 1) == 1
return StridedView(a.parent, a.size, (1, size(a,1)), a.offset, a.op)
else
return a
end
end

Base.similar(a::StridedView, ::Type{T}, dims::NTuple{N,Int}) where {N,T} =
StridedView(similar(a.parent, T, dims))
Base.copy(a::StridedView) = copyto!(similar(a), a)
Expand Down
9 changes: 9 additions & 0 deletions src/unsafestridedview.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ Base.stride(a::UnsafeStridedView{<:Any, N}, n::Int) where {N} =
(n <= N) ? a.strides[n] : a.strides[N]*a.size[N]
offset(a::UnsafeStridedView) = a.offset

function blasstrides(a::UnsafeStridedView{<:Any,2})
# canonialize strides to make compatible with gemm
if size(a, 2) == 1 && stride(a, 1) == 1
return UnsafeStridedView(a.ptr, a.size, (1, size(a,1)), a.offset, a.op)
else
return a
end
end

Base.similar(a::UnsafeStridedView, ::Type{T}, dims::NTuple{N,Int}) where {N,T} =
StridedView(Array{T}(undef, dims))
Base.copy(a::UnsafeStridedView) = copyto!(similar(a), a)
Expand Down

0 comments on commit 0fa5348

Please sign in to comment.