Skip to content

Commit

Permalink
Merge pull request #17075 from Sacha0/saferctrans
Browse files Browse the repository at this point in the history
Naive fix for #13171
  • Loading branch information
andreasnoack authored Jul 10, 2016
2 parents 2065920 + dd55ba5 commit 4a84310
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion base/operators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ fldmod1{T<:Real}(x::T, y::T) = (fld1(x,y), mod1(x,y))
fldmod1{T<:Integer}(x::T, y::T) = (fld1(x,y), mod1(x,y))

# transpose
transpose(x) = x
transpose(x) = throw(ArgumentError("transpose not implemented for $(typeof(x)). Consider permutedims."))
ctranspose(x) = conj(transpose(x))
conj(x) = x

Expand Down
2 changes: 1 addition & 1 deletion test/datafmt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ let i18n_data = ["Origin (English)", "Name (English)", "Origin (Native)", "Name
"Yugoslavia (Cyrillic)", "Djordje Balasevic", "Југославија", "Ђорђе Балашевић",
"Yugoslavia (Latin)", "Djordje Balasevic", "Jugoslavija", "Đorđe Balašević"]

i18n_arr = transpose(reshape(i18n_data, 4, Int(floor(length(i18n_data)/4))))
i18n_arr = permutedims(reshape(i18n_data, 4, Int(floor(length(i18n_data)/4))), [2, 1])
i18n_buff = PipeBuffer()
writedlm(i18n_buff, i18n_arr, ',')
@test i18n_arr == readcsv(i18n_buff)
Expand Down
3 changes: 2 additions & 1 deletion test/linalg/matmul.jl
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,9 @@ end
immutable RootInt
i::Int
end
import Base: *, promote_op
import Base: *, transpose, promote_op
(*)(x::RootInt, y::RootInt) = x.i*y.i
transpose(x::RootInt) = x
promote_op(::typeof(*), ::Type{RootInt}, ::Type{RootInt}) = Int

a = [RootInt(3)]
Expand Down
2 changes: 1 addition & 1 deletion test/operators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ p = 1=>:foo
@test (|)(2) == 2
@test ($)(2) == 2

@test ctranspose('a') == 'a'
# @test ctranspose('a') == 'a' # (c)transpose of Chars no longer supported

@test_throws ArgumentError Base.scalarmin(['a','b'],['c','d'])
@test_throws ArgumentError Base.scalarmin('a',['c','d'])
Expand Down
2 changes: 1 addition & 1 deletion test/strings/basic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ foobaz(ch) = reinterpret(Char, typemax(UInt32))

@test "a".*["b","c"] == ["ab","ac"]
@test ["b","c"].*"a" == ["ba","ca"]
@test ["a","b"].*["c","d"]' == ["ac" "ad"; "bc" "bd"]
@test ["a","b"].*["c" "d"] == ["ac" "ad"; "bc" "bd"]

# Make sure NULL pointers are handled consistently by String
@test_throws ArgumentError unsafe_string(Ptr{UInt8}(0))
Expand Down

0 comments on commit 4a84310

Please sign in to comment.