rotl90(A)
rotl90(A)
Rotate matrix A
left 90 degrees.
Examples
-
Rotate a matrix left 90 degrees:
julia> A = [1 2 3; 4 5 6; 7 8 9]; julia> rotl90(A) 3×3 Array{Int64,2}: 3 6 9 2 5 8 1 4 7
This example rotates the matrix
A
left 90 degrees. -
Rotate a matrix left 90 degrees multiple times:
julia> B = [11 12; 21 22]; julia> rotl90(B, 2) 2×2 Array{Int64,2}: 22 21 12 11
It rotates the matrix
B
left 90 degrees twice. - Handle zero rotations (equivalent to copy):
julia> C = [1 2 3; 4 5 6; 7 8 9]; julia> rotl90(C, 0) 3×3 Array{Int64,2}: 1 2 3 4 5 6 7 8 9
When
k
is zero, the function returns a copy of the original matrix.
Common mistake example:
julia> D = [4 5; 6 7];
julia> rotl90(D, 5)
ERROR: DomainError: The rotation count must be a non-negative integer less than 4.
In this example, the rotation count k
is greater than or equal to 4, which is not allowed. The valid range for k
is 0 to 3. Make sure to provide a valid rotation count within this range to avoid errors.
See Also
Ac_ldiv_B, Ac_ldiv_Bc, Ac_mul_B, Ac_mul_Bc, Ac_rdiv_B, Ac_rdiv_Bc, At_ldiv_B, At_ldiv_Bt, At_mul_B, At_mul_Bt, At_rdiv_B, At_rdiv_Bt, A_ldiv_Bc, A_ldiv_Bt, A_mul_B!, A_mul_Bc, A_mul_Bt, A_rdiv_Bc, A_rdiv_Bt, Bidiagonal, cond, conv2, det, diag, diagind, diagm, diff, eig, eigvals, eigvecs, expm, eye, full, inv, isdiag, ishermitian, isposdef, isposdef!, issym, istril, istriu, logabsdet, logdet, lyap, norm, qrfact, rank, repmat, rot180, rotl90, rotr90, sortrows, sqrtm, SymTridiagonal, trace, Tridiagonal, tril, tril!, triu, triu!, writedlm,User Contributed Notes
Add a Note
The format of note supported is markdown, use triple backtick to start and end a code block.