Changeset be1e92 in git
- Timestamp:
- Dec 2, 2010, 4:08:00 PM (13 years ago)
- Branches:
- (u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
- Children:
- 4e75784f0d5e941b4a716274f7236f53348703e1
- Parents:
- 34ab5f65915ea1dfa21855f73940082f660d5855
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/sparsmat.cc
r34ab5f6 rbe1e92 840 840 /* ----------------- elimination ------------------ */ 841 841 842 /* steps of elimination */843 void sparse_mat::smElim()844 {845 poly p = piv->m; // pivotelement846 smpoly c = m_act[act]; // pivotcolumn847 smpoly r = red; // row to reduce848 poly q;849 smpoly res, a, b;850 poly w, ha, hb;851 int i;852 853 if (oldpiv != NULL) q = oldpiv->m; // previous pivot854 else q = NULL;855 if ((c == NULL) || (r == NULL))856 {857 while (r) smElemDelete(&r);858 for (i=1; i<act; i++)859 {860 a = m_act[i];861 while (a != NULL)862 {863 ha = SM_MULT(a->m, p, q);864 pDelete(&a->m);865 if (q) SM_DIV(ha, q);866 a->m = ha;867 a = a->n;868 }869 }870 return;871 }872 for (i=1; i<act; i++)873 {874 a = m_act[i];875 if ((r == NULL) || (i != r->pos)) // cols without elimination876 {877 while (a != NULL)878 {879 ha = SM_MULT(a->m, p, q);880 pDelete(&a->m);881 if (q) SM_DIV(ha, q);882 a->m = ha;883 a = a->n;884 }885 }886 else // cols with elimination887 {888 res = dumm;889 res->n = NULL;890 b = c;891 w = r->m;892 loop // combine the chains a and b: p*a + w*b893 {894 if (a == NULL)895 {896 if (b != NULL)897 {898 do899 {900 res = res->n = smElemCopy(b);901 hb = SM_MULT(b->m, w, q);902 if (q) SM_DIV(hb, q);903 res->m = hb;904 b = b->n;905 } while (b != NULL);906 }907 else908 res->n = NULL;909 break;910 }911 if (b == NULL)912 {913 do914 {915 ha = SM_MULT(a->m, p, q);916 pDelete(&a->m);917 if (q) SM_DIV(ha, q);918 a->m = ha;919 res = res->n = a;920 a = a->n;921 } while (a != NULL);922 break;923 }924 if (a->pos < b->pos)925 {926 ha = SM_MULT(a->m, p, q);927 pDelete(&a->m);928 if (q) SM_DIV(ha, q);929 a->m = ha;930 res = res->n = a;931 a = a->n;932 }933 else if (a->pos > b->pos)934 {935 res = res->n = smElemCopy(b);936 hb = SM_MULT(b->m, w, q);937 b = b->n;938 if (q) SM_DIV(hb, q);939 res->m = hb;940 }941 else942 {943 ha = SM_MULT(a->m, p, q);944 pDelete(&a->m);945 hb = SM_MULT(b->m, w, q);946 ha = pAdd(ha, hb);947 if (ha != NULL)948 {949 if (q) SM_DIV(ha, q);950 a->m = ha;951 res = res->n = a;952 a = a->n;953 }954 else955 {956 smElemDelete(&a);957 }958 b = b->n;959 }960 }961 m_act[i] = dumm->n;962 if (r) smElemDelete(&r);963 }964 }965 }966 967 842 /* first step of elimination */ 968 843 void sparse_mat::sm1Elim()
Note: See TracChangeset
for help on using the changeset viewer.