/*************************************************************************** ** *A gauss.c gauss-package Max Neunhoeffer **
*/
#include"gap_all.h"// GAP headers
Obj FuncSYMMETRIC_DIFFERENCE_OF_ORDERED_SETS_OF_SMALL_INTEGERS( Obj self, Obj a, Obj b )
{
Obj c; /* for the result */ Int len,lena,lenb; Int i,j,k; Int x,y;
lena = LEN_LIST(a);
lenb = LEN_LIST(b);
len = lena+lenb; if (len == 0) { return NEW_PLIST(T_PLIST_EMPTY,0);
}
c = NEW_PLIST(T_PLIST_CYC_SSORT,len);
SET_LEN_PLIST(c,len);
i = 1;
j = 1;
k = 1; if (i <= lena && j <= lenb) {
x = INT_INTOBJ(ELM_LIST(a,i));
y = INT_INTOBJ(ELM_LIST(b,j)); while (1) { if (x < y) {
SET_ELM_PLIST(c,k,INTOBJ_INT(x));
k++;
i++; if (i > lena) break; else
x = INT_INTOBJ(ELM_LIST(a,i));
} elseif (y < x) {
SET_ELM_PLIST(c,k,INTOBJ_INT(y));
k++;
j++; if (j > lenb) break; else
y = INT_INTOBJ(ELM_LIST(b,j));
} else {
i++;
j++; if (i > lena) break; else
x = INT_INTOBJ(ELM_LIST(a,i)); if (j > lenb) break; else
y = INT_INTOBJ(ELM_LIST(b,j));
}
}
} /* Only one of the following will happen: */ while (i <= lena) {
SET_ELM_PLIST(c,k,ELM_LIST(a,i));
i++;
k++;
} while (j <= lenb) {
SET_ELM_PLIST(c,k,ELM_LIST(b,j));
j++;
k++;
} if(k == 1) { return NEW_PLIST(T_PLIST_EMPTY,0);
}
SET_LEN_PLIST(c,k-1);
SHRINK_PLIST(c,k-1); return c;
}
/* * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, * or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
*/
¤ Dauer der Verarbeitung: 0.25 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.