00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include <metis.h>
00015
00016
00017
00018
00019
00020
00021 int AreAllVwgtsBelow(int ncon, floattype alpha, floattype *vwgt1, floattype beta, floattype *vwgt2, floattype limit)
00022 {
00023 int i;
00024
00025 for (i=0; i<ncon; i++)
00026 if (alpha*vwgt1[i] + beta*vwgt2[i] > limit)
00027 return 0;
00028
00029 return 1;
00030 }
00031
00032
00033
00034
00035
00036
00037 int AreAnyVwgtsBelow(int ncon, floattype alpha, floattype *vwgt1, floattype beta, floattype *vwgt2, floattype limit)
00038 {
00039 int i;
00040
00041 for (i=0; i<ncon; i++)
00042 if (alpha*vwgt1[i] + beta*vwgt2[i] < limit)
00043 return 1;
00044
00045 return 0;
00046 }
00047
00048
00049
00050
00051
00052
00053
00054 int AreAllVwgtsAbove(int ncon, floattype alpha, floattype *vwgt1, floattype beta, floattype *vwgt2, floattype limit)
00055 {
00056 int i;
00057
00058 for (i=0; i<ncon; i++)
00059 if (alpha*vwgt1[i] + beta*vwgt2[i] < limit)
00060 return 0;
00061
00062 return 1;
00063 }
00064
00065
00066
00067
00068
00069
00070 floattype ComputeLoadImbalance(int ncon, int nparts, floattype *npwgts, floattype *tpwgts)
00071 {
00072 int i, j;
00073 floattype max, lb=0.0;
00074
00075 for (i=0; i<ncon; i++) {
00076 max = 0.0;
00077 for (j=0; j<nparts; j++) {
00078 if (npwgts[j*ncon+i] > max)
00079 max = npwgts[j*ncon+i];
00080 }
00081 if (max*nparts > lb)
00082 lb = max*nparts;
00083 }
00084
00085 return lb;
00086 }
00087
00088
00089
00090
00091
00092 int AreAllBelow(int ncon, floattype *v1, floattype *v2)
00093 {
00094 int i;
00095
00096 for (i=0; i<ncon; i++)
00097 if (v1[i] > v2[i])
00098 return 0;
00099
00100 return 1;
00101 }