Skip to content

Example from readme does not work #2

Open

Description

@CWillberg

I get an error if I try

Activity

  1. CWillberg commented on Apr 30, 2026

    @CWillberg
    Author

    using MPI
    MPI.Init()

    using HPCSparseArrays
    using SparseArrays

    Create a sparse matrix (must be identical on all ranks)

    A_global = sprand(1000, 1000, 0.01)
    A = HPCSparseMatrix{Float64}(A_global)

    Create a vector

    x_global = rand(1000)
    x = HPCVector(x_global)

    Matrix-vector multiplication

    y = A * x

    Matrix-matrix multiplication

    B_global = sprand(1000, 500, 0.01)
    B = HPCSparseMatrix{Float64}(B_global)
    C = A * B

    Transpose operations

    At = transpose(A)
    D = At * B # Materializes transpose as needed

    Solve linear systems

    using LinearAlgebra
    A_sym = A + transpose(A) + 10I # Make symmetric positive definite
    A_sym_dist = HPCSparseMatrix{Float64}(A_sym)
    F = ldlt(A_sym_dist) # LDLT factorization
    x_sol = solve(F, y) # Solve A_sym * x_sol = y

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions