(* Content-type: application/vnd.wolfram.mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 12.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 158, 7] NotebookDataLength[ 7903, 239] NotebookOptionsPosition[ 7481, 221] NotebookOutlinePosition[ 7886, 237] CellTagsIndexPosition[ 7843, 234] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell[TextData[{ StyleBox["CH and DB Indexes for LS-distance-like function ", FontColor->RGBColor[1, 0, 0]], " " }], "Subsubsection", CellChangeTimes->{{3.73112424028771*^9, 3.7311242546173754`*^9}, { 3.8106047392458076`*^9, 3.8106047456549196`*^9}, {3.820818867452566*^9, 3.820818868566964*^9}, {3.82082069093102*^9, 3.8208206918250113`*^9}, 3.8222000345112724`*^9, {3.8222001733534513`*^9, 3.8222001953026805`*^9}, { 3.822200422743824*^9, 3.822200423918998*^9}}, ExpressionUUID -> "e66d6e93-d6b2-4c5b-9154-8959b5b959a5"], Cell[BoxData[{ RowBox[{ RowBox[{ StyleBox["Input", FontColor->RGBColor[1, 0, 0]], StyleBox[":", FontColor->RGBColor[1, 0, 0]], StyleBox[" ", FontColor->RGBColor[0, 0, 1]], StyleBox[ RowBox[{ RowBox[{"set", " ", "\[ScriptCapitalA]"}], " ", "\[Subset]", " ", SuperscriptBox["\[DoubleStruckCapitalR]", "n"]}], FontColor->RGBColor[0, 0, 1]]}], StyleBox[",", FontColor->RGBColor[0, 0, 1]], StyleBox[" ", FontColor->RGBColor[0, 0, 1]], StyleBox[ RowBox[{ RowBox[{ "partition", " ", "\[CapitalPi]", " ", "of", " ", "the", " ", "set", " ", "\[ScriptCapitalA]"}], " ", "\[Subset]", " ", SuperscriptBox["\[DoubleStruckCapitalR]", "n"]}], FontColor->RGBColor[0, 0, 1]], StyleBox[",", FontColor->RGBColor[0, 0, 1]], StyleBox[" ", FontColor->RGBColor[0, 0, 1]], StyleBox[ RowBox[{ RowBox[{ RowBox[{"centers", " ", "cen"}], " ", "\[Element]", " ", SuperscriptBox["\[DoubleStruckCapitalR]", "kn"]}], ";"}], FontColor->RGBColor[0, 0, 1]]}], "\[IndentingNewLine]", RowBox[{ RowBox[{ StyleBox["Output", FontColor->RGBColor[1, 0, 0]], StyleBox[":", FontColor->RGBColor[1, 0, 0]], StyleBox[" ", FontColor->RGBColor[0, 0, 1]], StyleBox[ RowBox[{"CH", " ", "and", " ", "DB", " ", "index"}], FontColor->RGBColor[0, 0, 1]]}], StyleBox[";", FontColor->RGBColor[0, 0, 1]]}], "\[IndentingNewLine]", RowBox[{ RowBox[{ StyleBox["Submodules", FontColor->RGBColor[1, 0, 0]], StyleBox[":", FontColor->RGBColor[1, 0, 0]], StyleBox[" ", FontColor->RGBColor[0, 0, 1]], StyleBox[ RowBox[{"Fmin", "[", "]"}], FontColor->RGBColor[0, 0, 1]]}], StyleBox[" ", FontColor->RGBColor[0, 0, 1]]}], "\[IndentingNewLine]"}], "Text", CellChangeTimes->{{3.8222001228730335`*^9, 3.8222001264974904`*^9}, { 3.8222002231101017`*^9, 3.822200367715189*^9}, {3.822310473459633*^9, 3.8223104806021385`*^9}}, FontSize->12, ExpressionUUID -> "f6e31508-4aa7-4793-bad4-29a883041616"], Cell[BoxData[ RowBox[{ RowBox[{"Indexes", "[", RowBox[{"A_", ",", "PI_", ",", "cen_"}], "]"}], ":=", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"k", "=", RowBox[{"Length", "[", "cen", "]"}]}], ",", RowBox[{"m", "=", RowBox[{"Length", "[", "A", "]"}]}], ",", "F", ",", "G", ",", "KK", ",", "sigma2", ",", "CH", ",", "DB"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"F", "=", RowBox[{"Fmin", "[", RowBox[{"A", ",", "cen", ",", "2"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"G", "=", RowBox[{ RowBox[{"Sum", "[", RowBox[{ RowBox[{ RowBox[{"Norm", "[", RowBox[{ RowBox[{"Mean", "[", "A", "]"}], "-", RowBox[{"A", "[", RowBox[{"[", "i", "]"}], "]"}]}], "]"}], "^", "2"}], ",", RowBox[{"{", RowBox[{"i", ",", "m"}], "}"}]}], "]"}], "-", "F"}]}], ";", "\[IndentingNewLine]", RowBox[{"CH", "=", RowBox[{ RowBox[{"(", RowBox[{"G", "/", RowBox[{"(", RowBox[{"k", "-", "1"}], ")"}]}], ")"}], "/", RowBox[{"(", RowBox[{"F", "/", RowBox[{"(", RowBox[{"m", "-", "k"}], ")"}]}], ")"}]}]}], ";", " ", "\[IndentingNewLine]", RowBox[{"KK", "=", RowBox[{"Table", "[", RowBox[{"j", ",", RowBox[{"{", RowBox[{"j", ",", "k"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"sigma2", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{"Sum", "[", RowBox[{ RowBox[{ RowBox[{"Norm", "[", RowBox[{ RowBox[{"cen", "[", RowBox[{"[", "j", "]"}], "]"}], "-", RowBox[{"PI", "[", RowBox[{"[", RowBox[{"j", ",", "s"}], "]"}], "]"}]}], "]"}], "^", "2"}], ",", RowBox[{"{", RowBox[{"s", ",", RowBox[{"Length", "[", RowBox[{"PI", "[", RowBox[{"[", "j", "]"}], "]"}], "]"}]}], "}"}]}], "]"}], "/", RowBox[{"Length", "[", RowBox[{"PI", "[", RowBox[{"[", "j", "]"}], "]"}], "]"}]}], ",", RowBox[{"{", RowBox[{"j", ",", "k"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"DB", "=", RowBox[{ RowBox[{"Sum", "[", RowBox[{ RowBox[{"Max", "[", RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"Sqrt", "[", RowBox[{"sigma2", "[", RowBox[{"[", "j", "]"}], "]"}], "]"}], "+", RowBox[{"Sqrt", "[", RowBox[{"sigma2", "[", RowBox[{"[", "s", "]"}], "]"}], "]"}]}], ")"}], "/", RowBox[{"Norm", "[", RowBox[{ RowBox[{"cen", "[", RowBox[{"[", "j", "]"}], "]"}], "-", RowBox[{"cen", "[", RowBox[{"[", "s", "]"}], "]"}]}], "]"}]}], ",", RowBox[{"{", RowBox[{"s", ",", RowBox[{"Complement", "[", RowBox[{"KK", ",", RowBox[{"{", "j", "}"}]}], "]"}]}], "}"}]}], "]"}], "]"}], ",", RowBox[{"{", RowBox[{"j", ",", "k"}], "}"}]}], "]"}], "/", "k"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"{", RowBox[{"CH", ",", "DB"}], "}"}], "//", "N"}]}]}], "\[IndentingNewLine]", "]"}]}]], "Input", CellChangeTimes->{{3.765983189684289*^9, 3.765983205746383*^9}, { 3.7659833034012346`*^9, 3.7659834063101225`*^9}, {3.7659834402703967`*^9, 3.765983487874107*^9}, {3.7659835306839314`*^9, 3.7659836007675595`*^9}, { 3.7659836703575497`*^9, 3.7659838007709675`*^9}, {3.7659838513088865`*^9, 3.765983966108043*^9}, {3.765984053815613*^9, 3.76598405812912*^9}, 3.7659841855794153`*^9, {3.765984229315511*^9, 3.7659842430059204`*^9}, 3.7659842958856244`*^9, {3.7659845426252728`*^9, 3.7659845593465757`*^9}}, ExpressionUUID -> "5066c803-4d06-49ec-b39e-cf981a4e2b25"] }, Open ]] }, WindowSize->{754, 463}, WindowMargins->{{0, Automatic}, {Automatic, 2}}, TaggingRules->{"SlideshowSettings" -> {"Toolbar" -> True}}, FrontEndVersion->"11.0 for Microsoft Windows (64-bit) (September 21, 2016)", StyleDefinitions->"Default.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[580, 22, 541, 10, 39, "Subsubsection"], Cell[1124, 34, 2045, 65, 86, "Text"], Cell[3172, 101, 4293, 117, 240, "Input"] }, Open ]] } ] *)