From b9bb384df1177ef2e3502eb63859fa1acdb18b4c Mon Sep 17 00:00:00 2001 From: Maxence Gollier Date: Wed, 24 Apr 2024 13:58:01 -0400 Subject: [PATCH 1/5] Add COO format constructor --- Project.toml | 1 + src/QRMumps.jl | 4 ++-- src/wrapper/qr_mumps_api.jl | 10 ++++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Project.toml b/Project.toml index f8526e7..adc51ad 100644 --- a/Project.toml +++ b/Project.toml @@ -9,6 +9,7 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" OpenBLAS32_jll = "656ef2d0-ae68-5445-9ca0-591084a874a2" Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" +SparseMatricesCOO = "fa32481b-f100-4b48-8dc8-c62f61b13870" qr_mumps_jll = "e37b5aa0-c611-5f0f-83fb-aee446c0b77e" [compat] diff --git a/src/QRMumps.jl b/src/QRMumps.jl index 36d8a73..3210240 100644 --- a/src/QRMumps.jl +++ b/src/QRMumps.jl @@ -1,6 +1,6 @@ module QRMumps -using Libdl, SparseArrays, LinearAlgebra +using Libdl, SparseArrays, LinearAlgebra, SparseMatricesCOO import Base: \ import LinearAlgebra: mul! @@ -88,7 +88,7 @@ This routine initializes a **qrm_spmat** type data structure from a **sparseMatr In the first form, * `spmat`: the **qrm_spmat** sparse matrix to be initialized. -* `A` : a Julia sparse matrix stored in **SparseMatrixCSC** format. +* `A` : a Julia sparse matrix stored in either **SparseMatrixCSC** or **SparseMatrixCOO** format (see SparseMatricesCOO.jl for the second case). * `sym` : a boolean to specify if the matrix is symmetric / hermitian (true) or unsymmetric (false). In the second form, the matrix `A` is specified using diff --git a/src/wrapper/qr_mumps_api.jl b/src/wrapper/qr_mumps_api.jl index 946055b..e929cc5 100644 --- a/src/wrapper/qr_mumps_api.jl +++ b/src/wrapper/qr_mumps_api.jl @@ -90,6 +90,16 @@ for (fname, elty) in ((:sqrm_spmat_init_c, :Float32 ), return spmat end + function qrm_spmat_init(A :: SparseMatrixCOO{$elty,I}; sym :: Bool=false) where I <: Integer + spmat = qrm_spmat{$elty}() + qrm_spmat_init!(spmat, A; sym = sym) + return spmat + end + + function qrm_spmat_init!(spmat :: qrm_spmat{$elty}, A :: SparseMatrixCOO{$elty,I}; sym :: Bool=false) where I <: Integer + qrm_spmat_init!(spmat, A.m, A.n, A.rows, A.cols, A.vals; sym = sym) + end + function qrm_spmat_init!(spmat :: qrm_spmat{$elty}, A :: SparseMatrixCSC{$elty,I}; sym :: Bool=false) where I <: Integer qrm_spmat_init!(spmat, size(A)..., findnz(A)...; sym = sym) end From c796fdd2fa6e9e79aebc546d513e6a039154ee30 Mon Sep 17 00:00:00 2001 From: Maxence Gollier Date: Thu, 25 Apr 2024 16:57:43 -0400 Subject: [PATCH 2/5] Add SparseMatricesCOO Extension --- Project.toml | 8 +++++++- ext/QRMumpsSparseMatricesCOOExt.jl | 8 ++++++++ ext/SparseMatricesCOO/constructor.jl | 9 +++++++++ src/QRMumps.jl | 2 +- src/wrapper/qr_mumps_api.jl | 10 ---------- 5 files changed, 25 insertions(+), 12 deletions(-) create mode 100644 ext/QRMumpsSparseMatricesCOOExt.jl create mode 100644 ext/SparseMatricesCOO/constructor.jl diff --git a/Project.toml b/Project.toml index adc51ad..9d359ca 100644 --- a/Project.toml +++ b/Project.toml @@ -9,9 +9,14 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" OpenBLAS32_jll = "656ef2d0-ae68-5445-9ca0-591084a874a2" Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" -SparseMatricesCOO = "fa32481b-f100-4b48-8dc8-c62f61b13870" qr_mumps_jll = "e37b5aa0-c611-5f0f-83fb-aee446c0b77e" +[weakdeps] +SparseMatricesCOO = "fa32481b-f100-4b48-8dc8-c62f61b13870" + +[extensions] +QRMumpsSparseMatricesCOOExt = "SparseMatricesCOO" + [compat] Libdl = "1.6" LinearAlgebra = "1.6" @@ -19,6 +24,7 @@ OpenBLAS32_jll = "0.3.10" Printf = "1.6" Random = "1.6" SparseArrays = "1.6" +SparseMatricesCOO = "1.6" Test = "1.6" julia = "1.6" qr_mumps_jll = "3.0.4" diff --git a/ext/QRMumpsSparseMatricesCOOExt.jl b/ext/QRMumpsSparseMatricesCOOExt.jl new file mode 100644 index 0000000..eb6dd5a --- /dev/null +++ b/ext/QRMumpsSparseMatricesCOOExt.jl @@ -0,0 +1,8 @@ +module QRMumpsSparseMatricesCOOExt + +using SparseMatricesCOO +using QRMumps + +include("SparseMatricesCOO/constructor.jl") + +end \ No newline at end of file diff --git a/ext/SparseMatricesCOO/constructor.jl b/ext/SparseMatricesCOO/constructor.jl new file mode 100644 index 0000000..cb868b6 --- /dev/null +++ b/ext/SparseMatricesCOO/constructor.jl @@ -0,0 +1,9 @@ +function QRMumps.qrm_spmat_init(A :: SparseMatrixCOO{T,I}; sym :: Bool=false) where {T, I <: Integer} + spmat = qrm_spmat{T}() + qrm_spmat_init!(spmat, A; sym = sym) + return spmat +end + +function QRMumps.qrm_spmat_init!(spmat :: qrm_spmat{T}, A :: SparseMatrixCOO{T,I}; sym :: Bool=false) where {T, I <: Integer} + qrm_spmat_init!(spmat, A.m, A.n, A.rows, A.cols, A.vals; sym = sym) +end \ No newline at end of file diff --git a/src/QRMumps.jl b/src/QRMumps.jl index 3210240..46b24a0 100644 --- a/src/QRMumps.jl +++ b/src/QRMumps.jl @@ -1,6 +1,6 @@ module QRMumps -using Libdl, SparseArrays, LinearAlgebra, SparseMatricesCOO +using Libdl, SparseArrays, LinearAlgebra import Base: \ import LinearAlgebra: mul! diff --git a/src/wrapper/qr_mumps_api.jl b/src/wrapper/qr_mumps_api.jl index e929cc5..3f0731c 100644 --- a/src/wrapper/qr_mumps_api.jl +++ b/src/wrapper/qr_mumps_api.jl @@ -89,16 +89,6 @@ for (fname, elty) in ((:sqrm_spmat_init_c, :Float32 ), qrm_spmat_init!(spmat, m, n, irn, jcn, val; sym = sym) return spmat end - - function qrm_spmat_init(A :: SparseMatrixCOO{$elty,I}; sym :: Bool=false) where I <: Integer - spmat = qrm_spmat{$elty}() - qrm_spmat_init!(spmat, A; sym = sym) - return spmat - end - - function qrm_spmat_init!(spmat :: qrm_spmat{$elty}, A :: SparseMatrixCOO{$elty,I}; sym :: Bool=false) where I <: Integer - qrm_spmat_init!(spmat, A.m, A.n, A.rows, A.cols, A.vals; sym = sym) - end function qrm_spmat_init!(spmat :: qrm_spmat{$elty}, A :: SparseMatrixCSC{$elty,I}; sym :: Bool=false) where I <: Integer qrm_spmat_init!(spmat, size(A)..., findnz(A)...; sym = sym) From ffac52fd20f3e48aa5a023e70bb9c09b6e32ce84 Mon Sep 17 00:00:00 2001 From: Alexis Montoison <35051714+amontoison@users.noreply.github.com> Date: Thu, 25 Apr 2024 17:34:10 -0400 Subject: [PATCH 3/5] Update Project.toml --- Project.toml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Project.toml b/Project.toml index 9d359ca..cc78252 100644 --- a/Project.toml +++ b/Project.toml @@ -18,16 +18,16 @@ SparseMatricesCOO = "fa32481b-f100-4b48-8dc8-c62f61b13870" QRMumpsSparseMatricesCOOExt = "SparseMatricesCOO" [compat] -Libdl = "1.6" -LinearAlgebra = "1.6" +Libdl = "1.10" +LinearAlgebra = "1.10" OpenBLAS32_jll = "0.3.10" -Printf = "1.6" -Random = "1.6" -SparseArrays = "1.6" -SparseMatricesCOO = "1.6" -Test = "1.6" -julia = "1.6" -qr_mumps_jll = "3.0.4" +Printf = "1.10" +Random = "1.10" +SparseArrays = "1.10" +SparseMatricesCOO = "1.10" +Test = "1.10" +julia = "1.10" +qr_mumps_jll = "3.1.0" [extras] Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" From 37a93a73be7ea83a6a7421c44d52978fab82ff91 Mon Sep 17 00:00:00 2001 From: Alexis Montoison <35051714+amontoison@users.noreply.github.com> Date: Thu, 25 Apr 2024 17:34:29 -0400 Subject: [PATCH 4/5] Update .cirrus.yml --- .cirrus.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.cirrus.yml b/.cirrus.yml index 38facc4..2a62270 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -5,7 +5,7 @@ task: image_family: freebsd-13-2 env: matrix: - - JULIA_VERSION: 1.6 + - JULIA_VERSION: 1.10 - JULIA_VERSION: 1 - name: MacOS M1 macos_instance: From 478a69971e3e36d89247d6e2307b08e2b0754e71 Mon Sep 17 00:00:00 2001 From: Alexis Montoison <35051714+amontoison@users.noreply.github.com> Date: Thu, 25 Apr 2024 17:34:51 -0400 Subject: [PATCH 5/5] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 028680e..b3d4dad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - version: ['1.6', '1'] + version: ['1.10', '1'] os: [ubuntu-latest, macOS-latest, windows-latest] arch: [x64] allow_failure: [false]