Skip to content

Commit 7de6d39

Browse files
authored
Define orth and polar (#79)
1 parent 79fc797 commit 7de6d39

File tree

3 files changed

+20
-11
lines changed

3 files changed

+20
-11
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "NamedDimsArrays"
22
uuid = "60cbd0c0-df58-4cb7-918c-6f5607b73fde"
33
authors = ["ITensor developers <[email protected]> and contributors"]
4-
version = "0.6.2"
4+
version = "0.6.3"
55

66
[deps]
77
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
@@ -36,6 +36,6 @@ LinearAlgebra = "1.10"
3636
MapBroadcast = "0.1.6"
3737
Random = "1.10"
3838
SimpleTraits = "0.9.4"
39-
TensorAlgebra = "0.2.9"
39+
TensorAlgebra = "0.2.10"
4040
TypeParameterAccessors = "0.2, 0.3"
4141
julia = "1.10"

src/tensoralgebra.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ using TensorAlgebra:
1212
left_orth,
1313
left_polar,
1414
lq,
15+
orth,
1516
permmortar,
17+
polar,
1618
qr,
1719
right_null,
1820
right_orth,
@@ -162,7 +164,9 @@ function factorize_with(f, a::AbstractNamedDimsArray, dimnames_codomain; kwargs.
162164
return factorize_with(f, a, codomain, domain; kwargs...)
163165
end
164166

165-
for f in [:qr, :lq, :left_polar, :right_polar, :left_orth, :right_orth, :factorize]
167+
for f in [
168+
:factorize, :left_orth, :left_polar, :lq, :orth, :polar, :qr, :right_orth, :right_polar
169+
]
166170
@eval begin
167171
function TensorAlgebra.$f(
168172
a::AbstractNamedDimsArray, dimnames_codomain, dimnames_domain; kwargs...

test/test_tensoralgebra.jl

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
using LinearAlgebra: factorize, lq, norm, qr, svd
2-
using NamedDimsArrays:
3-
dename,
2+
using NamedDimsArrays: dename, nameddimsindices, namedoneto
3+
using TensorAlgebra:
4+
TensorAlgebra,
5+
contract,
6+
fusedims,
47
left_null,
58
left_orth,
69
left_polar,
7-
nameddimsindices,
8-
namedoneto,
10+
orth,
11+
polar,
912
right_null,
1013
right_orth,
11-
right_polar
12-
using TensorAlgebra: TensorAlgebra, contract, fusedims, splitdims
14+
right_polar,
15+
splitdims
1316
using Test: @test, @testset, @test_broken
1417
elts = (Float32, Float64, Complex{Float32}, Complex{Float64})
1518
@testset "TensorAlgebra (eltype=$(elt))" for elt in elts
@@ -59,14 +62,16 @@ elts = (Float32, Float64, Complex{Float32}, Complex{Float64})
5962
a = randn(elt, i, j)
6063
# TODO: Should this be allowed?
6164
# TODO: Add support for specifying new name.
62-
for f in (qr, lq, left_polar, right_polar, left_orth, right_orth, factorize)
65+
for f in
66+
(factorize, left_orth, left_polar, lq, orth, polar, qr, right_orth, right_polar)
6367
x, y = f(a, (i,))
6468
@test x * y a
6569
end
6670

6771
a = randn(elt, i, j, k, l)
6872
# TODO: Add support for specifying new name.
69-
for f in (qr, lq, left_polar, right_polar, left_orth, right_orth, factorize)
73+
for f in
74+
(factorize, left_orth, left_polar, lq, orth, polar, qr, right_orth, right_polar)
7075
x, y = f(a, (i, k), (j, l))
7176
@test x * y a
7277
end

0 commit comments

Comments
 (0)