Mercurial > repos > public > sbplib
comparison reshapeRowMaj.m @ 886:8894e9c49e40 feature/timesteppers
Merge with default for latest changes
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Thu, 15 Nov 2018 16:36:21 -0800 |
parents | 5dad3b754c18 |
children |
comparison
equal
deleted
inserted
replaced
816:b5e5b195da1e | 886:8894e9c49e40 |
---|---|
1 % Reshapes a matrix as if it was stored in row major order. | |
2 function B = reshapeRowMaj(A, m) | |
3 D = length(m); | |
4 | |
5 if D == 1 | |
6 m = [m 1]; | |
7 D = 2; | |
8 end | |
9 | |
10 % Reshape and reverse order of indecies | |
11 B = permute(reshape(permute(A, ndims(A):-1:1), rot90(m,2)), D:-1:1); | |
12 end |