Skip to content

Commit c91feb0

Browse files
committed
Remove transpose(x) = x fallback, instead error'ing. Patch up a few missing transpose methods and correct a test that failed for lack of a transpose method.
1 parent d9fecbf commit c91feb0

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

base/char.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ in(x::Char, y::Char) = x == y
3232
==(x::Char, y::Char) = UInt32(x) == UInt32(y)
3333
isless(x::Char, y::Char) = UInt32(x) < UInt32(y)
3434

35+
transpose(c::Char) = c
36+
3537
const hashchar_seed = 0xd4d64234
3638
hash(x::Char, h::UInt) = hash_uint64(((UInt64(x)+hashchar_seed)<<32) $ UInt64(h))
3739

base/operators.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ fldmod1{T<:Real}(x::T, y::T) = (fld1(x,y), mod1(x,y))
293293
fldmod1{T<:Integer}(x::T, y::T) = (fld1(x,y), mod1(x,y))
294294

295295
# transpose
296-
transpose(x) = x
296+
transpose(x) = error("transpose not implemented for $(typeof(x)).")
297297
ctranspose(x) = conj(transpose(x))
298298
conj(x) = x
299299

base/strings/basic.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ function length(s::AbstractString)
101101
end
102102
end
103103

104+
transpose(s::AbstractString) = s
105+
104106
## string comparison functions ##
105107

106108
function cmp(a::AbstractString, b::AbstractString)

test/linalg/matmul.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,9 @@ end
320320
immutable RootInt
321321
i::Int
322322
end
323-
import Base: *, promote_op
323+
import Base: *, transpose, promote_op
324324
(*)(x::RootInt, y::RootInt) = x.i*y.i
325+
transpose(x::RootInt) = x
325326
promote_op(::typeof(*), ::Type{RootInt}, ::Type{RootInt}) = Int
326327

327328
a = [RootInt(3)]

0 commit comments

Comments
 (0)