@@ -218,6 +218,24 @@ using StaticArrays, Test, LinearAlgebra
218218 end
219219end
220220
221+ @testset " permutedims" begin
222+ # vector -> one-row matrix
223+ @test @inferred (permutedims (SVector (1 ,2 ,3 ))) === SMatrix {1,3} (1 ,2 ,3 )
224+ @test @inferred (permutedims (MVector (1 ,2 ,3 ))) isa MMatrix{1 ,3 }
225+ @test @inferred (permutedims (MVector (1 ,2 ,3 ))) == [1 2 3 ]
226+ @test @inferred (permutedims (SizedVector {3} ([1 ,2 ,3 ]))) isa SizedMatrix{1 ,3 }
227+ @test @inferred (permutedims (SizedVector {3} ([1 ,2 ,3 ]))) == [1 2 3 ]
228+
229+ # matrix
230+ @test @inferred (permutedims (SMatrix {2,2} (1 ,2 ,3 ,4 ))) === SMatrix {2,2} (1 ,3 ,2 ,4 )
231+ A = rand (2 ,3 )
232+ @test @inferred (permutedims (SMatrix {2,3} (A))) === SMatrix {3,2} (A' )
233+ @test @inferred (permutedims (MMatrix {2,3} (A))) isa MMatrix{3 ,2 }
234+ @test @inferred (permutedims (MMatrix {2,3} (A))) == A'
235+ @test @inferred (permutedims (SizedMatrix {2,3} (A))) isa SizedMatrix{3 ,2 }
236+ @test @inferred (permutedims (SizedMatrix {2,3} (A))) == A'
237+ end
238+
221239@testset " vcat() and hcat()" begin
222240 @test @inferred (vcat (SVector (1 ,2 ,3 ))) === SVector (1 ,2 ,3 )
223241 @test @inferred (hcat (SVector (1 ,2 ,3 ))) === SMatrix {3,1} (1 ,2 ,3 )
0 commit comments