Testing and sortingPartitionsChangesConstructions

Constructions

In order to construct a partition out of a VECTORobject, you have to provide the VECTORobject, and you have to specify the specific kind, here is an example:
Example:
#include "def.h"
#include "macro.h"
main()
{
OP v,p;
anfang();
v = callocobject(); p = callocobject();
m_il_v(2L,v);
m_i_i(1L,s_v_i(v,0L));
m_i_i(2L,s_v_i(v,1L));
b_ks_pa(VECTOR,v,p); println(p);
freeall(p);
ende();
}
(Please note that v is not freed, the reason is that it is part of p!)
Here is the complete description of b_ks_pa() and the second constructor m_ks_pa(): There are also the standard routines for the selection of the two parts of a PARTITIONobject, they are named s_pa_s, which gives you the self-part and the routine s_pa_k, which gives you the kind of the representation. Here are the complete descriptions: and the routine As we have seen, there are always (up to now) VECTORobjects as self-parts of a PARTITIONobject, we can access the i-th entry, and also the length of PARTITIONobject, this can be done using the following routines
NAME DESCRIPTION MACRO
s_pa_l s_v_l(s_pa_s) S_PA_L
s_pa_li s_v_li(s_pa_s) S_PA_LI
s_pa_i s_v_i(s_pa_s) S_PA_I
s_pa_ii s_v_ii(s_pa_s) S_PA_II
Please note that you can access the INT value of the vector elements, which are INTEGERobjects. But you shouldn't use this routines, if you have implemented an own type of partition, which has no VECTORobject as the self-part. These have been the basic routines for PARTITIONobjects.
harald.fripertinger@kfunigraz.ac.at,
last changed: November 19, 2001

Testing and sortingPartitionsChangesConstructions