//
// time: Fri Oct 23 14:47:30 1998
//
// version: 3.1.2 (format), 4.1.1 (DX Beta)
//
//
// Begin MDF
// MODULE Classify
// CATEGORY Macros
// DESCRIPTION new macro
// INPUT Field; field; (no default);  Field to be clustered based on positions
// INPUT NewField; field; (no default);  Field after iterating classification
// INPUT NClusters; value list or field or string or string list; (no default); Number of clusters to create
// OUTPUT output_1; field;  
// End MDF
// workspace: width = 593, height = 635
// layout: snap = 0, width = 50, height = 50, align = NN
//
macro Classify(
 Field
,NewField
,NClusters
) -> (
 output_1
) {
    // 
    // node Input[1]: x = 2, y = 0, inputs = 0, label = Input
    // parameter: position = 1, name = 'Field', value = '(no default)', descriptive = 1, description = ' Field to be clustered based on positions', required = 0, visible = 1
    //
Classify_Input_1_out_1 = Field;
    // 
    // node Extract[2]: x = 61, y = 81, inputs = 2, label = Extract
    // input[2]: defaulting = 0, visible = 1, type = 32, value = "positions"
    //
Classify_Extract_2_out_1[cache: 2] = 
    Extract(
    Classify_Input_1_out_1,
    "positions"
    ) [instance: 2, cache: 1];
    // 
    // node Input[2]: x = 224, y = 4, inputs = 0, label = Input
    // parameter: position = 2, name = 'NewField', value = '(no default)', descriptive = 1, description = ' Field after iterating classification', required = 0, visible = 1
    //
Classify_Input_2_out_1 = NewField;
    // 
    // node Extract[1]: x = 269, y = 80, inputs = 2, label = Extract
    // input[2]: defaulting = 0, visible = 1, type = 32, value = "positions"
    //
Classify_Extract_1_out_1[cache: 2] = 
    Extract(
    Classify_Input_2_out_1,
    "positions"
    ) [instance: 1, cache: 1];
    // 
    // node Input[10]: x = 334, y = 11, inputs = 0, label = Input
    // parameter: position = 3, name = 'NClusters', value = '(no default)', descriptive = 1, description = 'Number of clusters to create', required = 0, visible = 1
    //
Classify_Input_10_out_1 = NClusters;
    // 
    // node Compute[20]: x = 535, y = 44, inputs = 3, label = Compute
    // input[1]: defaulting = 0, visible = 0, type = 32, value = "$0-1"
    // expression: value = a-1
    // name[2]: value = a
    // name[3]: value = b
    //
Classify_Compute_20_out_1[cache: 2] = 
    Compute(
    "$0-1",
    Classify_Input_10_out_1,
    NULL
    ) [instance: 20, cache: 1];
    // 
    // node ForEachN[1]: x = 425, y = 65, inputs = 3, label = ForEachN
    // input[1]: defaulting = 0, visible = 1, type = 1, value = 0
    // input[2]: defaulting = 1, visible = 1, type = 1, value = 3
    //
Classify_ForEachN_1_out_1[cache: 2],
Classify_ForEachN_1_out_2[cache: 2] = 
    ForEachN(
    0,
    Classify_Compute_20_out_1,
    NULL
    ) [instance: 1, cache: 1];
    // 
    // node Select[1]: x = 316, y = 175, inputs = 3, label = Select
    //
Classify_Select_1_out_1[cache: 2] = 
    Select(
    Classify_Extract_1_out_1,
    Classify_ForEachN_1_out_1,
    NULL
    ) [instance: 1, cache: 1];
    // 
    // node Compute[5]: x = 233, y = 239, inputs = 3, label = Compute
    // input[1]: defaulting = 0, visible = 0, type = 32, value = "mag($0-$1)"
    // expression: value = mag(a-b)
    // name[2]: value = a
    // name[3]: value = b
    //
Classify_Compute_5_out_1[cache: 2] = 
    Compute(
    "mag($0-$1)",
    Classify_Extract_2_out_1,
    Classify_Select_1_out_1
    ) [instance: 5, cache: 1];
    // 
    // node Inquire[2]: x = 176, y = 92, inputs = 3, label = Inquire
    // input[2]: defaulting = 0, visible = 1, type = 32, value = "position counts"
    //
Classify_Inquire_2_out_1[cache: 0] = 
    Inquire(
    Classify_Input_1_out_1,
    "position counts",
    NULL
    ) [instance: 2, cache: 1];
    // 
    // node Enumerate[3]: x = 14, y = 224, inputs = 5, label = Enumerate
    // input[1]: defaulting = 0, visible = 1, type = 29, value = 1000000
    // input[4]: defaulting = 0, visible = 1, type = 29, value = 1.0
    //
Classify_Enumerate_3_out_1[cache: 2] = 
    Enumerate(
    1000000,
    NULL,
    Classify_Inquire_2_out_1,
    1.0,
    NULL
    ) [instance: 3, cache: 1];
    // 
    // node First[1]: x = 158, y = 237, inputs = 0, label = First
    //
Classify_First_1_out_1[cache: 2] = 
    First(

    ) [instance: 1, cache: 1];
    // 
    // node GetLocal[1]: x = 24, y = 338, inputs = 3, label = GetLocal
    //
Classify_GetLocal_1_out_1[cache: 2],
Classify_GetLocal_1_out_2[cache: 2] = 
    GetLocal(
    Classify_Enumerate_3_out_1,
    Classify_First_1_out_1,
    NULL
    ) [instance: 1, cache: 1];
    // 
    // node Compute[6]: x = 147, y = 338, inputs = 4, label = Compute
    // input[1]: defaulting = 0, visible = 0, type = 32, value = "$0>$1?$1 : $0"
    // expression: value = a>b?b : a
    // name[2]: value = a
    // name[3]: value = b
    // name[4]: value = c
    //
Classify_Compute_6_out_1[cache: 2] = 
    Compute(
    "$0>$1?$1 : $0",
    Classify_GetLocal_1_out_1,
    Classify_Compute_5_out_1,
    NULL
    ) [instance: 6, cache: 1];
    // 
    // node Enumerate[4]: x = 385, y = 177, inputs = 5, label = Enumerate
    // input[1]: defaulting = 0, visible = 1, type = 29, value = -1000000
    // input[4]: defaulting = 0, visible = 1, type = 29, value = 1
    //
Classify_Enumerate_4_out_1[cache: 2] = 
    Enumerate(
    -1000000,
    NULL,
    Classify_Inquire_2_out_1,
    1,
    NULL
    ) [instance: 4, cache: 1];
    // 
    // node GetLocal[2]: x = 370, y = 338, inputs = 3, label = GetLocal
    //
Classify_GetLocal_2_out_1[cache: 2],
Classify_GetLocal_2_out_2[cache: 2] = 
    GetLocal(
    Classify_Enumerate_4_out_1,
    Classify_First_1_out_1,
    NULL
    ) [instance: 2, cache: 1];
    // 
    // node Compute[7]: x = 246, y = 341, inputs = 5, label = Compute
    // input[1]: defaulting = 0, visible = 0, type = 32, value = "$0>$1?$3:$2"
    // expression: value = a>b?d:c
    // name[2]: value = a
    // name[3]: value = b
    // name[4]: value = c
    // name[5]: value = d
    //
Classify_Compute_7_out_1[cache: 2] = 
    Compute(
    "$0>$1?$3:$2",
    Classify_GetLocal_1_out_1,
    Classify_Compute_5_out_1,
    Classify_GetLocal_2_out_1,
    Classify_ForEachN_1_out_1
    ) [instance: 7, cache: 1];
    // 
    // node Replace[2]: x = 171, y = 467, inputs = 4, label = Replace
    //
Classify_Replace_2_out_1[cache: 2] = 
    Replace(
    Classify_Compute_7_out_1,
    Classify_Input_1_out_1,
    NULL,
    NULL
    ) [instance: 2, cache: 1];
    // 
    // node Output[1]: x = 197, y = 575, inputs = 1, label = Output
    // parameter: position = 1, name = 'output_1', value = ' ', descriptive = 0, description = ' ', required = 0, visible = 1
    //
output_1 = Classify_Replace_2_out_1;
    // 
    // node SetLocal[1]: x = 42, y = 443, inputs = 3, label = SetLocal
    //
    SetLocal(
    Classify_Compute_6_out_1,
    Classify_GetLocal_1_out_2,
    NULL
    ) [instance: 1, cache: 1];
    // 
    // node SetLocal[2]: x = 371, y = 443, inputs = 3, label = SetLocal
    //
    SetLocal(
    Classify_Compute_7_out_1,
    Classify_GetLocal_2_out_2,
    NULL
    ) [instance: 2, cache: 1];
// network: end of macro body
}
Classify_Input_1_out_1 = NULL;
Classify_Extract_2_out_1 = NULL;
Classify_Input_2_out_1 = NULL;
Classify_Extract_1_out_1 = NULL;
Classify_Input_10_out_1 = NULL;
Classify_Compute_20_out_1 = NULL;
Classify_ForEachN_1_out_1 = NULL;
Classify_Select_1_out_1 = NULL;
Classify_Compute_5_out_1 = NULL;
Classify_Inquire_2_out_1 = NULL;
Classify_Enumerate_3_out_1 = NULL;
Classify_First_1_out_1 = NULL;
Classify_GetLocal_1_out_1 = NULL;
Classify_GetLocal_1_out_2 = NULL;
Classify_Compute_6_out_1 = NULL;
Classify_Enumerate_4_out_1 = NULL;
Classify_GetLocal_2_out_1 = NULL;
Classify_GetLocal_2_out_2 = NULL;
Classify_Compute_7_out_1 = NULL;
Classify_Replace_2_out_1 = NULL;
