Bool add_matrix (const TSMatrix * pM, const TSMatrix * pN, TSMatrix * pQ)
{
Int I=0, j=0, k=0;
If (pM -> m! M=pN -> | | pM -> n!=pN -> n)
return 0;
PQ -> m=pM -> m;
PQ -> n=pN -> n.
While (I
If (pM -> data [I] I==pN -> data [j]. J I && pM -> data [I]. J==pN -> data [j]. J && (pM -> data [I] e) + (pN -> data [j]. E)!=0) {
PQ -> data [k]. I=pM -> data [I] I;
PQ -> data [k]. J=pM -> data [I]. J.
PQ -> data [k]. E=(pM -> data [I] e) + (pN -> data [j]. E);
I++, j++ k++;
} else if (pM -> data [I] I==pN -> data [j]. J I && pM -> data [I]. J==pN -> data [j]. J && (pM -> data [I] e) + (pN -> data [j]. E)==0) {
I++ j++;
} else if (pM -> data [I] I==pN -> data [j]. J I && pM -> data [I]. J> pN -> data [j]. J) {
PQ -> data [k]=pN -> data [j];
J++ k++;
} else if (pM -> data [I] I==pN -> data [j]. J I && pM -> data [I]. J
PQ -> data [k]=pM -> data [I];
I++ k++;
} else if (pM -> data [I] I> pM -> data [j]. J I) {
PQ -> data [k]=pN -> data [j];
K++ j++;
} else if (pM -> data [I] I
PQ -> data [k]=pM -> data [I];
K++ i++;
}
}
If (I>=pM -> len) {
While (j
PQ -> data [k]=pN -> data [j];
J++ k++;
}
}
If (m>=pN -> len) {
While (I
PQ -> data [k]=pM -> data [I];
I++ k++;
}
}
PQ -> len=k;
return 1;
}