Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added bounds checking to triu/tril. #11090

Merged
merged 1 commit into from
May 2, 2015
Merged

Conversation

kshyatt
Copy link
Contributor

@kshyatt kshyatt commented May 1, 2015

Re JuliaLang/LinearAlgebra.jl#161, added bounds checking for triu! and tril!. Added tests as well. There was one test in test/bitarray.jl that was asking for out-of-bounds sub/superdiagonals which I modified as well.

@@ -66,6 +66,9 @@ vecnorm2{T<:BlasFloat}(x::Union(Array{T},StridedVector{T})) =

function triu!(M::AbstractMatrix, k::Integer)
m, n = size(M)
if((k > 0 && k > n) || (k < 0 && -k > m))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the outer parentheses are not necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed! Thanks for catching that. I'll fix and update the PR.

@tkelman
Copy link
Contributor

tkelman commented May 1, 2015

+1

tkelman added a commit that referenced this pull request May 2, 2015
Added bounds checking to triu/tril.
@tkelman tkelman merged commit cfb49fa into JuliaLang:master May 2, 2015
@kshyatt kshyatt deleted the triulbounds branch May 2, 2015 05:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants