10.07.2015 Views

Calcul matriceal elementar

Calcul matriceal elementar

Calcul matriceal elementar

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

22 SEMINAR 1. CALCUL MATRICEAL ELEMENTAR15: if mb∼=116: error(’b nu este vector coloana’);17: end18: if nc∼=n19: error(’A si b nu pot fi inmultite’);20: end21: [ mc,nc ]=size(c);22: if mc∼=123: error(’c nu este vector coloana’);24: end25: for j=1:n26: for i=1:m27: c(i)=c(i)+A(i,j)*b(j);28: end29: end30: end1: function [ C ]=MxMijk(A,B)2:3: %-------------------------------------------------------------------------4: % Algoritmul 1.85: % Functia calculeaza matricea C definita ca produsul a doua6: % matrice A si B. Algoritmul se bazeaza pe partitionarea lui A pe linii,7: % si a lui B pe coloane.8: % Apelul: [ C ]=MxMijk(A,B)9: %10: % Buta Valentin, aprilie, 200611: %-------------------------------------------------------------------------12:13: [ m,n ]=size(A);14: [ x,p ]=size(B);15: if n∼=x16: error(’Matricele nu pot fi inmultite!’)17: end18: for i=1:m19: for j=1:p20: C(i,j)=0;21: end22: end23: for i=1:m24: for j=1:p25: for k=1:n26: C(i,j)=C(i,j)+A(i,k)*B(k,j);27: end28: end29: end30: end

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!