Home Online Manual
Top
Back: difformListCont
Forward: difformUnivDer
FastBack:
FastForward:
Up: difform_lib
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

D.15.3.27 difformListSort

Procedure from library difform.lib (see difform_lib).

Return:
the sorted list L in ascending order, depending on the optional monomial ordering given

Remarks:
Classical insertion sort is used to sort the list

Note:
- the procedure uses difformIsBigger to compare list elements, therefore an optional ordering is defined via the pattern in difformIsBigger - the standard ordering is the ordering on the differential algebra - the procedure can also handle special lists of lists by using the optional input "Dlist" or "Llist":
- "Dlist" is used for lists with structure:
L[1] is a list of differential forms
L[2] is a list of polynomials of same size,
The list gets sorted by the elements in L[1]. This is mainly used for the structure of derivations.
- "Llist" allows the structure: L[i] is a list with two entries: L[i][1] is a differential form
L[i][2] is a polynomial
The list gets sorted by the elements L[i][1]. This is used to sort coefficient lists.

Example:
 
LIB "difform.lib";
ring R = 0,(x,y,z,t),dp;
diffAlgebra();
==> // The differential algebra Omega_R was constructed and the differential \
   forms dDx, dDy, dDz, dDt, dx, dy, dz, dt are available.
/////////////////////////
// Sortation of a list //
/////////////////////////
list L = dx*x, x2 - y*t, 12, dt*dy*dx*dz;
// Sort list with standard ordering
difformListSort(L);
==> [1]:
==>    12
==> 
==> [2]:
==>    x2-yt
==> 
==> [3]:
==>    x*dx
==> 
==> [4]:
==>    dx*dy*dz*dt
==> 
// Sort list with changed ordering
difformListSort(L,"gen","ls","ringvar","wp",intvec(-1,1,1,1));
==> [1]:
==>    dx*dy*dz*dt
==> 
==> [2]:
==>    x*dx
==> 
==> [3]:
==>    12
==> 
==> [4]:
==>    x2-yt
==> 
/////////////////////////////////////////////
// Sortation of list with structure "Dlist" //
/////////////////////////////////////////////
list DL;
DL[1] = list(dx,x,t,dt); DL[2] = list(y,t*z,4,x);
// This list has the structure described by "Dlist"
difformListSort(DL,"Dlist","ringvar","ls");
==> [1]:
==>    [1]:
==>       x
==> 
==>    [2]:
==>       t
==> 
==>    [3]:
==>       dt
==> 
==>    [4]:
==>       dx
==> 
==> [2]:
==>    [1]:
==>       zt
==>    [2]:
==>       4
==>    [3]:
==>       x
==>    [4]:
==>       y
/////////////////////////////////////////////
// Sortation of list with structure "Llist" //
/////////////////////////////////////////////
list LL;
LL[1] = list(dx,x); LL[2] = list(t*dt,y); LL[3] = list(x,2);
// This list has the structure described by "Llist"
difformListSort(LL,"Llist");
==> [1]:
==>    [1]:
==>       x
==> 
==>    [2]:
==>       2
==> [2]:
==>    [1]:
==>       t*dt
==> 
==>    [2]:
==>       y
==> [3]:
==>    [1]:
==>       dx
==> 
==>    [2]:
==>       x
kill Omega_R,dx,dy,dz,dt,L,DL,LL;
See also: difformIsBigger; difformIsSmaller.