Functions | |
!assert (A(perm,:), Prow *A) | |
!invperm (perm) | |
!assert (Prow\A, A(invperm,:)) | |
!assert (Prow'*A, A(invperm,:)) | |
!assert (A(:, perm), A *Pcol) | |
!assert (A/Pcol, A(:, invperm)) | |
!assert (A *Pcol.', A(:, invperm)) | |
!assert (sum(A), full(ones(1, n))) | |
!assert (sum(A, 2), full(ones(n, 1))) | |
!assert (typeinfo(rand(n)*Pc),"matrix") | |
!assert (typeinfo(Pr *rand(n)),"matrix") | |
!assert (typeinfo(Ac *Pc),"sparse complex matrix") | |
!assert (full(Ac *Pc), full(Ac)*Pc) | |
!assert (full(Ac/Pc), full(Ac)/Pc) | |
!assert (typeinfo(Pr *Ar),"sparse matrix") | |
!assert (full(Pr *Ar), Pr *full(Ar)) | |
!assert (full(Pr\Ar), Pr\full(Ar)) | |
!assert (typeinfo(A *P1),"matrix") | |
!assert (full(A *P1), full(A)*P1) | |
!assert (typeinfo(P1 *A),"matrix") | |
!assert (full(P1 *A), P1 *full(A)) | |
!assert (typeinfo(A1 *P),"matrix") | |
!assert (full(A1 *P), full(A1)*P) | |
!assert (typeinfo(P *A1),"matrix") | |
!assert (full(P *A1), P *full(A1)) | |
!assert (typeinfo(A *P1),"sparse matrix") | |
!assert (typeinfo(P1 *A),"sparse matrix") | |
!assert (typeinfo(A1 *P),"sparse matrix") | |
!assert (typeinfo(P *A1),"sparse matrix") | |
!A (n, n-2) | |
!A (3, 1) | |
!assert (Pr *A *Pc, A(pr, pc)) | |
!assert (full(sP), full(P)) | |
!assert (size(find(sP), 1), n) | |
!assert (all(V==1)) | |
!assert (Dr *A, repmat(scalefact, 1, n).*A) | |
!assert (Dr\A, A./repmat(scalefact, 1, n)) | |
!scalefact (m-1) | |
!Dr (m-1, m-1)=0 | |
!assert (A *Dc, repmat(scalefact, m, 1).*A) | |
!assert (A/Dc, A./repmat(scalefact, m, 1)) | |
!scalefact (n-1) | |
!Dc (n-1, n-1)=0 | |
!assert (typeinfo(D1D2),"complex diagonal matrix") | |
!assert (diag(D1D2), d1+d2) | |
!assert (diag(D1D2), d1.*d2) | |
!assert (typeinfo(Dslice),"diagonal matrix") | |
!assert (typeinfo(rand(8)*(3 *eye(8))),"matrix") | |
!assert (typeinfo((3 *eye(8))*rand(8)),"matrix") | |
!assert (typeinfo(sprand(8, 8,.5)*(3 *eye(8))),"sparse matrix") | |
!assert (typeinfo(sprand(8, 8,.5)*(3 *eye(8))'),"sparse matrix") | |
!assert (typeinfo(((3+2 *I())*eye(8))*sprand(8, 8,.5)),"sparse complex matrix") | |
!assert (typeinfo(((3+2 *I())*eye(8))'*sprand(8, 8,.5)),"sparse complex matrix") | |
!assert (typeinfo(sprand(8, 8,.5)*((3+2 *I())*eye(8)).'),"sparse complex matrix") | |
!A (4, 1) | |
!assert (Dr *A *Dc, A.*kron(dr, dc), eps) | |
!Dr (n-1, n-1)=0 | |
!assert (full(Dr\A), full(A)./repmat(scalefact, 1, n)) | |
!assert (full(Dr\A), Dr\full(A))%!test%!n | |
!assert (full(A/Dc), full(A)/Dc)%!test%!n | |
!assert (typeinfo(A+D),"sparse matrix")%!assert(typeinfo(A-D) | |
!assert (typeinfo(A-D),"sparse complex matrix")%!A | |
!assert (typeinfo(D-A),"sparse complex matrix")%!test%!n | |
!assert (full(A+D), full(A)+D)%!assert(full(A-D) | |
full (A)-D)%!D | |
!assert (full(D+A), D+full(A))%!A | |
!A (6, 4) | |
Variables | |
!test | !n = 5 |
!A = rand (n) | |
!perm = randperm (n) | |
!Prow = eye (n) (perm, :) | |
!Pcol = eye (n) (:, perm) | |
!P1 = eye (n) (:, randperm (n)) | |
!Pc = eye (n) (:, randperm (n)) | |
!Pr = eye (n) (randperm (n), :) | |
!Ac = sprand (n-3, n, .5) + I () * sprand (n-3, n, .5) | |
!Ar = sprand (n, n+2, .5) | |
!A1 = 1 | |
!P = eye (n) (:, randperm (n)) | |
!pc = randperm (n) | |
!pr = randperm (n) | |
!sP = sparse (P) | |
!test | !m = 7 |
!scalefact = rand (m, 1) | |
!Dr = diag (scalefact) | |
!Dc = diag (scalefact) | |
!mn = min (m, n) | |
!d1 = rand (mn, 1) + I () * rand (mn, 1) | |
!D1 = diag (d1, m, n) | |
!d2 = rand (mn, 1) | |
!D2 = diag (d2, m, n) | |
!D1D2 = D1 + D2 | |
!d = rand (mn, 1) | |
!D = diag (d, m, n) | |
!Dslice = D (1:(m-3), 1:(n-2)) | |
!dr = rand (n, 1) | |
!dc = rand (1, n) |
!A | ( | 6 | , | |
4 | ||||
) |
!A | ( | 4 | , | |
1 | ||||
) |
!A | ( | 3 | , | |
1 | ||||
) |
!A | ( | n | , | |
n- | 2 | |||
) |
!assert | ( | full(A+D) | , | |
full(A)+ | D | |||
) |
!assert | ( | typeinfo(D-A) | , | |
"sparse complex matrix" | ||||
) |
!assert | ( | typeinfo(A-D) | , | |
"sparse complex matrix" | ||||
) |
!assert | ( | typeinfo(A+D) | , | |
"sparse matrix" | ||||
) |
!assert | ( | full(A/Dc) | , | |
full(A)/ | Dc | |||
) |
!assert | ( | full(Dr\A) | , | |
Dr\ | fullA | |||
) |
!assert | ( | full(Dr\A) | , | |
full(A)./repmat(scalefact, 1, n) | ||||
) |
!assert | ( | Dr *A * | Dc, | |
A.* | krondr, dc, | |||
eps | ||||
) |
!assert | ( | typeinfo(sprand(8, 8,.5)*((3+2 *I())*eye(8)).') | , | |
"sparse complex matrix" | ||||
) |
!assert | ( | typeinfo(((3+2 *I())*eye(8))'*sprand(8, 8,.5)) | , | |
"sparse complex matrix" | ||||
) |
!assert | ( | typeinfo(((3+2 *I())*eye(8))*sprand(8, 8,.5)) | , | |
"sparse complex matrix" | ||||
) |
!assert | ( | typeinfo(sprand(8, 8,.5)*(3 *eye(8))') | , | |
"sparse matrix" | ||||
) |
!assert | ( | typeinfo(sprand(8, 8,.5)*(3 *eye(8))) | , | |
"sparse matrix" | ||||
) |
!assert | ( | typeinfo((3 *eye(8))*rand(8)) | , | |
"matrix" | ||||
) |
!assert | ( | typeinfo(rand(8)*(3 *eye(8))) | , | |
"matrix" | ||||
) |
!assert | ( | typeinfo(Dslice) | , | |
"diagonal matrix" | ||||
) |
!assert | ( | diag(D1D2) | , | |
d1.* | d2 | |||
) |
!assert | ( | diag(D1D2) | , | |
d1+ | d2 | |||
) |
!assert | ( | typeinfo(D1D2) | , | |
"complex diagonal matrix" | ||||
) |
!assert | ( | A/ | Dc, | |
A./ | repmatscalefact, m, 1 | |||
) |
!assert | ( | A * | Dc, | |
repmat(scalefact, m, 1).* | A | |||
) |
!assert | ( | Dr\ | A, | |
A./ | repmatscalefact, 1, n | |||
) |
!assert | ( | Dr * | A, | |
repmat(scalefact, 1, n).* | A | |||
) |
!assert | ( | all(V==1) | ) |
!assert | ( | size(find(sP), 1) | , | |
n | ||||
) |
!assert | ( | full(sP) | , | |
full(P) | ||||
) |
!assert | ( | Pr *A * | Pc, | |
A(pr, pc) | ||||
) |
!assert | ( | typeinfo(P *A1) | , | |
"sparse matrix" | ||||
) |
!assert | ( | typeinfo(A1 *P) | , | |
"sparse matrix" | ||||
) |
!assert | ( | typeinfo(P1 *A) | , | |
"sparse matrix" | ||||
) |
!assert | ( | typeinfo(A *P1) | , | |
"sparse matrix" | ||||
) |
!assert | ( | full(P *A1) | , | |
P * | fullA1 | |||
) |
!assert | ( | typeinfo(P *A1) | , | |
"matrix" | ||||
) |
!assert | ( | full(A1 *P) | , | |
full(A1)* | P | |||
) |
!assert | ( | typeinfo(A1 *P) | , | |
"matrix" | ||||
) |
!assert | ( | full(P1 *A) | , | |
P1 * | fullA | |||
) |
!assert | ( | typeinfo(P1 *A) | , | |
"matrix" | ||||
) |
!assert | ( | full(A *P1) | , | |
full(A)* | P1 | |||
) |
!assert | ( | typeinfo(A *P1) | , | |
"matrix" | ||||
) |
!assert | ( | full(Pr\Ar) | , | |
Pr\ | fullAr | |||
) |
!assert | ( | full(Pr *Ar) | , | |
Pr * | fullAr | |||
) |
!assert | ( | typeinfo(Pr *Ar) | , | |
"sparse matrix" | ||||
) |
!assert | ( | full(Ac/Pc) | , | |
full(Ac)/ | Pc | |||
) |
!assert | ( | full(Ac *Pc) | , | |
full(Ac)* | Pc | |||
) |
!assert | ( | typeinfo(Ac *Pc) | , | |
"sparse complex matrix" | ||||
) |
!assert | ( | typeinfo(Pr *rand(n)) | , | |
"matrix" | ||||
) |
!assert | ( | typeinfo(rand(n)*Pc) | , | |
"matrix" | ||||
) |
!assert | ( | sum(A, 2) | , | |
full(ones(n, 1)) | ||||
) |
!assert | ( | sum(A) | , | |
full(ones(1, n)) | ||||
) |
!assert | ( | A *Pcol.' | , | |
A(:, invperm) | ||||
) |
!assert | ( | A/ | Pcol, | |
A(:, invperm) | ||||
) |
!assert | ( | A(:, perm) | , | |
A * | Pcol | |||
) |
!assert | ( | Prow'* | A, | |
A(invperm,:) | ||||
) |
!assert | ( | Prow\ | A, | |
A(invperm,:) | ||||
) |
!assert | ( | A(perm,:) | , | |
Prow * | A | |||
) |
!Dc | ( | n- | 1, | |
n- | 1 | |||
) | [pure virtual] |
!Dr | ( | n- | 1, | |
n- | 1 | |||
) | [pure virtual] |
!Dr | ( | m- | 1, | |
m- | 1 | |||
) | [pure virtual] |
!invperm | ( | perm | ) |
!scalefact | ( | n- | 1 | ) |
!scalefact | ( | m- | 1 | ) |
full | ( | A | ) |
!A = rand (n) |
!A1 = 1 |
!Ac = sprand (n-3, n, .5) + I () * sprand (n-3, n, .5) |
!Ar = sprand (n, n+2, .5) |
!D = diag (d, m, n) |
!d = rand (mn, 1) |
!D1 = diag (d1, m, n) |
!d1 = rand (mn, 1) + I () * rand (mn, 1) |
!D1D2 = D1 + D2 |
!D2 = diag (d2, m, n) |
!d2 = rand (mn, 1) |
!dc = rand (1, n) |
!Dc = diag (scalefact) |
!dr = rand (n, 1) |
!Dr = diag (scalefact) |
!Dslice = D (1:(m-3), 1:(n-2)) |
!test !m = 7 |
!mn = min (m, n) |
!test !n = 5 |
!P = eye (n) (:, randperm (n)) |
!P1 = eye (n) (:, randperm (n)) |
!pc = randperm (n) |
!Pc = eye (n) (:, randperm (n)) |
!Pcol = eye (n) (:, perm) |
!perm = randperm (n) |
!pr = randperm (n) |
!Pr = eye (n) (randperm (n), :) |
!Prow = eye (n) (perm, :) |
!scalefact = rand (m, 1) |
!sP = sparse (P) |