Skip to content

Commit

Permalink
Fix more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mtfishman committed Oct 23, 2023
1 parent db828c7 commit 4d633aa
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 10 deletions.
1 change: 1 addition & 0 deletions NDTensors/src/NDTensors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ include("dims.jl")
include("tensor/set_types.jl")
include("tensor/similar.jl")
include("tensor/permutedims.jl")
include("tensor/linearalgebra.jl")
include("adapt.jl")
include("tensoralgebra/generic_tensor_operations.jl")
include("tensoralgebra/contraction_logic.jl")
Expand Down
3 changes: 1 addition & 2 deletions NDTensors/src/dense/linearalgebra/decompositions.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

Strided.StridedView(T::DenseTensor) = StridedView(convert(Array, T))

function drop_singletons(::Order{N}, labels, dims) where {N}
Expand Down Expand Up @@ -40,7 +39,7 @@ end

# qr decomposition of an order-n tensor according to
# positions Lpos and Rpos
function LinearAlgebra.qr(
function qr(
T::DenseTensor{<:Number,N,IndsT}, Lpos::NTuple{NL,Int}, Rpos::NTuple{NR,Int}; kwargs...
) where {N,IndsT,NL,NR}
M = permute_reshape(T, Lpos, Rpos)
Expand Down
15 changes: 11 additions & 4 deletions NDTensors/src/exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@ export
insertblock!!,
setindex,
setindex!!,

# blocksparse/blockdims.jl
BlockDims,
blockdim,
blockdims,
nblocks,
blockindex,

# blocksparse/blocksparse.jl
# Types
Block,
Expand Down Expand Up @@ -49,7 +47,6 @@ export
matrix,
outer,
permutedims!!,
ql,
read,
vector,
write,
Expand Down Expand Up @@ -78,5 +75,15 @@ export
ind,
store,

# truncate.jl
truncate!,

# linearalgebra.jl
qr
eigs,
entropy,
polar,
ql,
random_orthog,
random_unitary,
Spectrum,
truncerror
5 changes: 3 additions & 2 deletions NDTensors/src/linearalgebra/linearalgebra.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
export eigs, entropy, polar, random_orthog, random_unitary, Spectrum, svd, truncerror

#
# Linear Algebra of order 2 NDTensors
#
Expand Down Expand Up @@ -380,10 +378,13 @@ function eigen(
return D, V, spec
end

# NDTensors.qr
function qr(T::DenseTensor{<:Any,2}; positive=false, kwargs...)
qxf = positive ? qr_positive : qr
return qx(qxf, T; kwargs...)
end

# NDTensors.ql
function ql(T::DenseTensor{<:Any,2}; positive=false, kwargs...)
qxf = positive ? ql_positive : ql
return qx(qxf, T; kwargs...)
Expand Down
7 changes: 7 additions & 0 deletions NDTensors/src/tensor/linearalgebra.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function LinearAlgebra.qr(T::Tensor; kwargs...)
return qr(T; kwargs...)
end

function LinearAlgebra.svd(T::Tensor; kwargs...)
return svd(T; kwargs...)
end
2 changes: 0 additions & 2 deletions NDTensors/src/truncate.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
export truncate!

function truncate!!(P::AbstractArray; kwargs...)
return truncate!!(leaf_parenttype(P), P; kwargs...)
end
Expand Down
1 change: 1 addition & 0 deletions NDTensors/test/linearalgebra.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using NDTensors
using LinearAlgebra
using Test

if "cuda" in ARGS || "all" in ARGS
using CUDA
end
Expand Down

0 comments on commit 4d633aa

Please sign in to comment.