Skip to content

Commit 5440fbe

Browse files
tgymnichchristiangnrd
authored andcommitted
add test
1 parent 0f0223d commit 5440fbe

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

test/mps/linalg.jl

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,41 @@ using Metal: storagemode
211211
@test storagemode(lua.factors) == storagemode(lua.ipiv) == storagemode(A)
212212
end
213213

214+
@testset "solves" begin
215+
b = MtlVector(rand(Float32, 1024))
216+
B = MtlMatrix(rand(Float32, 1024, 1024))
217+
218+
A = MtlMatrix(rand(Float32, 1024, 512))
219+
x = lu(A) \ b
220+
@test A * x b
221+
X = lu(A) \ B
222+
@test A * X B
223+
224+
A = UpperTriangular(MtlMatrix(rand(Float32, 1024, 1024)))
225+
x = A \ b
226+
@test A * x b
227+
X = A \ B
228+
@test A * X B
229+
230+
A = UnitUpperTriangular(MtlMatrix(rand(Float32, 1024, 1024)))
231+
x = A \ b
232+
@test A * x b
233+
X = A \ B
234+
@test A * X B
235+
236+
A = LowerTriangular(MtlMatrix(rand(Float32, 1024, 1024)))
237+
x = A \ b
238+
@test A * x b
239+
X = A \ B
240+
@test A * X B
241+
242+
A = UnitLowerTriangular(MtlMatrix(rand(Float32, 1024, 1024)))
243+
x = A \ b
244+
@test A * x b
245+
X = A \ B
246+
@test A * X B
247+
end
248+
214249
using .MPS: MPSMatrixSoftMax, MPSMatrixLogSoftMax
215250
@testset "MPSMatrixSoftMax" begin
216251
cols = rand(Int)

0 commit comments

Comments
 (0)