Skip to content

Commit f6774a4

Browse files
committed
Format
1 parent fec76cb commit f6774a4

File tree

4 files changed

+20
-20
lines changed

4 files changed

+20
-20
lines changed

lib/mkl/wrappers_sparse.jl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
function sparse_release_matrix_handle(A::oneAbstractSparseMatrix)
22
queue = global_queue(context(A.nzVal), device(A.nzVal))
33
m, n = size(A)
4-
if m != 0 && n != 0
4+
return if m != 0 && n != 0
55
handle_ptr = Ref{matrix_handle_t}(A.handle)
66
onemklXsparse_release_matrix_handle(sycl_queue(queue), handle_ptr)
77
end
@@ -18,9 +18,9 @@ for (fname, elty, intty) in ((:onemklSsparse_set_csr_data , :Float32 , :Int3
1818
@eval begin
1919

2020
function oneSparseMatrixCSR(
21-
rowPtr::oneVector{$intty}, colVal::oneVector{$intty},
22-
nzVal::oneVector{$elty}, dims::NTuple{2, Int}
23-
)
21+
rowPtr::oneVector{$intty}, colVal::oneVector{$intty},
22+
nzVal::oneVector{$elty}, dims::NTuple{2, Int}
23+
)
2424
handle_ptr = Ref{matrix_handle_t}()
2525
onemklXsparse_init_matrix_handle(handle_ptr)
2626
m, n = dims
@@ -30,15 +30,15 @@ for (fname, elty, intty) in ((:onemklSsparse_set_csr_data , :Float32 , :Int3
3030
if m != 0 && n != 0
3131
$fname(sycl_queue(queue), handle_ptr[], m, n, 'O', rowPtr, colVal, nzVal)
3232
end
33-
dA = oneSparseMatrixCSR{$elty,$intty}(handle_ptr[], rowPtr, colVal, nzVal, (m,n), nnzA)
33+
dA = oneSparseMatrixCSR{$elty, $intty}(handle_ptr[], rowPtr, colVal, nzVal, (m, n), nnzA)
3434
finalizer(sparse_release_matrix_handle, dA)
3535
return dA
3636
end
3737

3838
function oneSparseMatrixCSC(
39-
colPtr::oneVector{$intty}, rowVal::oneVector{$intty},
40-
nzVal::oneVector{$elty}, dims::NTuple{2, Int}
41-
)
39+
colPtr::oneVector{$intty}, rowVal::oneVector{$intty},
40+
nzVal::oneVector{$elty}, dims::NTuple{2, Int}
41+
)
4242
queue = global_queue(context(nzVal), device(nzVal))
4343
handle_ptr = Ref{matrix_handle_t}()
4444
onemklXsparse_init_matrix_handle(handle_ptr)
@@ -48,7 +48,7 @@ for (fname, elty, intty) in ((:onemklSsparse_set_csr_data , :Float32 , :Int3
4848
if m != 0 && n != 0
4949
$fname(sycl_queue(queue), handle_ptr[], n, m, 'O', colPtr, rowVal, nzVal) # CSC of A is CSR of Aᵀ
5050
end
51-
dA = oneSparseMatrixCSC{$elty,$intty}(handle_ptr[], colPtr, rowVal, nzVal, dims, nnzA)
51+
dA = oneSparseMatrixCSC{$elty, $intty}(handle_ptr[], colPtr, rowVal, nzVal, dims, nnzA)
5252
finalizer(sparse_release_matrix_handle, dA)
5353
return dA
5454
end
@@ -59,7 +59,7 @@ for (fname, elty, intty) in ((:onemklSsparse_set_csr_data , :Float32 , :Int3
5959
rowPtr = oneVector{$intty}(At.colptr)
6060
colVal = oneVector{$intty}(At.rowval)
6161
nzVal = oneVector{$elty}(At.nzval)
62-
return oneSparseMatrixCSR(rowPtr, colVal, nzVal, (m,n))
62+
return oneSparseMatrixCSR(rowPtr, colVal, nzVal, (m, n))
6363
end
6464

6565
function SparseMatrixCSC(A::oneSparseMatrixCSR{$elty, $intty})
@@ -74,7 +74,7 @@ for (fname, elty, intty) in ((:onemklSsparse_set_csr_data , :Float32 , :Int3
7474
colPtr = oneVector{$intty}(A.colptr)
7575
rowVal = oneVector{$intty}(A.rowval)
7676
nzVal = oneVector{$elty}(A.nzval)
77-
return oneSparseMatrixCSC(colPtr, rowVal, nzVal, (m,n))
77+
return oneSparseMatrixCSC(colPtr, rowVal, nzVal, (m, n))
7878
end
7979

8080
function SparseMatrixCSC(A::oneSparseMatrixCSC{$elty, $intty})

src/sorting.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
Base.sort!(x::oneArray; kwargs...) = (AK.sort!(x; kwargs...); return x)
22
Base.sortperm!(ix::oneArray, x::oneArray; kwargs...) = (AK.sortperm!(ix, x; kwargs...); return ix)
3-
Base.sortperm(x::oneArray; kwargs...) = sortperm!(oneArray(1:length(x)), x; kwargs...)
3+
Base.sortperm(x::oneArray; kwargs...) = sortperm!(oneArray(1:length(x)), x; kwargs...)

test/onemkl.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,10 +1090,10 @@ end
10901090
B = oneSparseMatrixCSR(A)
10911091
A2 = SparseMatrixCSC(B)
10921092
@test A == A2
1093-
C = oneSparseMatrixCSR(B.rowPtr, B.colVal, B.nzVal, size(B))
1094-
A3 = SparseMatrixCSC(C)
1095-
@test A == A3
1096-
D = oneSparseMatrixCSR(S[], S[], T[], (0,0)) # empty matrix
1093+
C = oneSparseMatrixCSR(B.rowPtr, B.colVal, B.nzVal, size(B))
1094+
A3 = SparseMatrixCSC(C)
1095+
@test A == A3
1096+
D = oneSparseMatrixCSR(S[], S[], T[], (0, 0)) # empty matrix
10971097
end
10981098
end
10991099

@@ -1108,7 +1108,7 @@ end
11081108
C = oneSparseMatrixCSC(A.colptr |> oneVector, A.rowval |> oneVector, A.nzval |> oneVector, size(A))
11091109
A3 = SparseMatrixCSC(C)
11101110
@test A == A3
1111-
D = oneSparseMatrixCSC(S[], S[], T[], (0,0)) # empty matrix
1111+
D = oneSparseMatrixCSC(S[], S[], T[], (0, 0)) # empty matrix
11121112
end
11131113
end
11141114

test/sorting.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ using oneAPI
77
@test Array(data) == [1, 1, 3, 4, 5]
88

99
data_rev = oneArray([3, 1, 4, 1, 5])
10-
sort!(data_rev, rev=true)
10+
sort!(data_rev, rev = true)
1111
@test Array(data_rev) == [5, 4, 3, 1, 1]
1212
data = oneArray([3, 1, 4, 1, 5])
1313
@test Array(sortperm(data)) == sortperm([3, 1, 4, 1, 5])
1414

1515
data_rev = oneArray([3, 1, 4, 1, 5])
16-
@test Array(sortperm(data_rev, rev=true)) == sortperm([3, 1, 4, 1, 5], rev=true)
17-
end
16+
@test Array(sortperm(data_rev, rev = true)) == sortperm([3, 1, 4, 1, 5], rev = true)
17+
end

0 commit comments

Comments
 (0)