Changeset dd930e5 in git
- Timestamp:
- Sep 9, 2016, 2:43:10 PM (7 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a657104b677b4c461d018cbf3204d72d34ad66a9')
- Children:
- 1ca2af82a3bd8eac81ea5d1768cd152322082b89
- Parents:
- 8222d62826a4a1e61a9e22bfbb98e742f896d780
- Location:
- libpolys/polys
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libpolys/polys/matpol.cc
r8222d6 rdd930e5 574 574 v = v->next; 575 575 } 576 }577 578 579 BOOLEAN mp_Equal(matrix a, matrix b, const ring R)580 {581 if ((MATCOLS(a)!=MATCOLS(b)) || (MATROWS(a)!=MATROWS(b)))582 return FALSE;583 int i=MATCOLS(a)*MATROWS(b)-1;584 while (i>=0)585 {586 if (a->m[i]==NULL)587 {588 if (b->m[i]!=NULL) return FALSE;589 }590 else591 if (b->m[i]==NULL) return FALSE;592 else if (p_Cmp(a->m[i],b->m[i], R)!=0) return FALSE;593 i--;594 }595 i=MATCOLS(a)*MATROWS(b)-1;596 while (i>=0)597 {598 #if 0599 poly tt=p_Sub(p_Copy(a->m[i], R),p_Copy(b->m[i], R), R);600 if (tt!=NULL)601 {602 p_Delete(&tt, R);603 return FALSE;604 }605 #else606 if(!p_EqualPolys(a->m[i],b->m[i], R)) return FALSE;607 #endif608 i--;609 }610 return TRUE;611 576 } 612 577 … … 1703 1668 return (result); 1704 1669 } 1670 int mp_Compare(matrix a, matrix b, const ring R) 1671 { 1672 if (MATCOLS(a)<MATCOLS(b)) return -1; 1673 else if (MATCOLS(a)>MATCOLS(b)) return 1; 1674 if (MATROWS(a)<MATROWS(b)) return -1; 1675 else if (MATROWS(a)<MATROWS(b)) return 1; 1676 1677 int i=MATCOLS(a)*MATROWS(b)-1; 1678 int c; 1679 while (i>=0) 1680 { 1681 if (a->m[i]==NULL) 1682 { 1683 if (b->m[i]!=NULL) return -1; 1684 } 1685 else 1686 if (b->m[i]==NULL) return 1; 1687 else if ((c=p_Cmp(a->m[i],b->m[i], R))!=0) return c; 1688 i--; 1689 } 1690 unsigned ii=MATCOLS(a)*MATROWS(b)-1; 1691 unsigned j=0; 1692 int r=0; 1693 while (j<=ii) 1694 { 1695 r=p_Compare(a->m[j],b->m[j],R); 1696 if (r!=0) return r; 1697 j++; 1698 } 1699 return r; 1700 } 1701 1702 BOOLEAN mp_Equal(matrix a, matrix b, const ring R) 1703 { 1704 int r=mp_Compare(a,b,R); 1705 return (r==0); 1706 } 1707 -
libpolys/polys/matpol.h
r8222d6 rdd930e5 93 93 extern omBin ip_smatrix_bin; 94 94 95 int mp_Compare(matrix a, matrix b, const ring r); 95 96 #endif/* MATPOL_H */
Note: See TracChangeset
for help on using the changeset viewer.