Skip to content

Commit

Permalink
Skip 1D tensors from checking anti-diagonal/diagonal condition
Browse files Browse the repository at this point in the history
  • Loading branch information
jofrevalles committed Sep 13, 2023
1 parent 532b91c commit 2ea88c8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Transformations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,10 @@ function find_zero_columns(x; atol = 1e-12)
end

function find_diag_axes(x; atol = 1e-12)
if ndims(parent(x)) == 1 # Skip 1D tensors
return []
end

# find all the potential diagonals
potential_diag_axes = [(i, j) for i in 1:ndims(x) for j in i+1:ndims(x) if size(x, i) == size(x, j)]

Expand All @@ -367,6 +371,10 @@ function find_diag_axes(x; atol = 1e-12)
end

function find_anti_diag_axes(x; atol = 1e-12)
if ndims(parent(x)) == 1 # Skip 1D tensors
return []
end

# Find all the potential anti-diagonals
potential_anti_diag_axes = [(i, j) for i in 1:ndims(x) for j in i+1:ndims(x) if size(x, i) == size(x, j)]

Expand Down

0 comments on commit 2ea88c8

Please sign in to comment.