Skip to content

[BUG]: UndefVarError: permuterows! not defined on Julia ≤ 1.10 #44

@Ady0333

Description

@Ady0333

Problem

The functions _forward_cholesky and _backward_cholesky call Base.permuterows! and Base.invpermuterows!, which do not exist in Julia 1.9 or 1.10.

Broken code:

function _forward_cholesky(A::AbstractMatrix, L::AbstractSparseMatrix, p::AbstractVector)
  Base.permuterows!(A, p)        # ❌ doesn't exist in Julia ≤ 1.10
  Ã = L' * A
  Base.invpermuterows!(A, p)     # ❌ doesn't exist in Julia ≤ 1.10
  return Ã
end

function _backward_cholesky::AbstractMatrix, L::AbstractSparseMatrix, p::AbstractVector)
  A = L' \ Ã
  Base.invpermuterows!(A, p)     # ❌ doesn't exist in Julia ≤ 1.10
  return A
end

Verification:

julia> VERSION
v"1.10.5"

julia> isdefined(Base, :permuterows!)
false

julia> isdefined(Base, :invpermuterows!)
false

These functions were introduced in Julia 1.11+, but Project.toml declares julia = "1.9" as the minimum supported version.


Impact

Who is affected: Everyone running GridapROMs on Julia 1.9 or 1.10 (including the LTS 1.10 version) who uses energy-norm POD.

What breaks:

  • Every ROM workflow using energy-norm weighted POD crashes with UndefVarError: permuterows! not defined
  • The call chain: reduced_basis(PODReduction, feop, s)tpod(A, X)_cholesky_decomp(X)_forward_cholesky → crash
  • RBSteady tests: Poisson, Stokes, Navier-Stokes all fail
  • RBTransient workflows using energy norms also affected

Why this is critical: Energy-norm POD is the default, standard ROM approach in FEM-based reduced-order modeling. This breaks the primary workflow of the package for anyone not on Julia 1.11+.


Proposed Fix

Replace with Julia 1.9+ compatible operations using array indexing:

function _forward_cholesky(A::AbstractMatrix, L::AbstractSparseMatrix, p::AbstractVector)
  Ã = L' * A[p, :]
  return Ã
end

function _backward_cholesky::AbstractMatrix, L::AbstractSparseMatrix, p::AbstractVector)
  Ap = L' \ Ã
  A = similar(Ap)
  A[p, :] = Ap
  return A
end

This is numerically equivalent to the original intent:

  • A[p, :] selects rows in permutation order (equivalent to permuterows! + use)
  • A[p, :] = Ap undoes the permutation (equivalent to invpermuterows!)
  • Uses only Base operations available since Julia 1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions