Jump to content
seaza

regula?

Recommended Posts

Posted (edited)

sall.

am o inmultire d matrici reprezentate ca vectori, si incercam sa gasesc o "regula" ptr inmultire.

matrice operator*(matrice x)
{
matrice u;
u.setLC(x.linii, coloane);
int aux1=linii;
int aux2=x.coloane;
int aux3=coloane;
int i, l, c;

if(x.coloane==linii){
for(l=0; l<aux3; l++)
{
for(c=0; c<aux1; c++)
{
complex sum;
for(i=0; i<aux2; i++)
sum=sum+(v[l*aux2+i])*(x.v[i*aux1+c]);
u.v[l*aux1+c]=sum;
}
}
}else cout<<"EROARE";

return u;
}

unde v este: complex v[nrlin*nrcol], intr o clasa mostenita din complex, by default nrlin si nrcol sunt date cu #define nrlin 10, respc. #define nrcol 10

doar ca nu merge chiar asa bine...are cnva vreo mica idee unde e greseala ?:-/

Edited by seaza

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...