function [ suborder_xyz, suborder_w ] = wandzura_subrule ( rule, ...
  suborder_num )

%*****************************************************************************80
%
%% WANDZURA_SUBRULE returns a compressed Wandzura rule.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    10 May 2007
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Stephen Wandzura, Hong Xiao,
%    Symmetric Quadrature Rules on a Triangle,
%    Computers and Mathematics with Applications,
%    Volume 45, Number 12, June 2003, pages 1829-1840.
%
%  Parameters:
%
%    Input, integer RULE, the index of the rule.
%
%    Input, integer SUBORDER_NUM, the number of suborders of the rule.
%
%    Output, real SUBORDER_XYZ(3,SUBORDER_NUM),
%    the barycentric coordinates of the abscissas.
%
%    Output, real SUBORDER_W(SUBORDER_NUM), the suborder weights.
%
  if ( rule == 1 )

    suborder_xyz(1:3,1:suborder_num) = [ ...
      0.33333333333333, 0.33333333333333, 0.33333333333333; ...
      0.05971587178977, 0.47014206410512, 0.47014206410512; ...
      0.79742698535309, 0.10128650732346, 0.10128650732346  ...
    ]';

    suborder_w(1:suborder_num) = [ ...
      0.2250000000000000E+00, ...
      0.1323941527885062E+00, ...
      0.1259391805448271E+00  ...
    ];

  elseif ( rule == 2 )

    suborder_xyz(1:3,1:suborder_num) = [ ...
      0.33333333333333, 0.33333333333333, 0.33333333333333; ...
      0.00426913409105, 0.49786543295447, 0.49786543295447; ...
      0.14397510054189, 0.42801244972906, 0.42801244972906; ...
      0.63048717451355, 0.18475641274322, 0.18475641274322; ...
      0.95903756285664, 0.02048121857168, 0.02048121857168; ...
      0.03500298989727, 0.13657357625603, 0.82842343384669; ...
      0.03754907025844, 0.33274360058864, 0.62970732915292  ...
    ]';

    suborder_w(1:suborder_num) = [ ...
      0.8352339980519638E-01, ...
      0.7229850592056743E-02, ...
      0.7449217792098051E-01, ...
      0.7864647340310853E-01, ...
      0.6928323087107504E-02, ...
      0.2951832033477940E-01, ...
      0.3957936719606124E-01  ...
    ];

  elseif ( rule == 3 )

    suborder_xyz(1:3,1:suborder_num) = [ ...
      0.08343840726175, 0.45828079636912, 0.45828079636913; ...
      0.19277907084174, 0.40361046457913, 0.40361046457913; ...
      0.41360566417395, 0.29319716791303, 0.29319716791303; ...
      0.70706442611445, 0.14646778694277, 0.14646778694277; ...
      0.88727426466879, 0.05636286766560, 0.05636286766560; ...
      0.96684974628326, 0.01657512685837, 0.01657512685837; ...
      0.00991220330923, 0.23953455415479, 0.75055324253598; ...
      0.01580377063023, 0.40487880731834, 0.57931742205143; ...
      0.00514360881697, 0.09500211311304, 0.89985427806998; ...
      0.04892232575299, 0.14975310732227, 0.80132456692474; ...
      0.06876874863252, 0.28691961244133, 0.64431163892615; ...
      0.16840441812470, 0.28183566809908, 0.54975991377622  ...
    ]';

    suborder_w(1:suborder_num) = [ ...
      0.3266181884880529E-01, ...
      0.2741281803136436E-01, ...
      0.2651003659870330E-01, ...
      0.2921596213648611E-01, ...
      0.1058460806624399E-01, ...
      0.3614643064092035E-02, ...
      0.8527748101709436E-02, ...
      0.1391617651669193E-01, ...
      0.4291932940734835E-02, ...
      0.1623532928177489E-01, ...
      0.2560734092126239E-01, ...
      0.3308819553164567E-01  ...
    ];

  elseif ( rule == 4 )

    suborder_xyz(1:3,1:suborder_num) = [ ...
      0.33333333333333, 0.33333333333333, 0.33333333333333; ...
      0.00150064932443, 0.49924967533779, 0.49924967533779; ...
      0.09413975193895, 0.45293012403052, 0.45293012403052; ...
      0.20447212408953, 0.39776393795524, 0.39776393795524; ...
      0.47099959493443, 0.26450020253279, 0.26450020253279; ...
      0.57796207181585, 0.21101896409208, 0.21101896409208; ...
      0.78452878565746, 0.10773560717127, 0.10773560717127; ...
      0.92186182432439, 0.03906908783780, 0.03906908783780; ...
      0.97765124054134, 0.01117437972933, 0.01117437972933; ...
      0.00534961818734, 0.06354966590835, 0.93110071590431; ...
      0.00795481706620, 0.15710691894071, 0.83493826399309; ...
      0.01042239828126, 0.39564211436437, 0.59393548735436; ...
      0.01096441479612, 0.27316757071291, 0.71586801449097; ...
      0.03856671208546, 0.10178538248502, 0.85964790542952; ...
      0.03558050781722, 0.44665854917641, 0.51776094300637; ...
      0.04967081636276, 0.19901079414950, 0.75131838948773; ...
      0.05851972508433, 0.32426118369228, 0.61721909122339; ...
      0.12149778700439, 0.20853136321013, 0.66997084978547; ...
      0.14071084494394, 0.32317056653626, 0.53611858851980  ...
    ]';

    suborder_w(1:suborder_num) = [ ...
      0.2761042699769952E-01, ...
      0.1779029547326740E-02, ...
      0.2011239811396117E-01, ...
      0.2681784725933157E-01, ...
      0.2452313380150201E-01, ...
      0.1639457841069539E-01, ...
      0.1479590739864960E-01, ...
      0.4579282277704251E-02, ...
      0.1651826515576217E-02, ...
      0.2349170908575584E-02, ...
      0.4465925754181793E-02, ...
      0.6099566807907972E-02, ...
      0.6891081327188203E-02, ...
      0.7997475072478163E-02, ...
      0.7386134285336024E-02, ...
      0.1279933187864826E-01, ...
      0.1725807117569655E-01, ...
      0.1867294590293547E-01, ...
      0.2281822405839526E-01  ...
    ];

  elseif ( rule == 5 )

    suborder_xyz(1:3,1:suborder_num) = [ ...
      0.02794648307317, 0.48602675846341, 0.48602675846341; ...
      0.13117860132765, 0.43441069933617, 0.43441069933617; ...
      0.22022172951207, 0.38988913524396, 0.38988913524396; ...
      0.40311353196039, 0.29844323401980, 0.29844323401980; ...
      0.53191165532526, 0.23404417233737, 0.23404417233737; ...
      0.69706333078196, 0.15146833460902, 0.15146833460902; ...
      0.77453221290801, 0.11273389354599, 0.11273389354599; ...
      0.84456861581695, 0.07771569209153, 0.07771569209153; ...
      0.93021381277141, 0.03489309361430, 0.03489309361430; ...
      0.98548363075813, 0.00725818462093, 0.00725818462093; ...
      0.00129235270444, 0.22721445215336, 0.77149319514219; ...
      0.00539970127212, 0.43501055485357, 0.55958974387431; ...
      0.00638400303398, 0.32030959927220, 0.67330639769382; ...
      0.00502821150199, 0.09175032228001, 0.90322146621800; ...
      0.00682675862178, 0.03801083585872, 0.95516240551949; ...
      0.01001619963993, 0.15742521848531, 0.83255858187476; ...
      0.02575781317339, 0.23988965977853, 0.73435252704808; ...
      0.03022789811992, 0.36194311812606, 0.60782898375402; ...
      0.03050499010716, 0.08355196095483, 0.88594304893801; ...
      0.04595654736257, 0.14844322073242, 0.80560023190501; ...
      0.06744280054028, 0.28373970872753, 0.64881749073219; ...
      0.07004509141591, 0.40689937511879, 0.52305553346530; ...
      0.08391152464012, 0.19411398702489, 0.72197448833499; ...
      0.12037553567715, 0.32413434700070, 0.55549011732214; ...
      0.14806689915737, 0.22927748355598, 0.62265561728665; ...
      0.19177186586733, 0.32561812259598, 0.48261001153669  ...
    ]';

    suborder_w(1:suborder_num) = [ ...
      0.8005581880020417E-02, ...
      0.1594707683239050E-01, ...
      0.1310914123079553E-01, ...
      0.1958300096563562E-01, ...
      0.1647088544153727E-01, ...
      0.8547279074092100E-02, ...
      0.8161885857226492E-02, ...
      0.6121146539983779E-02, ...
      0.2908498264936665E-02, ...
      0.6922752456619963E-03, ...
      0.1248289199277397E-02, ...
      0.3404752908803022E-02, ...
      0.3359654326064051E-02, ...
      0.1716156539496754E-02, ...
      0.1480856316715606E-02, ...
      0.3511312610728685E-02, ...  
      0.7393550149706484E-02, ...
      0.7983087477376558E-02, ...
      0.4355962613158041E-02, ...
      0.7365056701417832E-02, ...
      0.1096357284641955E-01, ...
      0.1174996174354112E-01, ...
      0.1001560071379857E-01, ...
      0.1330964078762868E-01, ...
      0.1415444650522614E-01, ...
      0.1488137956116801E-01  ...
    ]';

  elseif ( rule == 6 )

    suborder_xyz(1:3,1:suborder_num) = [ ...
      0.33333333333333, 0.33333333333333, 0.33333333333333; ...
      0.00733011643277, 0.49633494178362, 0.49633494178362; ...
      0.08299567580296, 0.45850216209852, 0.45850216209852; ...
      0.15098095612541, 0.42450952193729, 0.42450952193729; ...
      0.23590585989217, 0.38204707005392, 0.38204707005392; ...
      0.43802430840785, 0.28098784579608, 0.28098784579608; ...
      0.54530204829193, 0.22734897585403, 0.22734897585403; ...
      0.65088177698254, 0.17455911150873, 0.17455911150873; ...
      0.75348314559713, 0.12325842720144, 0.12325842720144; ...
      0.83983154221561, 0.08008422889220, 0.08008422889220; ...
      0.90445106518420, 0.04777446740790, 0.04777446740790; ...
      0.95655897063972, 0.02172051468014, 0.02172051468014; ...
      0.99047064476913, 0.00476467761544, 0.00476467761544; ...
      0.00092537119335, 0.41529527091331, 0.58377935789334; ...
      0.00138592585556, 0.06118990978535, 0.93742416435909; ...
      0.00368241545591, 0.16490869013691, 0.83140889440718; ...
      0.00390322342416, 0.02503506223200, 0.97106171434384; ...
      0.00323324815501, 0.30606446515110, 0.69070228669389; ...
      0.00646743211224, 0.10707328373022, 0.88645928415754; ...
      0.00324747549133, 0.22995754934558, 0.76679497516308; ...
      0.00867509080675, 0.33703663330578, 0.65428827588746; ...
      0.01559702646731, 0.05625657618206, 0.92814639735063; ...
      0.01797672125369, 0.40245137521240, 0.57957190353391; ...
      0.01712424535389, 0.24365470201083, 0.73922105263528; ...
      0.02288340534658, 0.16538958561453, 0.81172700903888; ...
      0.03273759728777, 0.09930187449585, 0.86796052821639; ...
      0.03382101234234, 0.30847833306905, 0.65770065458860; ...
      0.03554761446002, 0.46066831859211, 0.50378406694787; ...
      0.05053979030687, 0.21881529945393, 0.73064491023920; ...
      0.05701471491573, 0.37920955156027, 0.56377573352399; ...
      0.06415280642120, 0.14296081941819, 0.79288637416061; ...
      0.08050114828763, 0.28373128210592, 0.63576756960645; ...
      0.10436706813453, 0.19673744100444, 0.69889549086103; ...
      0.11384489442875, 0.35588914121166, 0.53026596435959; ...
      0.14536348771552, 0.25981868535191, 0.59481782693256; ...
      0.18994565282198, 0.32192318123130, 0.48813116594672  ...
    ]';

    suborder_w(1:suborder_num) = [ ...
      0.1557996020289920E-01, ...
      0.3177233700534134E-02, ...
      0.1048342663573077E-01, ...
      0.1320945957774363E-01, ...
      0.1497500696627150E-01, ...
      0.1498790444338419E-01, ...
      0.1333886474102166E-01, ...
      0.1088917111390201E-01, ...
      0.8189440660893461E-02, ...
      0.5575387588607785E-02, ...
      0.3191216473411976E-02, ...
      0.1296715144327045E-02, ...
      0.2982628261349172E-03, ...
      0.9989056850788964E-03, ...
      0.4628508491732533E-03, ...
      0.1234451336382413E-02, ...
      0.5707198522432062E-03, ...
      0.1126946125877624E-02, ...
      0.1747866949407337E-02, ...
      0.1182818815031657E-02, ...
      0.1990839294675034E-02, ...
      0.1900412795035980E-02, ...
      0.4498365808817451E-02, ...
      0.3478719460274719E-02, ...
      0.4102399036723953E-02, ...
      0.4021761549744162E-02, ...
      0.6033164660795066E-02, ...
      0.3946290302129598E-02, ...
      0.6644044537680268E-02, ...
      0.8254305856078458E-02, ...
      0.6496056633406411E-02, ...
      0.9252778144146602E-02, ...
      0.9164920726294280E-02, ...
      0.1156952462809767E-01, ...
      0.1176111646760917E-01, ...
      0.1382470218216540E-01  ...
    ];

  else

    fprintf ( 1, '\n' );
    fprintf ( 1, 'WANDZURA_SUBRULE - Fatal error\n' );
    fprintf ( 1, '  Illegal RULE = %d\n', rule );
    error ( 'WANDZURA_SUBRULE - Fatal error' );

  end

  return
end
