diff --git a/src/arrays/quarray.jl b/src/arrays/quarray.jl index 78b40f6..8d2b459 100644 --- a/src/arrays/quarray.jl +++ b/src/arrays/quarray.jl @@ -47,20 +47,22 @@ abstract AbstractQuArray{B<:AbstractBasis,T,N} <: AbstractArray{T,N} ############################ statevec(i::Int, fb::FiniteBasis) = QuArray(single_coeff(i, length(fb)), fb) statevec(i::Int, lens::Int...=i) = statevec(i, FiniteBasis(lens)) + + zeros(qa::QuArray) = QuArray(zeros(qa.coeffs), qa.bases) + eye(qa::QuArray) = QuArray(eye(qa.coeffs), qa.bases) ###################### # Property Functions # ###################### bases(qa::QuArray) = qa.bases coeffs(qa::QuArray) = qa.coeffs - size(qa::QuArray, i...) = size(qa.coeffs, i...) ######################## # Array-like functions # ######################## similar{B,T}(qa::QuArray{B,T}, element_type=T) = QuArray(similar(qa.coeffs, T), qa.bases) - # is there a way to properly define the below for + # Is there a way to properly define the below for # any arbitrary basis? Obviously doesn't make sense # for B<:AbstractInfiniteBasis, and I'm reluctant to # enforce that every B<:AbstractFiniteBasis will have a @@ -81,13 +83,9 @@ abstract AbstractQuArray{B<:AbstractBasis,T,N} <: AbstractArray{T,N} transpose(qa::QuVector) = QuArray(transpose(qa.coeffs), qa.bases) transpose(qa::QuMatrix) = QuArray(transpose(qa.coeffs), reverse(qa.bases)) - zeros(qa::QuArray) = QuArray(zeros(qa.coeffs), qa.bases) - eye(qa::QuArray) = QuArray(eye(qa.coeffs), qa.bases) - ###################### # Printing Functions # ###################### - function summary{B,T,N,A}(qa::QuArray{B,T,N,A}) return "$(sizenotation(size(qa))) QuArray\n" * "...bases: $B,\n" * diff --git a/src/bases/finitebasis.jl b/src/bases/finitebasis.jl index 7ed3b9f..bbd0a74 100644 --- a/src/bases/finitebasis.jl +++ b/src/bases/finitebasis.jl @@ -1,4 +1,7 @@ -import Base: length, +import Base: convert, + repr, + show, + length, size ###############