diff --git a/base/char.jl b/base/char.jl index 52aa1492e2f862..e28217dc8c10ad 100644 --- a/base/char.jl +++ b/base/char.jl @@ -32,6 +32,8 @@ in(x::Char, y::Char) = x == y ==(x::Char, y::Char) = UInt32(x) == UInt32(y) isless(x::Char, y::Char) = UInt32(x) < UInt32(y) +transpose(c::Char) = c + const hashchar_seed = 0xd4d64234 hash(x::Char, h::UInt) = hash_uint64(((UInt64(x)+hashchar_seed)<<32) $ UInt64(h)) diff --git a/base/operators.jl b/base/operators.jl index 6570a14e3e6127..5b8ec3d5490718 100644 --- a/base/operators.jl +++ b/base/operators.jl @@ -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) = error("transpose not implemented for $(typeof(x)).") ctranspose(x) = conj(transpose(x)) conj(x) = x diff --git a/base/strings/basic.jl b/base/strings/basic.jl index 7308123929a073..3beeae923cdc13 100644 --- a/base/strings/basic.jl +++ b/base/strings/basic.jl @@ -101,6 +101,8 @@ function length(s::AbstractString) end end +transpose(s::AbstractString) = s + ## string comparison functions ## function cmp(a::AbstractString, b::AbstractString) diff --git a/test/linalg/matmul.jl b/test/linalg/matmul.jl index 53d1368506e956..769ce7f0cb1c25 100644 --- a/test/linalg/matmul.jl +++ b/test/linalg/matmul.jl @@ -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)]