text:
module HTMLNames

const htmltwochar = Dict{ASCIIString, NTuple{2,UInt16}}(
    "acE"	=> (0x223E, 0x0333),
    "cups"	=> (0x222A, 0xFE00),
    "bne"	=> (0x003D, 0x20E5),
    "bnequiv"	=> (0x2261, 0x20E5),
    "caps"	=> (0x2229, 0xFE00),
    "fjlig"	=> (0x0066, 0x006A),
    "gesl"	=> (0x22DB, 0xFE00),
    "gvertneqq"	=> (0x2269, 0xFE00),
    "gvnE"	=> (0x2269, 0xFE00),
    "lates"	=> (0x2AAD, 0xFE00),
    "lesg"	=> (0x22DA, 0xFE00),
    "lvertneqq"	=> (0x2268, 0xFE00),
    "lvnE"	=> (0x2268, 0xFE00),
    "nang"	=> (0x2220, 0x20D2),
    "napE"	=> (0x2A70, 0x0338),
    "napid"	=> (0x224B, 0x0338),
    "nbump"	=> (0x224E, 0x0338),
    "nbumpe"	=> (0x224F, 0x0338),
    "ncongdot"	=> (0x2A6D, 0x0338),
    "nedot"	=> (0x2250, 0x0338),
    "nesim"	=> (0x2242, 0x0338),
    "ngE"	=> (0x2267, 0x0338),
    "ngeqq"	=> (0x2267, 0x0338),
    "ngeqslant"	=> (0x2A7E, 0x0338),
    "nges"	=> (0x2A7E, 0x0338),
    "nGg"	=> (0x22D9, 0x0338),
    "nGt"	=> (0x226B, 0x20D2),
    "nGtv"	=> (0x226B, 0x0338),
    "nlE"	=> (0x2266, 0x0338),
    "nleqq"	=> (0x2266, 0x0338),
    "nleqslant"	=> (0x2A7D, 0x0338),
    "nles"	=> (0x2A7D, 0x0338),
    "nLl"	=> (0x22D8, 0x0338),
    "nLt"	=> (0x226A, 0x20D2),
    "nLtv"	=> (0x226A, 0x0338),
    "NotEqualTilde"	=> (0x2242, 0x0338),
    "NotGreaterFullEqual"	=> (0x2267, 0x0338),
    "NotGreaterGreater"	=> (0x226B, 0x0338),
    "NotGreaterSlantEqual"	=> (0x2A7E, 0x0338),
    "NotHumpDownHump"	=> (0x224E, 0x0338),
    "NotHumpEqual"	=> (0x224F, 0x0338),
    "notindot"	=> (0x22F5, 0x0338),
    "notinE"	=> (0x22F9, 0x0338),
    "NotLeftTriangleBar"	=> (0x29CF, 0x0338),
    "NotLessLess"	=> (0x226A, 0x0338),
    "NotLessSlantEqual"	=> (0x2A7D, 0x0338),
    "NotNestedGreaterGreater"	=> (0x2AA2, 0x0338),
    "NotNestedLessLess"	=> (0x2AA1, 0x0338),
    "NotPrecedesEqual"	=> (0x2AAF, 0x0338),
    "NotRightTriangleBar"	=> (0x29D0, 0x0338),
    "NotSquareSubset"	=> (0x228F, 0x0338),
    "NotSquareSuperset"	=> (0x2290, 0x0338),
    "NotSubset"	=> (0x2282, 0x20D2),
    "NotSucceedsEqual"	=> (0x2AB0, 0x0338),
    "NotSucceedsTilde"	=> (0x227F, 0x0338),
    "NotSuperset"	=> (0x2283, 0x20D2),
    "nparsl"	=> (0x2AFD, 0x20E5),
    "npart"	=> (0x2202, 0x0338),
    "npre"	=> (0x2AAF, 0x0338),
    "npreceq"	=> (0x2AAF, 0x0338),
    "nrarrc"	=> (0x2933, 0x0338),
    "nrarrw"	=> (0x219D, 0x0338),
    "nsce"	=> (0x2AB0, 0x0338),
    "nsubE"	=> (0x2AC5, 0x0338),
    "nsubset"	=> (0x2282, 0x20D2),
    "nsubseteqq"	=> (0x2AC5, 0x0338),
    "nsucceq"	=> (0x2AB0, 0x0338),
    "nsupE"	=> (0x2AC6, 0x0338),
    "nsupset"	=> (0x2283, 0x20D2),
    "nsupseteqq"	=> (0x2AC6, 0x0338),
    "nvap"	=> (0x224D, 0x20D2),
    "nvge"	=> (0x2265, 0x20D2),
    "nvgt"	=> (0x003E, 0x20D2),
    "nvle"	=> (0x2264, 0x20D2),
    "nvlt"	=> (0x003C, 0x20D2),
    "nvltrie"	=> (0x22B4, 0x20D2),
    "nvrtrie"	=> (0x22B5, 0x20D2),
    "nvsim"	=> (0x223C, 0x20D2),
    "race"	=> (0x223D, 0x0331),
    "smtes"	=> (0x2AAC, 0xFE00),
    "sqcaps"	=> (0x2293, 0xFE00),
    "sqcups"	=> (0x2294, 0xFE00),
    "ThickSpace"	=> (0x205F, 0x200A),
    "varsubsetneq"	=> (0x228A, 0xFE00),
    "varsubsetneqq"	=> (0x2ACB, 0xFE00),
    "varsupsetneq"	=> (0x228B, 0xFE00),
    "varsupsetneqq"	=> (0x2ACC, 0xFE00),
    "vsubnE"	=> (0x2ACB, 0xFE00),
    "vsubne"	=> (0x228A, 0xFE00),
    "vsupnE"	=> (0x2ACC, 0xFE00),
    "vsupne"	=> (0x228B, 0xFE00),
    "vnsub"	=> (0x2282, 0x20D2),
    "vnsup"	=> (0x2283, 0x20D2))

const htmlnonbmp = Dict{ASCIIString, UInt16}(
    "Afr"	=> 0xD504,
    "afr"	=> 0xD51E,
    "Aopf"	=> 0xD538,
    "aopf"	=> 0xD552,
    "Ascr"	=> 0xD49C,
    "ascr"	=> 0xD4B6,
    "Bfr"	=> 0xD505,
    "bfr"	=> 0xD51F,
    "Bopf"	=> 0xD539,
    "bopf"	=> 0xD553,
    "bscr"	=> 0xD4B7,
    "cfr"	=> 0xD520,
    "copf"	=> 0xD554,
    "Cscr"	=> 0xD49E,
    "cscr"	=> 0xD4B8,
    "Dfr"	=> 0xD507,
    "dfr"	=> 0xD521,
    "Dopf"	=> 0xD53B,
    "dopf"	=> 0xD555,
    "Dscr"	=> 0xD49F,
    "dscr"	=> 0xD4B9,
    "Efr"	=> 0xD508,
    "efr"	=> 0xD522,
    "Eopf"	=> 0xD53C,
    "eopf"	=> 0xD556,
    "Ffr"	=> 0xD509,
    "ffr"	=> 0xD523,
    "Fopf"	=> 0xD53D,
    "fopf"	=> 0xD557,
    "fscr"	=> 0xD4BB,
    "Gfr"	=> 0xD50A,
    "gfr"	=> 0xD524,
    "Gopf"	=> 0xD53E,
    "gopf"	=> 0xD558,
    "Gscr"	=> 0xD4A2,
    "hfr"	=> 0xD525,
    "hopf"	=> 0xD559,
    "hscr"	=> 0xD4BD,
    "ifr"	=> 0xD526,
    "Iopf"	=> 0xD540,
    "iopf"	=> 0xD55A,
    "iscr"	=> 0xD4BE,
    "Jfr"	=> 0xD50D,
    "jfr"	=> 0xD527,
    "Jopf"	=> 0xD541,
    "jopf"	=> 0xD55B,
    "Jscr"	=> 0xD4A5,
    "jscr"	=> 0xD4BF,
    "Kfr"	=> 0xD50E,
    "kfr"	=> 0xD528,
    "Kopf"	=> 0xD542,
    "kopf"	=> 0xD55C,
    "Kscr"	=> 0xD4A6,
    "kscr"	=> 0xD4C0,
    "Lfr"	=> 0xD50F,
    "lfr"	=> 0xD529,
    "Lopf"	=> 0xD543,
    "lopf"	=> 0xD55D,
    "lscr"	=> 0xD4C1,
    "Mfr"	=> 0xD510,
    "mfr"	=> 0xD52A,
    "Mopf"	=> 0xD544,
    "mopf"	=> 0xD55E,
    "mscr"	=> 0xD4C2,
    "Nfr"	=> 0xD511,
    "nfr"	=> 0xD52B,
    "nopf"	=> 0xD55F,
    "Nscr"	=> 0xD4A9,
    "nscr"	=> 0xD4C3,
    "Ofr"	=> 0xD512,
    "ofr"	=> 0xD52C,
    "Oopf"	=> 0xD546,
    "oopf"	=> 0xD560,
    "Oscr"	=> 0xD4AA,
    "Pfr"	=> 0xD513,
    "pfr"	=> 0xD52D,
    "popf"	=> 0xD561,
    "Pscr"	=> 0xD4AB,
    "pscr"	=> 0xD4C5,
    "Qfr"	=> 0xD514,
    "qfr"	=> 0xD52E,
    "qopf"	=> 0xD562,
    "Qscr"	=> 0xD4AC,
    "qscr"	=> 0xD4C6,
    "rfr"	=> 0xD52F,
    "ropf"	=> 0xD563,
    "rscr"	=> 0xD4C7,
    "Sfr"	=> 0xD516,
    "sfr"	=> 0xD530,
    "Sopf"	=> 0xD54A,
    "sopf"	=> 0xD564,
    "Sscr"	=> 0xD4AE,
    "sscr"	=> 0xD4C8,
    "Tfr"	=> 0xD517,
    "tfr"	=> 0xD531,
    "Topf"	=> 0xD54B,
    "topf"	=> 0xD565,
    "Tscr"	=> 0xD4AF,
    "tscr"	=> 0xD4C9,
    "Ufr"	=> 0xD518,
    "ufr"	=> 0xD532,
    "Uopf"	=> 0xD54C,
    "uopf"	=> 0xD566,
    "Uscr"	=> 0xD4B0,
    "uscr"	=> 0xD4CA,
    "Vfr"	=> 0xD519,
    "vfr"	=> 0xD533,
    "Vopf"	=> 0xD54D,
    "vopf"	=> 0xD567,
    "Vscr"	=> 0xD4B1,
    "vscr"	=> 0xD4CB,
    "Wfr"	=> 0xD51A,
    "wfr"	=> 0xD534,
    "Wopf"	=> 0xD54E,
    "wopf"	=> 0xD568,
    "Wscr"	=> 0xD4B2,
    "wscr"	=> 0xD4CC,
    "Xfr"	=> 0xD51B,
    "xfr"	=> 0xD535,
    "Xopf"	=> 0xD54F,
    "xopf"	=> 0xD569,
    "Xscr"	=> 0xD4B3,
    "xscr"	=> 0xD4CD,
    "Yfr"	=> 0xD51C,
    "yfr"	=> 0xD536,
    "Yopf"	=> 0xD550,
    "yopf"	=> 0xD56A,
    "Yscr"	=> 0xD4B4,
    "yscr"	=> 0xD4CE,
    "zfr"	=> 0xD537,
    "zopf"	=> 0xD56B,
    "Zscr"	=> 0xD4B5,
    "zscr"	=> 0xD4CF)

const htmlonechar = Dict{ASCIIString, UInt16}(
    "Aacute"	=> 0x00C1,
    "aacute"	=> 0x00E1,
    "Abreve"	=> 0x0102,
    "abreve"	=> 0x0103,
    "ac"	=> 0x223E,
    "acd"	=> 0x223F,
    "Acirc"	=> 0x00C2,
    "acirc"	=> 0x00E2,
    "acute"	=> 0x00B4,
    "Acy"	=> 0x0410,
    "acy"	=> 0x0430,
    "AElig"	=> 0x00C6,
    "aelig"	=> 0x00E6,
    "af"	=> 0x2061,
    "Agrave"	=> 0x00C0,
    "agrave"	=> 0x00E0,
    "alefsym"	=> 0x2135,
    "aleph"	=> 0x2135,
    "Alpha"	=> 0x0391,
    "alpha"	=> 0x03B1,
    "Amacr"	=> 0x0100,
    "amacr"	=> 0x0101,
    "amalg"	=> 0x2A3F,
    "AMP"	=> 0x0026,
    "amp"	=> 0x0026,
    "And"	=> 0x2A53,
    "and"	=> 0x2227,
    "andand"	=> 0x2A55,
    "andd"	=> 0x2A5C,
    "andslope"	=> 0x2A58,
    "andv"	=> 0x2A5A,
    "ang"	=> 0x2220,
    "ange"	=> 0x29A4,
    "angle"	=> 0x2220,
    "angmsd"	=> 0x2221,
    "angmsdaa"	=> 0x29A8,
    "angmsdab"	=> 0x29A9,
    "angmsdac"	=> 0x29AA,
    "angmsdad"	=> 0x29AB,
    "angmsdae"	=> 0x29AC,
    "angmsdaf"	=> 0x29AD,
    "angmsdag"	=> 0x29AE,
    "angmsdah"	=> 0x29AF,
    "angrt"	=> 0x221F,
    "angrtvb"	=> 0x22BE,
    "angrtvbd"	=> 0x299D,
    "angsph"	=> 0x2222,
    "angst"	=> 0x00C5,
    "angzarr"	=> 0x237C,
    "Aogon"	=> 0x0104,
    "aogon"	=> 0x0105,
    "ap"	=> 0x2248,
    "apacir"	=> 0x2A6F,
    "apE"	=> 0x2A70,
    "ape"	=> 0x224A,
    "apid"	=> 0x224B,
    "apos"	=> 0x0027,
    "ApplyFunction"	=> 0x2061,
    "approx"	=> 0x2248,
    "approxeq"	=> 0x224A,
    "Aring"	=> 0x00C5,
    "aring"	=> 0x00E5,
    "Assign"	=> 0x2254,
    "ast"	=> 0x002A,
    "asymp"	=> 0x2248,
    "asympeq"	=> 0x224D,
    "Atilde"	=> 0x00C3,
    "atilde"	=> 0x00E3,
    "Auml"	=> 0x00C4,
    "auml"	=> 0x00E4,
    "awconint"	=> 0x2233,
    "awint"	=> 0x2A11,
    "backcong"	=> 0x224C,
    "backepsilon"	=> 0x03F6,
    "backprime"	=> 0x2035,
    "backsim"	=> 0x223D,
    "backsimeq"	=> 0x22CD,
    "Backslash"	=> 0x2216,
    "Barv"	=> 0x2AE7,
    "barvee"	=> 0x22BD,
    "Barwed"	=> 0x2306,
    "barwed"	=> 0x2305,
    "barwedge"	=> 0x2305,
    "bbrk"	=> 0x23B5,
    "bbrktbrk"	=> 0x23B6,
    "bcong"	=> 0x224C,
    "Bcy"	=> 0x0411,
    "bcy"	=> 0x0431,
    "bdquo"	=> 0x201E,
    "becaus"	=> 0x2235,
    "Because"	=> 0x2235,
    "because"	=> 0x2235,
    "bemptyv"	=> 0x29B0,
    "bepsi"	=> 0x03F6,
    "bernou"	=> 0x212C,
    "Bernoullis"	=> 0x212C,
    "Beta"	=> 0x0392,
    "beta"	=> 0x03B2,
    "beth"	=> 0x2136,
    "between"	=> 0x226C,
    "bigcap"	=> 0x22C2,
    "bigcirc"	=> 0x25EF,
    "bigcup"	=> 0x22C3,
    "bigodot"	=> 0x2A00,
    "bigoplus"	=> 0x2A01,
    "bigotimes"	=> 0x2A02,
    "bigsqcup"	=> 0x2A06,
    "bigstar"	=> 0x2605,
    "bigtriangledown"	=> 0x25BD,
    "bigtriangleup"	=> 0x25B3,
    "biguplus"	=> 0x2A04,
    "bigvee"	=> 0x22C1,
    "bigwedge"	=> 0x22C0,
    "bkarow"	=> 0x290D,
    "blacklozenge"	=> 0x29EB,
    "blacksquare"	=> 0x25AA,
    "blacktriangle"	=> 0x25B4,
    "blacktriangledown"	=> 0x25BE,
    "blacktriangleleft"	=> 0x25C2,
    "blacktriangleright"	=> 0x25B8,
    "blank"	=> 0x2423,
    "blk12"	=> 0x2592,
    "blk14"	=> 0x2591,
    "blk34"	=> 0x2593,
    "block"	=> 0x2588,
    "bNot"	=> 0x2AED,
    "bnot"	=> 0x2310,
    "bot"	=> 0x22A5,
    "bottom"	=> 0x22A5,
    "bowtie"	=> 0x22C8,
    "boxbox"	=> 0x29C9,
    "boxDL"	=> 0x2557,
    "boxDl"	=> 0x2556,
    "boxdL"	=> 0x2555,
    "boxdl"	=> 0x2510,
    "boxDR"	=> 0x2554,
    "boxDr"	=> 0x2553,
    "boxdR"	=> 0x2552,
    "boxdr"	=> 0x250C,
    "boxH"	=> 0x2550,
    "boxh"	=> 0x2500,
    "boxHD"	=> 0x2566,
    "boxHd"	=> 0x2564,
    "boxhD"	=> 0x2565,
    "boxhd"	=> 0x252C,
    "boxHU"	=> 0x2569,
    "boxHu"	=> 0x2567,
    "boxhU"	=> 0x2568,
    "boxhu"	=> 0x2534,
    "boxminus"	=> 0x229F,
    "boxplus"	=> 0x229E,
    "boxtimes"	=> 0x22A0,
    "boxUL"	=> 0x255D,
    "boxUl"	=> 0x255C,
    "boxuL"	=> 0x255B,
    "boxul"	=> 0x2518,
    "boxUR"	=> 0x255A,
    "boxUr"	=> 0x2559,
    "boxuR"	=> 0x2558,
    "boxur"	=> 0x2514,
    "boxV"	=> 0x2551,
    "boxv"	=> 0x2502,
    "boxVH"	=> 0x256C,
    "boxVh"	=> 0x256B,
    "boxvH"	=> 0x256A,
    "boxvh"	=> 0x253C,
    "boxVL"	=> 0x2563,
    "boxVl"	=> 0x2562,
    "boxvL"	=> 0x2561,
    "boxvl"	=> 0x2524,
    "boxVR"	=> 0x2560,
    "boxVr"	=> 0x255F,
    "boxvR"	=> 0x255E,
    "boxvr"	=> 0x251C,
    "bprime"	=> 0x2035,
    "Breve"	=> 0x02D8,
    "breve"	=> 0x02D8,
    "brvbar"	=> 0x00A6,
    "Bscr"	=> 0x212C,
    "bsemi"	=> 0x204F,
    "bsim"	=> 0x223D,
    "bsime"	=> 0x22CD,
    "bsol"	=> 0x005C,
    "bsolb"	=> 0x29C5,
    "bsolhsub"	=> 0x27C8,
    "bull"	=> 0x2022,
    "bullet"	=> 0x2022,
    "bump"	=> 0x224E,
    "bumpE"	=> 0x2AAE,
    "bumpe"	=> 0x224F,
    "Bumpeq"	=> 0x224E,
    "bumpeq"	=> 0x224F,
    "Cacute"	=> 0x0106,
    "cacute"	=> 0x0107,
    "Cap"	=> 0x22D2,
    "cap"	=> 0x2229,
    "capand"	=> 0x2A44,
    "capbrcup"	=> 0x2A49,
    "capcap"	=> 0x2A4B,
    "capcup"	=> 0x2A47,
    "capdot"	=> 0x2A40,
    "CapitalDifferentialD"	=> 0x2145,
    "caret"	=> 0x2041,
    "caron"	=> 0x02C7,
    "Cayleys"	=> 0x212D,
    "ccaps"	=> 0x2A4D,
    "Ccaron"	=> 0x010C,
    "ccaron"	=> 0x010D,
    "Ccedil"	=> 0x00C7,
    "ccedil"	=> 0x00E7,
    "Ccirc"	=> 0x0108,
    "ccirc"	=> 0x0109,
    "Cconint"	=> 0x2230,
    "ccups"	=> 0x2A4C,
    "ccupssm"	=> 0x2A50,
    "Cdot"	=> 0x010A,
    "cdot"	=> 0x010B,
    "cedil"	=> 0x00B8,
    "Cedilla"	=> 0x00B8,
    "cemptyv"	=> 0x29B2,
    "cent"	=> 0x00A2,
    "CenterDot"	=> 0x00B7,
    "centerdot"	=> 0x00B7,
    "Cfr"	=> 0x212D,
    "CHcy"	=> 0x0427,
    "chcy"	=> 0x0447,
    "check"	=> 0x2713,
    "checkmark"	=> 0x2713,
    "Chi"	=> 0x03A7,
    "chi"	=> 0x03C7,
    "cir"	=> 0x25CB,
    "circ"	=> 0x02C6,
    "circeq"	=> 0x2257,
    "circlearrowleft"	=> 0x21BA,
    "circlearrowright"	=> 0x21BB,
    "circledast"	=> 0x229B,
    "circledcirc"	=> 0x229A,
    "circleddash"	=> 0x229D,
    "CircleDot"		=> 0x2299,
    "circledR"		=> 0x00AE,
    "circledS"		=> 0x24C8,
    "CircleMinus"	=> 0x2296,
    "CirclePlus"	=> 0x2295,
    "CircleTimes"	=> 0x2297,
    "cirE"	=> 0x29C3,
    "cire"	=> 0x2257,
    "cirfnint"	=> 0x2A10,
    "cirmid"	=> 0x2AEF,
    "cirscir"	=> 0x29C2,
    "ClockwiseContourIntegral"	=> 0x2232,
    "CloseCurlyDoubleQuote"	=> 0x201D,
    "CloseCurlyQuote"	=> 0x2019,
    "clubs"	=> 0x2663,
    "clubsuit"	=> 0x2663,
    "Colon"	=> 0x2237,
    "colon"	=> 0x003A,
    "Colone"	=> 0x2A74,
    "colone"	=> 0x2254,
    "coloneq"	=> 0x2254,
    "comma"	=> 0x002C,
    "commat"	=> 0x0040,
    "comp"	=> 0x2201,
    "compfn"	=> 0x2218,
    "complement"	=> 0x2201,
    "complexes"	=> 0x2102,
    "cong"	=> 0x2245,
    "congdot"	=> 0x2A6D,
    "Congruent"	=> 0x2261,
    "Conint"	=> 0x222F,
    "conint"	=> 0x222E,
    "ContourIntegral"	=> 0x222E,
    "Copf"	=> 0x2102,
    "coprod"	=> 0x2210,
    "Coproduct"	=> 0x2210,
    "COPY"	=> 0x00A9,
    "copy"	=> 0x00A9,
    "copysr"	=> 0x2117,
    "CounterClockwiseContourIntegral"	=> 0x2233,
    "crarr"	=> 0x21B5,
    "Cross"	=> 0x2A2F,
    "cross"	=> 0x2717,
    "csub"	=> 0x2ACF,
    "csube"	=> 0x2AD1,
    "csup"	=> 0x2AD0,
    "csupe"	=> 0x2AD2,
    "ctdot"	=> 0x22EF,
    "cudarrl"	=> 0x2938,
    "cudarrr"	=> 0x2935,
    "cuepr"	=> 0x22DE,
    "cuesc"	=> 0x22DF,
    "cularr"	=> 0x21B6,
    "cularrp"	=> 0x293D,
    "Cup"	=> 0x22D3,
    "cup"	=> 0x222A,
    "cupbrcap"	=> 0x2A48,
    "CupCap"	=> 0x224D,
    "cupcap"	=> 0x2A46,
    "cupcup"	=> 0x2A4A,
    "cupdot"	=> 0x228D,
    "cupor"	=> 0x2A45,
    "curarr"	=> 0x21B7,
    "curarrm"	=> 0x293C,
    "curlyeqprec"	=> 0x22DE,
    "curlyeqsucc"	=> 0x22DF,
    "curlyvee"	=> 0x22CE,
    "curlywedge"	=> 0x22CF,
    "curren"	=> 0x00A4,
    "curvearrowleft"	=> 0x21B6,
    "curvearrowright"	=> 0x21B7,
    "cuvee"	=> 0x22CE,
    "cuwed"	=> 0x22CF,
    "cwconint"	=> 0x2232,
    "cwint"	=> 0x2231,
    "cylcty"	=> 0x232D,
    "Dagger"	=> 0x2021,
    "dagger"	=> 0x2020,
    "daleth"	=> 0x2138,
    "Darr"	=> 0x21A1,
    "dArr"	=> 0x21D3,
    "darr"	=> 0x2193,
    "dash"	=> 0x2010,
    "Dashv"	=> 0x2AE4,
    "dashv"	=> 0x22A3,
    "dbkarow"	=> 0x290F,
    "dblac"	=> 0x02DD,
    "Dcaron"	=> 0x010E,
    "dcaron"	=> 0x010F,
    "Dcy"	=> 0x0414,
    "dcy"	=> 0x0434,
    "DD"	=> 0x2145,
    "dd"	=> 0x2146,
    "ddagger"	=> 0x2021,
    "ddarr"	=> 0x21CA,
    "DDotrahd"	=> 0x2911,
    "ddotseq"	=> 0x2A77,
    "deg"	=> 0x00B0,
    "Del"	=> 0x2207,
    "Delta"	=> 0x0394,
    "delta"	=> 0x03B4,
    "demptyv"	=> 0x29B1,
    "dfisht"	=> 0x297F,
    "dHar"	=> 0x2965,
    "dharl"	=> 0x21C3,
    "dharr"	=> 0x21C2,
    "DiacriticalAcute"	=> 0x00B4,
    "DiacriticalDot"	=> 0x02D9,
    "DiacriticalDoubleAcute"	=> 0x02DD,
    "DiacriticalGrave"	=> 0x0060,
    "DiacriticalTilde"	=> 0x02DC,
    "diam"	=> 0x22C4,
    "Diamond"	=> 0x22C4,
    "diamond"	=> 0x22C4,
    "diamondsuit"	=> 0x2666,
    "diams"	=> 0x2666,
    "die"	=> 0x00A8,
    "DifferentialD"	=> 0x2146,
    "digamma"	=> 0x03DD,
    "disin"	=> 0x22F2,
    "div"	=> 0x00F7,
    "divide"	=> 0x00F7,
    "divideontimes"	=> 0x22C7,
    "divonx"	=> 0x22C7,
    "DJcy"	=> 0x0402,
    "djcy"	=> 0x0452,
    "dlcorn"	=> 0x231E,
    "dlcrop"	=> 0x230D,
    "dollar"	=> 0x0024,
    "Dot"	=> 0x00A8,
    "dot"	=> 0x02D9,
    "DotDot"	=> 0x20DC,
    "doteq"	=> 0x2250,
    "doteqdot"	=> 0x2251,
    "DotEqual"	=> 0x2250,
    "dotminus"	=> 0x2238,
    "dotplus"	=> 0x2214,
    "dotsquare"	=> 0x22A1,
    "doublebarwedge"	=> 0x2306,
    "DoubleContourIntegral"	=> 0x222F,
    "DoubleDot"		=> 0x00A8,
    "DoubleDownArrow"	=> 0x21D3,
    "DoubleLeftArrow"	=> 0x21D0,
    "DoubleLeftRightArrow"	=> 0x21D4,
    "DoubleLeftTee"	=> 0x2AE4,
    "DoubleLongLeftArrow"	=> 0x27F8,
    "DoubleLongLeftRightArrow"	=> 0x27FA,
    "DoubleLongRightArrow"	=> 0x27F9,
    "DoubleRightArrow"	=> 0x21D2,
    "DoubleRightTee"	=> 0x22A8,
    "DoubleUpArrow"	=> 0x21D1,
    "DoubleUpDownArrow"	=> 0x21D5,
    "DoubleVerticalBar"	=> 0x2225,
    "DownArrow"		=> 0x2193,
    "Downarrow"		=> 0x21D3,
    "downarrow"		=> 0x2193,
    "DownArrowBar"	=> 0x2913,
    "DownArrowUpArrow"	=> 0x21F5,
    "DownBreve"		=> 0x0311,
    "downdownarrows"	=> 0x21CA,
    "downharpoonleft"	=> 0x21C3,
    "downharpoonright"	=> 0x21C2,
    "DownLeftRightVector"	=> 0x2950,
    "DownLeftTeeVector"	=> 0x295E,
    "DownLeftVector"	=> 0x21BD,
    "DownLeftVectorBar"	=> 0x2956,
    "DownRightTeeVector"	=> 0x295F,
    "DownRightVector"	=> 0x21C1,
    "DownRightVectorBar"	=> 0x2957,
    "DownTee"		=> 0x22A4,
    "DownTeeArrow"	=> 0x21A7,
    "drbkarow"	=> 0x2910,
    "drcorn"	=> 0x231F,
    "drcrop"	=> 0x230C,
    "DScy"	=> 0x0405,
    "dscy"	=> 0x0455,
    "dsol"	=> 0x29F6,
    "Dstrok"	=> 0x0110,
    "dstrok"	=> 0x0111,
    "dtdot"	=> 0x22F1,
    "dtri"	=> 0x25BF,
    "dtrif"	=> 0x25BE,
    "duarr"	=> 0x21F5,
    "duhar"	=> 0x296F,
    "dwangle"	=> 0x29A6,
    "DZcy"	=> 0x040F,
    "dzcy"	=> 0x045F,
    "dzigrarr"	=> 0x27FF,
    "Eacute"	=> 0x00C9,
    "eacute"	=> 0x00E9,
    "easter"	=> 0x2A6E,
    "Ecaron"	=> 0x011A,
    "ecaron"	=> 0x011B,
    "ecir"	=> 0x2256,
    "Ecirc"	=> 0x00CA,
    "ecirc"	=> 0x00EA,
    "ecolon"	=> 0x2255,
    "Ecy"	=> 0x042D,
    "ecy"	=> 0x044D,
    "eDDot"	=> 0x2A77,
    "Edot"	=> 0x0116,
    "eDot"	=> 0x2251,
    "edot"	=> 0x0117,
    "ee"	=> 0x2147,
    "efDot"	=> 0x2252,
    "eg"	=> 0x2A9A,
    "Egrave"	=> 0x00C8,
    "egrave"	=> 0x00E8,
    "egs"	=> 0x2A96,
    "egsdot"	=> 0x2A98,
    "el"	=> 0x2A99,
    "Element"	=> 0x2208,
    "elinters"	=> 0x23E7,
    "ell"	=> 0x2113,
    "els"	=> 0x2A95,
    "elsdot"	=> 0x2A97,
    "Emacr"	=> 0x0112,
    "emacr"	=> 0x0113,
    "empty"	=> 0x2205,
    "emptyset"	=> 0x2205,
    "EmptySmallSquare"	=> 0x25FB,
    "emptyv"	=> 0x2205,
    "EmptyVerySmallSquare"	=> 0x25AB,
    "emsp"	=> 0x2003,
    "emsp13"	=> 0x2004,
    "emsp14"	=> 0x2005,
    "ENG"	=> 0x014A,
    "eng"	=> 0x014B,
    "ensp"	=> 0x2002,
    "Eogon"	=> 0x0118,
    "eogon"	=> 0x0119,
    "epar"	=> 0x22D5,
    "eparsl"	=> 0x29E3,
    "eplus"	=> 0x2A71,
    "epsi"	=> 0x03B5,
    "Epsilon"	=> 0x0395,
    "epsilon"	=> 0x03B5,
    "epsiv"	=> 0x03F5,
    "eqcirc"	=> 0x2256,
    "eqcolon"	=> 0x2255,
    "eqsim"	=> 0x2242,
    "eqslantgtr"	=> 0x2A96,
    "eqslantless"	=> 0x2A95,
    "Equal"	=> 0x2A75,
    "equals"	=> 0x003D,
    "EqualTilde"	=> 0x2242,
    "equest"	=> 0x225F,
    "Equilibrium"	=> 0x21CC,
    "equiv"	=> 0x2261,
    "equivDD"	=> 0x2A78,
    "eqvparsl"	=> 0x29E5,
    "erarr"	=> 0x2971,
    "erDot"	=> 0x2253,
    "Escr"	=> 0x2130,
    "escr"	=> 0x212F,
    "esdot"	=> 0x2250,
    "Esim"	=> 0x2A73,
    "esim"	=> 0x2242,
    "Eta"	=> 0x0397,
    "eta"	=> 0x03B7,
    "ETH"	=> 0x00D0,
    "eth"	=> 0x00F0,
    "Euml"	=> 0x00CB,
    "euml"	=> 0x00EB,
    "euro"	=> 0x20AC,
    "excl"	=> 0x0021,
    "exist"	=> 0x2203,
    "Exists"	=> 0x2203,
    "expectation"	=> 0x2130,
    "ExponentialE"	=> 0x2147,
    "exponentiale"	=> 0x2147,
    "fallingdotseq"	=> 0x2252,
    "Fcy"	=> 0x0424,
    "fcy"	=> 0x0444,
    "female"	=> 0x2640,
    "ffilig"	=> 0xFB03,
    "fflig"	=> 0xFB00,
    "ffllig"	=> 0xFB04,
    "filig"	=> 0xFB01,
    "FilledSmallSquare"	=> 0x25FC,
    "FilledVerySmallSquare"	=> 0x25AA,
    "flat"	=> 0x266D,
    "fllig"	=> 0xFB02,
    "fltns"	=> 0x25B1,
    "fnof"	=> 0x0192,
    "ForAll"	=> 0x2200,
    "forall"	=> 0x2200,
    "fork"	=> 0x22D4,
    "forkv"	=> 0x2AD9,
    "Fouriertrf"	=> 0x2131,
    "fpartint"	=> 0x2A0D,
    "frac12"	=> 0x00BD,
    "frac13"	=> 0x2153,
    "frac14"	=> 0x00BC,
    "frac15"	=> 0x2155,
    "frac16"	=> 0x2159,
    "frac18"	=> 0x215B,
    "frac23"	=> 0x2154,
    "frac25"	=> 0x2156,
    "frac34"	=> 0x00BE,
    "frac35"	=> 0x2157,
    "frac38"	=> 0x215C,
    "frac45"	=> 0x2158,
    "frac56"	=> 0x215A,
    "frac58"	=> 0x215D,
    "frac78"	=> 0x215E,
    "frasl"	=> 0x2044,
    "frown"	=> 0x2322,
    "Fscr"	=> 0x2131,
    "gacute"	=> 0x01F5,
    "Gamma"	=> 0x0393,
    "gamma"	=> 0x03B3,
    "Gammad"	=> 0x03DC,
    "gammad"	=> 0x03DD,
    "gap"	=> 0x2A86,
    "Gbreve"	=> 0x011E,
    "gbreve"	=> 0x011F,
    "Gcedil"	=> 0x0122,
    "Gcirc"	=> 0x011C,
    "gcirc"	=> 0x011D,
    "Gcy"	=> 0x0413,
    "gcy"	=> 0x0433,
    "Gdot"	=> 0x0120,
    "gdot"	=> 0x0121,
    "gE"	=> 0x2267,
    "ge"	=> 0x2265,
    "gEl"	=> 0x2A8C,
    "gel"	=> 0x22DB,
    "geq"	=> 0x2265,
    "geqq"	=> 0x2267,
    "geqslant"	=> 0x2A7E,
    "ges"	=> 0x2A7E,
    "gescc"	=> 0x2AA9,
    "gesdot"	=> 0x2A80,
    "gesdoto"	=> 0x2A82,
    "gesdotol"	=> 0x2A84,
    "gesles"	=> 0x2A94,
    "Gg"	=> 0x22D9,
    "gg"	=> 0x226B,
    "ggg"	=> 0x22D9,
    "gimel"	=> 0x2137,
    "GJcy"	=> 0x0403,
    "gjcy"	=> 0x0453,
    "gl"	=> 0x2277,
    "gla"	=> 0x2AA5,
    "glE"	=> 0x2A92,
    "glj"	=> 0x2AA4,
    "gnap"	=> 0x2A8A,
    "gnapprox"	=> 0x2A8A,
    "gnE"	=> 0x2269,
    "gne"	=> 0x2A88,
    "gneq"	=> 0x2A88,
    "gneqq"	=> 0x2269,
    "gnsim"	=> 0x22E7,
    "grave"	=> 0x0060,
    "GreaterEqual"	=> 0x2265,
    "GreaterEqualLess"	=> 0x22DB,
    "GreaterFullEqual"	=> 0x2267,
    "GreaterGreater"	=> 0x2AA2,
    "GreaterLess"	=> 0x2277,
    "GreaterSlantEqual"	=> 0x2A7E,
    "GreaterTilde"	=> 0x2273,
    "gscr"	=> 0x210A,
    "gsim"	=> 0x2273,
    "gsime"	=> 0x2A8E,
    "gsiml"	=> 0x2A90,
    "GT"	=> 0x003E,
    "Gt"	=> 0x226B,
    "gt"	=> 0x003E,
    "gtcc"	=> 0x2AA7,
    "gtcir"	=> 0x2A7A,
    "gtdot"	=> 0x22D7,
    "gtlPar"	=> 0x2995,
    "gtquest"	=> 0x2A7C,
    "gtrapprox"	=> 0x2A86,
    "gtrarr"	=> 0x2978,
    "gtrdot"	=> 0x22D7,
    "gtreqless"	=> 0x22DB,
    "gtreqqless"	=> 0x2A8C,
    "gtrless"	=> 0x2277,
    "gtrsim"	=> 0x2273,
    "Hacek"	=> 0x02C7,
    "hairsp"	=> 0x200A,
    "half"	=> 0x00BD,
    "hamilt"	=> 0x210B,
    "HARDcy"	=> 0x042A,
    "hardcy"	=> 0x044A,
    "hArr"	=> 0x21D4,
    "harr"	=> 0x2194,
    "harrcir"	=> 0x2948,
    "harrw"	=> 0x21AD,
    "Hat"	=> 0x005E,
    "hbar"	=> 0x210F,
    "Hcirc"	=> 0x0124,
    "hcirc"	=> 0x0125,
    "hearts"	=> 0x2665,
    "heartsuit"	=> 0x2665,
    "hellip"	=> 0x2026,
    "hercon"	=> 0x22B9,
    "Hfr"	=> 0x210C,
    "HilbertSpace"	=> 0x210B,
    "hksearow"	=> 0x2925,
    "hkswarow"	=> 0x2926,
    "hoarr"	=> 0x21FF,
    "homtht"	=> 0x223B,
    "hookleftarrow"	=> 0x21A9,
    "hookrightarrow"	=> 0x21AA,
    "Hopf"	=> 0x210D,
    "horbar"	=> 0x2015,
    "HorizontalLine"	=> 0x2500,
    "Hscr"	=> 0x210B,
    "hslash"	=> 0x210F,
    "Hstrok"	=> 0x0126,
    "hstrok"	=> 0x0127,
    "HumpDownHump"	=> 0x224E,
    "HumpEqual"	=> 0x224F,
    "hybull"	=> 0x2043,
    "hyphen"	=> 0x2010,
    "Iacute"	=> 0x00CD,
    "iacute"	=> 0x00ED,
    "ic"	=> 0x2063,
    "Icirc"	=> 0x00CE,
    "icirc"	=> 0x00EE,
    "Icy"	=> 0x0418,
    "icy"	=> 0x0438,
    "Idot"	=> 0x0130,
    "IEcy"	=> 0x0415,
    "iecy"	=> 0x0435,
    "iexcl"	=> 0x00A1,
    "iff"	=> 0x21D4,
    "Ifr"	=> 0x2111,
    "Igrave"	=> 0x00CC,
    "igrave"	=> 0x00EC,
    "ii"	=> 0x2148,
    "iiiint"	=> 0x2A0C,
    "iiint"	=> 0x222D,
    "iinfin"	=> 0x29DC,
    "iiota"	=> 0x2129,
    "IJlig"	=> 0x0132,
    "ijlig"	=> 0x0133,
    "Im"	=> 0x2111,
    "Imacr"	=> 0x012A,
    "imacr"	=> 0x012B,
    "image"	=> 0x2111,
    "ImaginaryI"	=> 0x2148,
    "imagline"	=> 0x2110,
    "imagpart"	=> 0x2111,
    "imath"	=> 0x0131,
    "imof"	=> 0x22B7,
    "imped"	=> 0x01B5,
    "Implies"	=> 0x21D2,
    "in"	=> 0x2208,
    "incare"	=> 0x2105,
    "infin"	=> 0x221E,
    "infintie"	=> 0x29DD,
    "inodot"	=> 0x0131,
    "Int"	=> 0x222C,
    "int"	=> 0x222B,
    "intcal"	=> 0x22BA,
    "integers"	=> 0x2124,
    "Integral"	=> 0x222B,
    "intercal"	=> 0x22BA,
    "Intersection"	=> 0x22C2,
    "intlarhk"	=> 0x2A17,
    "intprod"	=> 0x2A3C,
    "InvisibleComma"	=> 0x2063,
    "InvisibleTimes"	=> 0x2062,
    "IOcy"	=> 0x0401,
    "iocy"	=> 0x0451,
    "Iogon"	=> 0x012E,
    "iogon"	=> 0x012F,
    "Iota"	=> 0x0399,
    "iota"	=> 0x03B9,
    "iprod"	=> 0x2A3C,
    "iquest"	=> 0x00BF,
    "Iscr"	=> 0x2110,
    "isin"	=> 0x2208,
    "isindot"	=> 0x22F5,
    "isinE"	=> 0x22F9,
    "isins"	=> 0x22F4,
    "isinsv"	=> 0x22F3,
    "isinv"	=> 0x2208,
    "it"	=> 0x2062,
    "Itilde"	=> 0x0128,
    "itilde"	=> 0x0129,
    "Iukcy"	=> 0x0406,
    "iukcy"	=> 0x0456,
    "Iuml"	=> 0x00CF,
    "iuml"	=> 0x00EF,
    "Jcirc"	=> 0x0134,
    "jcirc"	=> 0x0135,
    "Jcy"	=> 0x0419,
    "jcy"	=> 0x0439,
    "jmath"	=> 0x0237,
    "Jsercy"	=> 0x0408,
    "jsercy"	=> 0x0458,
    "Jukcy"	=> 0x0404,
    "jukcy"	=> 0x0454,
    "Kappa"	=> 0x039A,
    "kappa"	=> 0x03BA,
    "kappav"	=> 0x03F0,
    "Kcedil"	=> 0x0136,
    "kcedil"	=> 0x0137,
    "Kcy"	=> 0x041A,
    "kcy"	=> 0x043A,
    "kgreen"	=> 0x0138,
    "KHcy"	=> 0x0425,
    "khcy"	=> 0x0445,
    "KJcy"	=> 0x040C,
    "kjcy"	=> 0x045C,
    "lAarr"	=> 0x21DA,
    "Lacute"	=> 0x0139,
    "lacute"	=> 0x013A,
    "laemptyv"	=> 0x29B4,
    "lagran"	=> 0x2112,
    "Lambda"	=> 0x039B,
    "lambda"	=> 0x03BB,
    "Lang"	=> 0x27EA,
    "lang"	=> 0x27E8,
    "langd"	=> 0x2991,
    "langle"	=> 0x27E8,
    "lap"	=> 0x2A85,
    "Laplacetrf"	=> 0x2112,
    "laquo"	=> 0x00AB,
    "Larr"	=> 0x219E,
    "lArr"	=> 0x21D0,
    "larr"	=> 0x2190,
    "larrb"	=> 0x21E4,
    "larrbfs"	=> 0x291F,
    "larrfs"	=> 0x291D,
    "larrhk"	=> 0x21A9,
    "larrlp"	=> 0x21AB,
    "larrpl"	=> 0x2939,
    "larrsim"	=> 0x2973,
    "larrtl"	=> 0x21A2,
    "lat"	=> 0x2AAB,
    "lAtail"	=> 0x291B,
    "latail"	=> 0x2919,
    "late"	=> 0x2AAD,
    "lBarr"	=> 0x290E,
    "lbarr"	=> 0x290C,
    "lbbrk"	=> 0x2772,
    "lbrace"	=> 0x007B,
    "lbrack"	=> 0x005B,
    "lbrke"	=> 0x298B,
    "lbrksld"	=> 0x298F,
    "lbrkslu"	=> 0x298D,
    "Lcaron"	=> 0x013D,
    "lcaron"	=> 0x013E,
    "Lcedil"	=> 0x013B,
    "lcedil"	=> 0x013C,
    "lceil"	=> 0x2308,
    "lcub"	=> 0x007B,
    "Lcy"	=> 0x041B,
    "lcy"	=> 0x043B,
    "ldca"	=> 0x2936,
    "ldquo"	=> 0x201C,
    "ldquor"	=> 0x201E,
    "ldrdhar"	=> 0x2967,
    "ldrushar"	=> 0x294B,
    "ldsh"	=> 0x21B2,
    "lE"	=> 0x2266,
    "le"	=> 0x2264,
    "LeftAngleBracket"	=> 0x27E8,
    "LeftArrow"	=> 0x2190,
    "Leftarrow"	=> 0x21D0,
    "leftarrow"	=> 0x2190,
    "LeftArrowBar"	=> 0x21E4,
    "LeftArrowRightArrow"	=> 0x21C6,
    "leftarrowtail"	=> 0x21A2,
    "LeftCeiling"	=> 0x2308,
    "LeftDoubleBracket"	=> 0x27E6,
    "LeftDownTeeVector"	=> 0x2961,
    "LeftDownVector"	=> 0x21C3,
    "LeftDownVectorBar"	=> 0x2959,
    "LeftFloor"		=> 0x230A,
    "leftharpoondown"	=> 0x21BD,
    "leftharpoonup"	=> 0x21BC,
    "leftleftarrows"	=> 0x21C7,
    "LeftRightArrow"	=> 0x2194,
    "Leftrightarrow"	=> 0x21D4,
    "leftrightarrow"	=> 0x2194,
    "leftrightarrows"	=> 0x21C6,
    "leftrightharpoons"	=> 0x21CB,
    "leftrightsquigarrow"	=> 0x21AD,
    "LeftRightVector"	=> 0x294E,
    "LeftTee"		=> 0x22A3,
    "LeftTeeArrow"	=> 0x21A4,
    "LeftTeeVector"	=> 0x295A,
    "leftthreetimes"	=> 0x22CB,
    "LeftTriangle"	=> 0x22B2,
    "LeftTriangleBar"	=> 0x29CF,
    "LeftTriangleEqual"	=> 0x22B4,
    "LeftUpDownVector"	=> 0x2951,
    "LeftUpTeeVector"	=> 0x2960,
    "LeftUpVector"	=> 0x21BF,
    "LeftUpVectorBar"	=> 0x2958,
    "LeftVector"	=> 0x21BC,
    "LeftVectorBar"	=> 0x2952,
    "lEg"	=> 0x2A8B,
    "leg"	=> 0x22DA,
    "leq"	=> 0x2264,
    "leqq"	=> 0x2266,
    "leqslant"	=> 0x2A7D,
    "les"	=> 0x2A7D,
    "lescc"	=> 0x2AA8,
    "lesdot"	=> 0x2A7F,
    "lesdoto"	=> 0x2A81,
    "lesdotor"	=> 0x2A83,
    "lesges"	=> 0x2A93,
    "lessapprox"	=> 0x2A85,
    "lessdot"	=> 0x22D6,
    "lesseqgtr"	=> 0x22DA,
    "lesseqqgtr"	=> 0x2A8B,
    "LessEqualGreater"	=> 0x22DA,
    "LessFullEqual"	=> 0x2266,
    "LessGreater"	=> 0x2276,
    "lessgtr"	=> 0x2276,
    "LessLess"	=> 0x2AA1,
    "lesssim"	=> 0x2272,
    "LessSlantEqual"	=> 0x2A7D,
    "LessTilde"	=> 0x2272,
    "lfisht"	=> 0x297C,
    "lfloor"	=> 0x230A,
    "lg"	=> 0x2276,
    "lgE"	=> 0x2A91,
    "lHar"	=> 0x2962,
    "lhard"	=> 0x21BD,
    "lharu"	=> 0x21BC,
    "lharul"	=> 0x296A,
    "lhblk"	=> 0x2584,
    "LJcy"	=> 0x0409,
    "ljcy"	=> 0x0459,
    "Ll"	=> 0x22D8,
    "ll"	=> 0x226A,
    "llarr"	=> 0x21C7,
    "llcorner"	=> 0x231E,
    "Lleftarrow"	=> 0x21DA,
    "llhard"	=> 0x296B,
    "lltri"	=> 0x25FA,
    "Lmidot"	=> 0x013F,
    "lmidot"	=> 0x0140,
    "lmoust"	=> 0x23B0,
    "lmoustache"	=> 0x23B0,
    "lnap"	=> 0x2A89,
    "lnapprox"	=> 0x2A89,
    "lnE"	=> 0x2268,
    "lne"	=> 0x2A87,
    "lneq"	=> 0x2A87,
    "lneqq"	=> 0x2268,
    "lnsim"	=> 0x22E6,
    "loang"	=> 0x27EC,
    "loarr"	=> 0x21FD,
    "lobrk"	=> 0x27E6,
    "LongLeftArrow"	=> 0x27F5,
    "Longleftarrow"	=> 0x27F8,
    "longleftarrow"	=> 0x27F5,
    "LongLeftRightArrow"	=> 0x27F7,
    "Longleftrightarrow"	=> 0x27FA,
    "longleftrightarrow"	=> 0x27F7,
    "longmapsto"	=> 0x27FC,
    "LongRightArrow"	=> 0x27F6,
    "Longrightarrow"	=> 0x27F9,
    "longrightarrow"	=> 0x27F6,
    "looparrowleft"	=> 0x21AB,
    "looparrowright"	=> 0x21AC,
    "lopar"	=> 0x2985,
    "loplus"	=> 0x2A2D,
    "lotimes"	=> 0x2A34,
    "lowast"	=> 0x2217,
    "lowbar"	=> 0x005F,
    "LowerLeftArrow"	=> 0x2199,
    "LowerRightArrow"	=> 0x2198,
    "loz"	=> 0x25CA,
    "lozenge"	=> 0x25CA,
    "lozf"	=> 0x29EB,
    "lpar"	=> 0x0028,
    "lparlt"	=> 0x2993,
    "lrarr"	=> 0x21C6,
    "lrcorner"	=> 0x231F,
    "lrhar"	=> 0x21CB,
    "lrhard"	=> 0x296D,
    "lrm"	=> 0x200E,
    "lrtri"	=> 0x22BF,
    "lsaquo"	=> 0x2039,
    "Lscr"	=> 0x2112,
    "Lsh"	=> 0x21B0,
    "lsh"	=> 0x21B0,
    "lsim"	=> 0x2272,
    "lsime"	=> 0x2A8D,
    "lsimg"	=> 0x2A8F,
    "lsqb"	=> 0x005B,
    "lsquo"	=> 0x2018,
    "lsquor"	=> 0x201A,
    "Lstrok"	=> 0x0141,
    "lstrok"	=> 0x0142,
    "LT"	=> 0x003C,
    "Lt"	=> 0x226A,
    "lt"	=> 0x003C,
    "ltcc"	=> 0x2AA6,
    "ltcir"	=> 0x2A79,
    "ltdot"	=> 0x22D6,
    "lthree"	=> 0x22CB,
    "ltimes"	=> 0x22C9,
    "ltlarr"	=> 0x2976,
    "ltquest"	=> 0x2A7B,
    "ltri"	=> 0x25C3,
    "ltrie"	=> 0x22B4,
    "ltrif"	=> 0x25C2,
    "ltrPar"	=> 0x2996,
    "lurdshar"	=> 0x294A,
    "luruhar"	=> 0x2966,
    "macr"	=> 0x00AF,
    "male"	=> 0x2642,
    "malt"	=> 0x2720,
    "maltese"	=> 0x2720,
    "Map"	=> 0x2905,
    "map"	=> 0x21A6,
    "mapsto"	=> 0x21A6,
    "mapstodown"	=> 0x21A7,
    "mapstoleft"	=> 0x21A4,
    "mapstoup"	=> 0x21A5,
    "marker"	=> 0x25AE,
    "mcomma"	=> 0x2A29,
    "Mcy"	=> 0x041C,
    "mcy"	=> 0x043C,
    "mdash"	=> 0x2014,
    "mDDot"	=> 0x223A,
    "measuredangle"	=> 0x2221,
    "MediumSpace"	=> 0x205F,
    "Mellintrf"	=> 0x2133,
    "mho"	=> 0x2127,
    "micro"	=> 0x00B5,
    "mid"	=> 0x2223,
    "midast"	=> 0x002A,
    "midcir"	=> 0x2AF0,
    "middot"	=> 0x00B7,
    "minus"	=> 0x2212,
    "minusb"	=> 0x229F,
    "minusd"	=> 0x2238,
    "minusdu"	=> 0x2A2A,
    "MinusPlus"	=> 0x2213,
    "mlcp"	=> 0x2ADB,
    "mldr"	=> 0x2026,
    "mnplus"	=> 0x2213,
    "models"	=> 0x22A7,
    "mp"	=> 0x2213,
    "Mscr"	=> 0x2133,
    "mstpos"	=> 0x223E,
    "Mu"	=> 0x039C,
    "mu"	=> 0x03BC,
    "multimap"	=> 0x22B8,
    "mumap"	=> 0x22B8,
    "nabla"	=> 0x2207,
    "Nacute"	=> 0x0143,
    "nacute"	=> 0x0144,
    "nap"	=> 0x2249,
    "napos"	=> 0x0149,
    "napprox"	=> 0x2249,
    "natur"	=> 0x266E,
    "natural"	=> 0x266E,
    "naturals"	=> 0x2115,
    "nbsp"	=> 0x00A0,
    "ncap"	=> 0x2A43,
    "Ncaron"	=> 0x0147,
    "ncaron"	=> 0x0148,
    "Ncedil"	=> 0x0145,
    "ncedil"	=> 0x0146,
    "ncong"	=> 0x2247,
    "ncup"	=> 0x2A42,
    "Ncy"	=> 0x041D,
    "ncy"	=> 0x043D,
    "ndash"	=> 0x2013,
    "ne"	=> 0x2260,
    "nearhk"	=> 0x2924,
    "neArr"	=> 0x21D7,
    "nearr"	=> 0x2197,
    "nearrow"	=> 0x2197,
    "NegativeMediumSpace"	=> 0x200B,
    "NegativeThickSpace"	=> 0x200B,
    "NegativeThinSpace"	=> 0x200B,
    "NegativeVeryThinSpace"	=> 0x200B,
    "nequiv"	=> 0x2262,
    "nesear"	=> 0x2928,
    "NestedGreaterGreater"	=> 0x226B,
    "NestedLessLess"	=> 0x226A,
    "NewLine"	=> 0x000A,
    "nexist"	=> 0x2204,
    "nexists"	=> 0x2204,
    "nge"	=> 0x2271,
    "ngeq"	=> 0x2271,
    "ngsim"	=> 0x2275,
    "ngt"	=> 0x226F,
    "ngtr"	=> 0x226F,
    "nhArr"	=> 0x21CE,
    "nharr"	=> 0x21AE,
    "nhpar"	=> 0x2AF2,
    "ni"	=> 0x220B,
    "nis"	=> 0x22FC,
    "nisd"	=> 0x22FA,
    "niv"	=> 0x220B,
    "NJcy"	=> 0x040A,
    "njcy"	=> 0x045A,
    "nlArr"	=> 0x21CD,
    "nlarr"	=> 0x219A,
    "nldr"	=> 0x2025,
    "nle"	=> 0x2270,
    "nLeftarrow"	=> 0x21CD,
    "nleftarrow"	=> 0x219A,
    "nLeftrightarrow"	=> 0x21CE,
    "nleftrightarrow"	=> 0x21AE,
    "nleq"	=> 0x2270,
    "nless"	=> 0x226E,
    "nlsim"	=> 0x2274,
    "nlt"	=> 0x226E,
    "nltri"	=> 0x22EA,
    "nltrie"	=> 0x22EC,
    "nmid"	=> 0x2224,
    "NoBreak"	=> 0x2060,
    "NonBreakingSpace"	=> 0x00A0,
    "Nopf"	=> 0x2115,
    "Not"	=> 0x2AEC,
    "not"	=> 0x00AC,
    "NotCongruent"	=> 0x2262,
    "NotCupCap"	=> 0x226D,
    "NotDoubleVerticalBar"	=> 0x2226,
    "NotElement"	=> 0x2209,
    "NotEqual"	=> 0x2260,
    "NotExists"	=> 0x2204,
    "NotGreater"	=> 0x226F,
    "NotGreaterEqual"	=> 0x2271,
    "NotGreaterLess"	=> 0x2279,
    "NotGreaterTilde"	=> 0x2275,
    "notin"	=> 0x2209,
    "notinva"	=> 0x2209,
    "notinvb"	=> 0x22F7,
    "notinvc"	=> 0x22F6,
    "NotLeftTriangle"	=> 0x22EA,
    "NotLeftTriangleEqual"	=> 0x22EC,
    "NotLess"	=> 0x226E,
    "NotLessEqual"	=> 0x2270,
    "NotLessGreater"	=> 0x2278,
    "NotLessTilde"	=> 0x2274,
    "notni"	=> 0x220C,
    "notniva"	=> 0x220C,
    "notnivb"	=> 0x22FE,
    "notnivc"	=> 0x22FD,
    "NotPrecedes"	=> 0x2280,
    "NotPrecedesSlantEqual"	=> 0x22E0,
    "NotReverseElement"	=> 0x220C,
    "NotRightTriangle"	=> 0x22EB,
    "NotRightTriangleEqual"	=> 0x22ED,
    "NotSquareSubsetEqual"	=> 0x22E2,
    "NotSquareSupersetEqual"	=> 0x22E3,
    "NotSubsetEqual"	=> 0x2288,
    "NotSucceeds"	=> 0x2281,
    "NotSucceedsSlantEqual"	=> 0x22E1,
    "NotSupersetEqual"	=> 0x2289,
    "NotTilde"	=> 0x2241,
    "NotTildeEqual"	=> 0x2244,
    "NotTildeFullEqual"	=> 0x2247,
    "NotTildeTilde"	=> 0x2249,
    "NotVerticalBar"	=> 0x2224,
    "npar"	=> 0x2226,
    "nparallel"	=> 0x2226,
    "npolint"	=> 0x2A14,
    "npr"	=> 0x2280,
    "nprcue"	=> 0x22E0,
    "nprec"	=> 0x2280,
    "nrArr"	=> 0x21CF,
    "nrarr"	=> 0x219B,
    "nRightarrow"	=> 0x21CF,
    "nrightarrow"	=> 0x219B,
    "nrtri"	=> 0x22EB,
    "nrtrie"	=> 0x22ED,
    "nsc"	=> 0x2281,
    "nsccue"	=> 0x22E1,
    "nshortmid"	=> 0x2224,
    "nshortparallel"	=> 0x2226,
    "nsim"	=> 0x2241,
    "nsime"	=> 0x2244,
    "nsimeq"	=> 0x2244,
    "nsmid"	=> 0x2224,
    "nspar"	=> 0x2226,
    "nsqsube"	=> 0x22E2,
    "nsqsupe"	=> 0x22E3,
    "nsub"	=> 0x2284,
    "nsube"	=> 0x2288,
    "nsubseteq"	=> 0x2288,
    "nsucc"	=> 0x2281,
    "nsup"	=> 0x2285,
    "nsupe"	=> 0x2289,
    "nsupseteq"	=> 0x2289,
    "ntgl"	=> 0x2279,
    "Ntilde"	=> 0x00D1,
    "ntilde"	=> 0x00F1,
    "ntlg"	=> 0x2278,
    "ntriangleleft"	=> 0x22EA,
    "ntrianglelefteq"	=> 0x22EC,
    "ntriangleright"	=> 0x22EB,
    "ntrianglerighteq"	=> 0x22ED,
    "Nu"	=> 0x039D,
    "nu"	=> 0x03BD,
    "num"	=> 0x0023,
    "numero"	=> 0x2116,
    "numsp"	=> 0x2007,
    "nVDash"	=> 0x22AF,
    "nVdash"	=> 0x22AE,
    "nvDash"	=> 0x22AD,
    "nvdash"	=> 0x22AC,
    "nvHarr"	=> 0x2904,
    "nvinfin"	=> 0x29DE,
    "nvlArr"	=> 0x2902,
    "nvrArr"	=> 0x2903,
    "nwarhk"	=> 0x2923,
    "nwArr"	=> 0x21D6,
    "nwarr"	=> 0x2196,
    "nwarrow"	=> 0x2196,
    "nwnear"	=> 0x2927,
    "Oacute"	=> 0x00D3,
    "oacute"	=> 0x00F3,
    "oast"	=> 0x229B,
    "ocir"	=> 0x229A,
    "Ocirc"	=> 0x00D4,
    "ocirc"	=> 0x00F4,
    "Ocy"	=> 0x041E,
    "ocy"	=> 0x043E,
    "odash"	=> 0x229D,
    "Odblac"	=> 0x0150,
    "odblac"	=> 0x0151,
    "odiv"	=> 0x2A38,
    "odot"	=> 0x2299,
    "odsold"	=> 0x29BC,
    "OElig"	=> 0x0152,
    "oelig"	=> 0x0153,
    "ofcir"	=> 0x29BF,
    "ogon"	=> 0x02DB,
    "Ograve"	=> 0x00D2,
    "ograve"	=> 0x00F2,
    "ogt"	=> 0x29C1,
    "ohbar"	=> 0x29B5,
    "ohm"	=> 0x03A9,
    "oint"	=> 0x222E,
    "olarr"	=> 0x21BA,
    "olcir"	=> 0x29BE,
    "olcross"	=> 0x29BB,
    "oline"	=> 0x203E,
    "olt"	=> 0x29C0,
    "Omacr"	=> 0x014C,
    "omacr"	=> 0x014D,
    "Omega"	=> 0x03A9,
    "omega"	=> 0x03C9,
    "Omicron"	=> 0x039F,
    "omicron"	=> 0x03BF,
    "omid"	=> 0x29B6,
    "ominus"	=> 0x2296,
    "opar"	=> 0x29B7,
    "OpenCurlyDoubleQuote"	=> 0x201C,
    "OpenCurlyQuote"	=> 0x2018,
    "operp"	=> 0x29B9,
    "oplus"	=> 0x2295,
    "Or"	=> 0x2A54,
    "or"	=> 0x2228,
    "orarr"	=> 0x21BB,
    "ord"	=> 0x2A5D,
    "order"	=> 0x2134,
    "orderof"	=> 0x2134,
    "ordf"	=> 0x00AA,
    "ordm"	=> 0x00BA,
    "origof"	=> 0x22B6,
    "oror"	=> 0x2A56,
    "orslope"	=> 0x2A57,
    "orv"	=> 0x2A5B,
    "oS"	=> 0x24C8,
    "oscr"	=> 0x2134,
    "Oslash"	=> 0x00D8,
    "oslash"	=> 0x00F8,
    "osol"	=> 0x2298,
    "Otilde"	=> 0x00D5,
    "otilde"	=> 0x00F5,
    "Otimes"	=> 0x2A37,
    "otimes"	=> 0x2297,
    "otimesas"	=> 0x2A36,
    "Ouml"	=> 0x00D6,
    "ouml"	=> 0x00F6,
    "ovbar"	=> 0x233D,
    "OverBar"	=> 0x203E,
    "OverBrace"	=> 0x23DE,
    "OverBracket"	=> 0x23B4,
    "OverParenthesis"	=> 0x23DC,
    "par"	=> 0x2225,
    "para"	=> 0x00B6,
    "parallel"	=> 0x2225,
    "parsim"	=> 0x2AF3,
    "parsl"	=> 0x2AFD,
    "part"	=> 0x2202,
    "PartialD"	=> 0x2202,
    "Pcy"	=> 0x041F,
    "pcy"	=> 0x043F,
    "percnt"	=> 0x0025,
    "period"	=> 0x002E,
    "permil"	=> 0x2030,
    "perp"	=> 0x22A5,
    "pertenk"	=> 0x2031,
    "Phi"	=> 0x03A6,
    "phi"	=> 0x03C6,
    "phiv"	=> 0x03D5,
    "phmmat"	=> 0x2133,
    "phone"	=> 0x260E,
    "Pi"	=> 0x03A0,
    "pi"	=> 0x03C0,
    "pitchfork"	=> 0x22D4,
    "piv"	=> 0x03D6,
    "planck"	=> 0x210F,
    "planckh"	=> 0x210E,
    "plankv"	=> 0x210F,
    "plus"	=> 0x002B,
    "plusacir"	=> 0x2A23,
    "plusb"	=> 0x229E,
    "pluscir"	=> 0x2A22,
    "plusdo"	=> 0x2214,
    "plusdu"	=> 0x2A25,
    "pluse"	=> 0x2A72,
    "PlusMinus"	=> 0x00B1,
    "plusmn"	=> 0x00B1,
    "plussim"	=> 0x2A26,
    "plustwo"	=> 0x2A27,
    "pm"	=> 0x00B1,
    "Poincareplane"	=> 0x210C,
    "pointint"	=> 0x2A15,
    "Popf"	=> 0x2119,
    "pound"	=> 0x00A3,
    "Pr"	=> 0x2ABB,
    "pr"	=> 0x227A,
    "prap"	=> 0x2AB7,
    "prcue"	=> 0x227C,
    "prE"	=> 0x2AB3,
    "pre"	=> 0x2AAF,
    "prec"	=> 0x227A,
    "precapprox"	=> 0x2AB7,
    "preccurlyeq"	=> 0x227C,
    "Precedes"		=> 0x227A,
    "PrecedesEqual"	=> 0x2AAF,
    "PrecedesSlantEqual"	=> 0x227C,
    "PrecedesTilde"	=> 0x227E,
    "preceq"		=> 0x2AAF,
    "precnapprox"	=> 0x2AB9,
    "precneqq"	=> 0x2AB5,
    "precnsim"	=> 0x22E8,
    "precsim"	=> 0x227E,
    "Prime"	=> 0x2033,
    "prime"	=> 0x2032,
    "primes"	=> 0x2119,
    "prnap"	=> 0x2AB9,
    "prnE"	=> 0x2AB5,
    "prnsim"	=> 0x22E8,
    "prod"	=> 0x220F,
    "Product"	=> 0x220F,
    "profalar"	=> 0x232E,
    "profline"	=> 0x2312,
    "profsurf"	=> 0x2313,
    "prop"	=> 0x221D,
    "Proportion"	=> 0x2237,
    "Proportional"	=> 0x221D,
    "propto"	=> 0x221D,
    "prsim"	=> 0x227E,
    "prurel"	=> 0x22B0,
    "Psi"	=> 0x03A8,
    "psi"	=> 0x03C8,
    "puncsp"	=> 0x2008,
    "qint"	=> 0x2A0C,
    "Qopf"	=> 0x211A,
    "qprime"	=> 0x2057,
    "quaternions"	=> 0x210D,
    "quatint"	=> 0x2A16,
    "quest"	=> 0x003F,
    "questeq"	=> 0x225F,
    "QUOT"	=> 0x0022,
    "quot"	=> 0x0022,
    "rAarr"	=> 0x21DB,
    "Racute"	=> 0x0154,
    "racute"	=> 0x0155,
    "radic"	=> 0x221A,
    "raemptyv"	=> 0x29B3,
    "Rang"	=> 0x27EB,
    "rang"	=> 0x27E9,
    "rangd"	=> 0x2992,
    "range"	=> 0x29A5,
    "rangle"	=> 0x27E9,
    "raquo"	=> 0x00BB,
    "Rarr"	=> 0x21A0,
    "rArr"	=> 0x21D2,
    "rarr"	=> 0x2192,
    "rarrap"	=> 0x2975,
    "rarrb"	=> 0x21E5,
    "rarrbfs"	=> 0x2920,
    "rarrc"	=> 0x2933,
    "rarrfs"	=> 0x291E,
    "rarrhk"	=> 0x21AA,
    "rarrlp"	=> 0x21AC,
    "rarrpl"	=> 0x2945,
    "rarrsim"	=> 0x2974,
    "Rarrtl"	=> 0x2916,
    "rarrtl"	=> 0x21A3,
    "rarrw"	=> 0x219D,
    "rAtail"	=> 0x291C,
    "ratail"	=> 0x291A,
    "ratio"	=> 0x2236,
    "rationals"	=> 0x211A,
    "RBarr"	=> 0x2910,
    "rBarr"	=> 0x290F,
    "rbarr"	=> 0x290D,
    "rbbrk"	=> 0x2773,
    "rbrace"	=> 0x007D,
    "rbrack"	=> 0x005D,
    "rbrke"	=> 0x298C,
    "rbrksld"	=> 0x298E,
    "rbrkslu"	=> 0x2990,
    "Rcaron"	=> 0x0158,
    "rcaron"	=> 0x0159,
    "Rcedil"	=> 0x0156,
    "rcedil"	=> 0x0157,
    "rceil"	=> 0x2309,
    "rcub"	=> 0x007D,
    "Rcy"	=> 0x0420,
    "rcy"	=> 0x0440,
    "rdca"	=> 0x2937,
    "rdldhar"	=> 0x2969,
    "rdquo"	=> 0x201D,
    "rdquor"	=> 0x201D,
    "rdsh"	=> 0x21B3,
    "Re"	=> 0x211C,
    "real"	=> 0x211C,
    "realine"	=> 0x211B,
    "realpart"	=> 0x211C,
    "reals"	=> 0x211D,
    "rect"	=> 0x25AD,
    "REG"	=> 0x00AE,
    "reg"	=> 0x00AE,
    "ReverseElement"	=> 0x220B,
    "ReverseEquilibrium"	=> 0x21CB,
    "ReverseUpEquilibrium"	=> 0x296F,
    "rfisht"	=> 0x297D,
    "rfloor"	=> 0x230B,
    "Rfr"	=> 0x211C,
    "rHar"	=> 0x2964,
    "rhard"	=> 0x21C1,
    "rharu"	=> 0x21C0,
    "rharul"	=> 0x296C,
    "Rho"	=> 0x03A1,
    "rho"	=> 0x03C1,
    "rhov"	=> 0x03F1,
    "RightAngleBracket"	=> 0x27E9,
    "RightArrow"	=> 0x2192,
    "Rightarrow"	=> 0x21D2,
    "rightarrow"	=> 0x2192,
    "RightArrowBar"	=> 0x21E5,
    "RightArrowLeftArrow"	=> 0x21C4,
    "rightarrowtail"	=> 0x21A3,
    "RightCeiling"	=> 0x2309,
    "RightDoubleBracket"	=> 0x27E7,
    "RightDownTeeVector"	=> 0x295D,
    "RightDownVector"	=> 0x21C2,
    "RightDownVectorBar"	=> 0x2955,
    "RightFloor"	=> 0x230B,
    "rightharpoondown"	=> 0x21C1,
    "rightharpoonup"	=> 0x21C0,
    "rightleftarrows"	=> 0x21C4,
    "rightleftharpoons"	=> 0x21CC,
    "rightrightarrows"	=> 0x21C9,
    "rightsquigarrow"	=> 0x219D,
    "RightTee"		=> 0x22A2,
    "RightTeeArrow"	=> 0x21A6,
    "RightTeeVector"	=> 0x295B,
    "rightthreetimes"	=> 0x22CC,
    "RightTriangle"	=> 0x22B3,
    "RightTriangleBar"	=> 0x29D0,
    "RightTriangleEqual"	=> 0x22B5,
    "RightUpDownVector"	=> 0x294F,
    "RightUpTeeVector"	=> 0x295C,
    "RightUpVector"	=> 0x21BE,
    "RightUpVectorBar"	=> 0x2954,
    "RightVector"	=> 0x21C0,
    "RightVectorBar"	=> 0x2953,
    "ring"		=> 0x02DA,
    "risingdotseq"	=> 0x2253,
    "rlarr"	=> 0x21C4,
    "rlhar"	=> 0x21CC,
    "rlm"	=> 0x200F,
    "rmoust"	=> 0x23B1,
    "rmoustache"	=> 0x23B1,
    "rnmid"	=> 0x2AEE,
    "roang"	=> 0x27ED,
    "roarr"	=> 0x21FE,
    "robrk"	=> 0x27E7,
    "ropar"	=> 0x2986,
    "Ropf"	=> 0x211D,
    "roplus"	=> 0x2A2E,
    "rotimes"	=> 0x2A35,
    "RoundImplies"	=> 0x2970,
    "rpar"	=> 0x0029,
    "rpargt"	=> 0x2994,
    "rppolint"	=> 0x2A12,
    "rrarr"	=> 0x21C9,
    "Rrightarrow"	=> 0x21DB,
    "rsaquo"	=> 0x203A,
    "Rscr"	=> 0x211B,
    "Rsh"	=> 0x21B1,
    "rsh"	=> 0x21B1,
    "rsqb"	=> 0x005D,
    "rsquo"	=> 0x2019,
    "rsquor"	=> 0x2019,
    "rthree"	=> 0x22CC,
    "rtimes"	=> 0x22CA,
    "rtri"	=> 0x25B9,
    "rtrie"	=> 0x22B5,
    "rtrif"	=> 0x25B8,
    "rtriltri"	=> 0x29CE,
    "RuleDelayed"	=> 0x29F4,
    "ruluhar"	=> 0x2968,
    "rx"	=> 0x211E,
    "Sacute"	=> 0x015A,
    "sacute"	=> 0x015B,
    "sbquo"	=> 0x201A,
    "Sc"	=> 0x2ABC,
    "sc"	=> 0x227B,
    "scap"	=> 0x2AB8,
    "Scaron"	=> 0x0160,
    "scaron"	=> 0x0161,
    "sccue"	=> 0x227D,
    "scE"	=> 0x2AB4,
    "sce"	=> 0x2AB0,
    "Scedil"	=> 0x015E,
    "scedil"	=> 0x015F,
    "Scirc"	=> 0x015C,
    "scirc"	=> 0x015D,
    "scnap"	=> 0x2ABA,
    "scnE"	=> 0x2AB6,
    "scnsim"	=> 0x22E9,
    "scpolint"	=> 0x2A13,
    "scsim"	=> 0x227F,
    "Scy"	=> 0x0421,
    "scy"	=> 0x0441,
    "sdot"	=> 0x22C5,
    "sdotb"	=> 0x22A1,
    "sdote"	=> 0x2A66,
    "searhk"	=> 0x2925,
    "seArr"	=> 0x21D8,
    "searr"	=> 0x2198,
    "searrow"	=> 0x2198,
    "sect"	=> 0x00A7,
    "semi"	=> 0x003B,
    "seswar"	=> 0x2929,
    "setminus"	=> 0x2216,
    "setmn"	=> 0x2216,
    "sext"	=> 0x2736,
    "sfrown"	=> 0x2322,
    "sharp"	=> 0x266F,
    "SHCHcy"	=> 0x0429,
    "shchcy"	=> 0x0449,
    "SHcy"	=> 0x0428,
    "shcy"	=> 0x0448,
    "ShortDownArrow"	=> 0x2193,
    "ShortLeftArrow"	=> 0x2190,
    "shortmid"	=> 0x2223,
    "shortparallel"	=> 0x2225,
    "ShortRightArrow"	=> 0x2192,
    "ShortUpArrow"	=> 0x2191,
    "shy"	=> 0x00AD,
    "Sigma"	=> 0x03A3,
    "sigma"	=> 0x03C3,
    "sigmaf"	=> 0x03C2,
    "sigmav"	=> 0x03C2,
    "sim"	=> 0x223C,
    "simdot"	=> 0x2A6A,
    "sime"	=> 0x2243,
    "simeq"	=> 0x2243,
    "simg"	=> 0x2A9E,
    "simgE"	=> 0x2AA0,
    "siml"	=> 0x2A9D,
    "simlE"	=> 0x2A9F,
    "simne"	=> 0x2246,
    "simplus"	=> 0x2A24,
    "simrarr"	=> 0x2972,
    "slarr"	=> 0x2190,
    "SmallCircle"	=> 0x2218,
    "smallsetminus"	=> 0x2216,
    "smashp"	=> 0x2A33,
    "smeparsl"	=> 0x29E4,
    "smid"	=> 0x2223,
    "smile"	=> 0x2323,
    "smt"	=> 0x2AAA,
    "smte"	=> 0x2AAC,
    "SOFTcy"	=> 0x042C,
    "softcy"	=> 0x044C,
    "sol"	=> 0x002F,
    "solb"	=> 0x29C4,
    "solbar"	=> 0x233F,
    "spades"	=> 0x2660,
    "spadesuit"	=> 0x2660,
    "spar"	=> 0x2225,
    "sqcap"	=> 0x2293,
    "sqcup"	=> 0x2294,
    "Sqrt"	=> 0x221A,
    "sqsub"	=> 0x228F,
    "sqsube"	=> 0x2291,
    "sqsubset"	=> 0x228F,
    "sqsubseteq"	=> 0x2291,
    "sqsup"	=> 0x2290,
    "sqsupe"	=> 0x2292,
    "sqsupset"	=> 0x2290,
    "sqsupseteq"	=> 0x2292,
    "squ"	=> 0x25A1,
    "Square"	=> 0x25A1,
    "square"	=> 0x25A1,
    "SquareIntersection"	=> 0x2293,
    "SquareSubset"	=> 0x228F,
    "SquareSubsetEqual"	=> 0x2291,
    "SquareSuperset"	=> 0x2290,
    "SquareSupersetEqual"	=> 0x2292,
    "SquareUnion"	=> 0x2294,
    "squarf"	=> 0x25AA,
    "squf"	=> 0x25AA,
    "srarr"	=> 0x2192,
    "ssetmn"	=> 0x2216,
    "ssmile"	=> 0x2323,
    "sstarf"	=> 0x22C6,
    "Star"	=> 0x22C6,
    "star"	=> 0x2606,
    "starf"	=> 0x2605,
    "straightepsilon"	=> 0x03F5,
    "straightphi"	=> 0x03D5,
    "strns"	=> 0x00AF,
    "Sub"	=> 0x22D0,
    "sub"	=> 0x2282,
    "subdot"	=> 0x2ABD,
    "subE"	=> 0x2AC5,
    "sube"	=> 0x2286,
    "subedot"	=> 0x2AC3,
    "submult"	=> 0x2AC1,
    "subnE"	=> 0x2ACB,
    "subne"	=> 0x228A,
    "subplus"	=> 0x2ABF,
    "subrarr"	=> 0x2979,
    "Subset"	=> 0x22D0,
    "subset"	=> 0x2282,
    "subseteq"	=> 0x2286,
    "subseteqq"	=> 0x2AC5,
    "SubsetEqual"	=> 0x2286,
    "subsetneq"	=> 0x228A,
    "subsetneqq"	=> 0x2ACB,
    "subsim"	=> 0x2AC7,
    "subsub"	=> 0x2AD5,
    "subsup"	=> 0x2AD3,
    "succ"	=> 0x227B,
    "succapprox"	=> 0x2AB8,
    "succcurlyeq"	=> 0x227D,
    "Succeeds"		=> 0x227B,
    "SucceedsEqual"	=> 0x2AB0,
    "SucceedsSlantEqual"	=> 0x227D,
    "SucceedsTilde"	=> 0x227F,
    "succeq"		=> 0x2AB0,
    "succnapprox"	=> 0x2ABA,
    "succneqq"	=> 0x2AB6,
    "succnsim"	=> 0x22E9,
    "succsim"	=> 0x227F,
    "SuchThat"	=> 0x220B,
    "Sum"	=> 0x2211,
    "sum"	=> 0x2211,
    "sung"	=> 0x266A,
    "Sup"	=> 0x22D1,
    "sup"	=> 0x2283,
    "sup1"	=> 0x00B9,
    "sup2"	=> 0x00B2,
    "sup3"	=> 0x00B3,
    "supdot"	=> 0x2ABE,
    "supdsub"	=> 0x2AD8,
    "supE"	=> 0x2AC6,
    "supe"	=> 0x2287,
    "supedot"	=> 0x2AC4,
    "Superset"	=> 0x2283,
    "SupersetEqual"	=> 0x2287,
    "suphsol"	=> 0x27C9,
    "suphsub"	=> 0x2AD7,
    "suplarr"	=> 0x297B,
    "supmult"	=> 0x2AC2,
    "supnE"	=> 0x2ACC,
    "supne"	=> 0x228B,
    "supplus"	=> 0x2AC0,
    "Supset"	=> 0x22D1,
    "supset"	=> 0x2283,
    "supseteq"	=> 0x2287,
    "supseteqq"	=> 0x2AC6,
    "supsetneq"	=> 0x228B,
    "supsetneqq"	=> 0x2ACC,
    "supsim"	=> 0x2AC8,
    "supsub"	=> 0x2AD4,
    "supsup"	=> 0x2AD6,
    "swarhk"	=> 0x2926,
    "swArr"	=> 0x21D9,
    "swarr"	=> 0x2199,
    "swarrow"	=> 0x2199,
    "swnwar"	=> 0x292A,
    "szlig"	=> 0x00DF,
    "Tab"	=> 0x0009,
    "target"	=> 0x2316,
    "Tau"	=> 0x03A4,
    "tau"	=> 0x03C4,
    "tbrk"	=> 0x23B4,
    "Tcaron"	=> 0x0164,
    "tcaron"	=> 0x0165,
    "Tcedil"	=> 0x0162,
    "tcedil"	=> 0x0163,
    "Tcy"	=> 0x0422,
    "tcy"	=> 0x0442,
    "tdot"	=> 0x20DB,
    "telrec"	=> 0x2315,
    "there4"	=> 0x2234,
    "Therefore"	=> 0x2234,
    "therefore"	=> 0x2234,
    "Theta"	=> 0x0398,
    "theta"	=> 0x03B8,
    "thetasym"	=> 0x03D1,
    "thetav"	=> 0x03D1,
    "thickapprox"	=> 0x2248,
    "thicksim"	=> 0x223C,
    "thinsp"	=> 0x2009,
    "ThinSpace"	=> 0x2009,
    "thkap"	=> 0x2248,
    "thksim"	=> 0x223C,
    "THORN"	=> 0x00DE,
    "thorn"	=> 0x00FE,
    "Tilde"	=> 0x223C,
    "tilde"	=> 0x02DC,
    "TildeEqual"	=> 0x2243,
    "TildeFullEqual"	=> 0x2245,
    "TildeTilde"	=> 0x2248,
    "times"	=> 0x00D7,
    "timesb"	=> 0x22A0,
    "timesbar"	=> 0x2A31,
    "timesd"	=> 0x2A30,
    "tint"	=> 0x222D,
    "toea"	=> 0x2928,
    "top"	=> 0x22A4,
    "topbot"	=> 0x2336,
    "topcir"	=> 0x2AF1,
    "topfork"	=> 0x2ADA,
    "tosa"	=> 0x2929,
    "tprime"	=> 0x2034,
    "TRADE"	=> 0x2122,
    "trade"	=> 0x2122,
    "triangle"	=> 0x25B5,
    "triangledown"	=> 0x25BF,
    "triangleleft"	=> 0x25C3,
    "trianglelefteq"	=> 0x22B4,
    "triangleq"	=> 0x225C,
    "triangleright"	=> 0x25B9,
    "trianglerighteq"	=> 0x22B5,
    "tridot"	=> 0x25EC,
    "trie"	=> 0x225C,
    "triminus"	=> 0x2A3A,
    "TripleDot"	=> 0x20DB,
    "triplus"	=> 0x2A39,
    "trisb"	=> 0x29CD,
    "tritime"	=> 0x2A3B,
    "trpezium"	=> 0x23E2,
    "TScy"	=> 0x0426,
    "tscy"	=> 0x0446,
    "TSHcy"	=> 0x040B,
    "tshcy"	=> 0x045B,
    "Tstrok"	=> 0x0166,
    "tstrok"	=> 0x0167,
    "twixt"	=> 0x226C,
    "twoheadleftarrow"	=> 0x219E,
    "twoheadrightarrow"	=> 0x21A0,
    "Uacute"	=> 0x00DA,
    "uacute"	=> 0x00FA,
    "Uarr"	=> 0x219F,
    "uArr"	=> 0x21D1,
    "uarr"	=> 0x2191,
    "Uarrocir"	=> 0x2949,
    "Ubrcy"	=> 0x040E,
    "ubrcy"	=> 0x045E,
    "Ubreve"	=> 0x016C,
    "ubreve"	=> 0x016D,
    "Ucirc"	=> 0x00DB,
    "ucirc"	=> 0x00FB,
    "Ucy"	=> 0x0423,
    "ucy"	=> 0x0443,
    "udarr"	=> 0x21C5,
    "Udblac"	=> 0x0170,
    "udblac"	=> 0x0171,
    "udhar"	=> 0x296E,
    "ufisht"	=> 0x297E,
    "Ugrave"	=> 0x00D9,
    "ugrave"	=> 0x00F9,
    "uHar"	=> 0x2963,
    "uharl"	=> 0x21BF,
    "uharr"	=> 0x21BE,
    "uhblk"	=> 0x2580,
    "ulcorn"	=> 0x231C,
    "ulcorner"	=> 0x231C,
    "ulcrop"	=> 0x230F,
    "ultri"	=> 0x25F8,
    "Umacr"	=> 0x016A,
    "umacr"	=> 0x016B,
    "uml"	=> 0x00A8,
    "UnderBar"	=> 0x005F,
    "UnderBrace"	=> 0x23DF,
    "UnderBracket"	=> 0x23B5,
    "UnderParenthesis"	=> 0x23DD,
    "Union"	=> 0x22C3,
    "UnionPlus"	=> 0x228E,
    "Uogon"	=> 0x0172,
    "uogon"	=> 0x0173,
    "UpArrow"	=> 0x2191,
    "Uparrow"	=> 0x21D1,
    "uparrow"	=> 0x2191,
    "UpArrowBar"	=> 0x2912,
    "UpArrowDownArrow"	=> 0x21C5,
    "UpDownArrow"	=> 0x2195,
    "Updownarrow"	=> 0x21D5,
    "updownarrow"	=> 0x2195,
    "UpEquilibrium"	=> 0x296E,
    "upharpoonleft"	=> 0x21BF,
    "upharpoonright"	=> 0x21BE,
    "uplus"	=> 0x228E,
    "UpperLeftArrow"	=> 0x2196,
    "UpperRightArrow"	=> 0x2197,
    "Upsi"	=> 0x03D2,
    "upsi"	=> 0x03C5,
    "upsih"	=> 0x03D2,
    "Upsilon"	=> 0x03A5,
    "upsilon"	=> 0x03C5,
    "UpTee"	=> 0x22A5,
    "UpTeeArrow"	=> 0x21A5,
    "upuparrows"	=> 0x21C8,
    "urcorn"	=> 0x231D,
    "urcorner"	=> 0x231D,
    "urcrop"	=> 0x230E,
    "Uring"	=> 0x016E,
    "uring"	=> 0x016F,
    "urtri"	=> 0x25F9,
    "utdot"	=> 0x22F0,
    "Utilde"	=> 0x0168,
    "utilde"	=> 0x0169,
    "utri"	=> 0x25B5,
    "utrif"	=> 0x25B4,
    "uuarr"	=> 0x21C8,
    "Uuml"	=> 0x00DC,
    "uuml"	=> 0x00FC,
    "uwangle"	=> 0x29A7,
    "vangrt"	=> 0x299C,
    "varepsilon"	=> 0x03F5,
    "varkappa"	=> 0x03F0,
    "varnothing"	=> 0x2205,
    "varphi"	=> 0x03D5,
    "varpi"	=> 0x03D6,
    "varpropto"	=> 0x221D,
    "vArr"	=> 0x21D5,
    "varr"	=> 0x2195,
    "varrho"	=> 0x03F1,
    "varsigma"	=> 0x03C2,
    "vartheta"	=> 0x03D1,
    "vartriangleleft"	=> 0x22B2,
    "vartriangleright"	=> 0x22B3,
    "Vbar"	=> 0x2AEB,
    "vBar"	=> 0x2AE8,
    "vBarv"	=> 0x2AE9,
    "Vcy"	=> 0x0412,
    "vcy"	=> 0x0432,
    "VDash"	=> 0x22AB,
    "Vdash"	=> 0x22A9,
    "vDash"	=> 0x22A8,
    "vdash"	=> 0x22A2,
    "Vdashl"	=> 0x2AE6,
    "Vee"	=> 0x22C1,
    "vee"	=> 0x2228,
    "veebar"	=> 0x22BB,
    "veeeq"	=> 0x225A,
    "vellip"	=> 0x22EE,
    "Verbar"	=> 0x2016,
    "verbar"	=> 0x007C,
    "Vert"	=> 0x2016,
    "vert"	=> 0x007C,
    "VerticalBar"	=> 0x2223,
    "VerticalLine"	=> 0x007C,
    "VerticalSeparator"	=> 0x2758,
    "VerticalTilde"	=> 0x2240,
    "VeryThinSpace"	=> 0x200A,
    "vltri"	=> 0x22B2,
    "vprop"	=> 0x221D,
    "vrtri"	=> 0x22B3,
    "Vvdash"	=> 0x22AA,
    "vzigzag"	=> 0x299A,
    "Wcirc"	=> 0x0174,
    "wcirc"	=> 0x0175,
    "wedbar"	=> 0x2A5F,
    "Wedge"	=> 0x22C0,
    "wedge"	=> 0x2227,
    "wedgeq"	=> 0x2259,
    "weierp"	=> 0x2118,
    "wp"	=> 0x2118,
    "wr"	=> 0x2240,
    "wreath"	=> 0x2240,
    "xcap"	=> 0x22C2,
    "xcirc"	=> 0x25EF,
    "xcup"	=> 0x22C3,
    "xdtri"	=> 0x25BD,
    "xhArr"	=> 0x27FA,
    "xharr"	=> 0x27F7,
    "Xi"	=> 0x039E,
    "xi"	=> 0x03BE,
    "xlArr"	=> 0x27F8,
    "xlarr"	=> 0x27F5,
    "xmap"	=> 0x27FC,
    "xnis"	=> 0x22FB,
    "xodot"	=> 0x2A00,
    "xoplus"	=> 0x2A01,
    "xotime"	=> 0x2A02,
    "xrArr"	=> 0x27F9,
    "xrarr"	=> 0x27F6,
    "xsqcup"	=> 0x2A06,
    "xuplus"	=> 0x2A04,
    "xutri"	=> 0x25B3,
    "xvee"	=> 0x22C1,
    "xwedge"	=> 0x22C0,
    "Yacute"	=> 0x00DD,
    "yacute"	=> 0x00FD,
    "YAcy"	=> 0x042F,
    "yacy"	=> 0x044F,
    "Ycirc"	=> 0x0176,
    "ycirc"	=> 0x0177,
    "Ycy"	=> 0x042B,
    "ycy"	=> 0x044B,
    "yen"	=> 0x00A5,
    "YIcy"	=> 0x0407,
    "yicy"	=> 0x0457,
    "YUcy"	=> 0x042E,
    "yucy"	=> 0x044E,
    "Yuml"	=> 0x0178,
    "yuml"	=> 0x00FF,
    "Zacute"	=> 0x0179,
    "zacute"	=> 0x017A,
    "Zcaron"	=> 0x017D,
    "zcaron"	=> 0x017E,
    "Zcy"	=> 0x0417,
    "zcy"	=> 0x0437,
    "Zdot"	=> 0x017B,
    "ZeroWidthSpace"	=> 0x200B,
    "zdot"	=> 0x017C,
    "zeetrf"	=> 0x2128,
    "Zeta"	=> 0x0396,
    "zeta"	=> 0x03B6,
    "Zfr"	=> 0x2128,
    "ZHcy"	=> 0x0416,
    "zhcy"	=> 0x0436,
    "zigrarr"	=> 0x21DD,
    "Zopf"	=> 0x2124,
    "zwj"	=> 0x200D,
    "zwnj"	=> 0x200C)

function lookupname(str::ASCIIString)
    res = get(htmlonechar, str, 0x0000)
    res != 0x0000 && return string(Char(res))
    res = get(htmlnonbmp, str, 0x0000)
    res != 0x0000 && return string(Char(0x10000+res))
    res,c = get(htmltwochar, str, (0x0000,0x0000))
    res != 0x0000 && return string(Char(res),Char(c))
    utf8("")
end
end


text:
## Multivariate linear Gaussian model

module MVLinearGaussian

using SequentialMonteCarlo
using RNGPool
using StaticArrays
import SMCExamples.Particles.MVFloat64Particle
using LinearAlgebra
using Random

struct MVLGTheta{d}
  A::SMatrix{d, d, Float64}
  Q::SMatrix{d, d, Float64}
  C::SMatrix{d, d, Float64}
  R::SMatrix{d, d, Float64}
  x0::SVector{d, Float64}
  v0::SVector{d, Float64}
end

## scratch space for computations
struct MVLGPScratch{d}
  t1::MVector{d, Float64}
  t2::MVector{d, Float64}
end
MVLGPScratch{d}() where d = MVLGPScratch{d}(MVector{d, Float64}(undef),
  MVector{d, Float64}(undef))

function makeMVLGModel(theta::MVLGTheta, ys::Vector{SVector{d, Float64}}) where
  d
  n = length(ys)
  cholQ = SMatrix{d, d, Float64}(cholesky(theta.Q).L)
  invRover2 = 0.5 * inv(theta.R)
  sqrtv0 = sqrt.(theta.v0)
  logncG = - 0.5 * d * log(2 * π) - 0.5 * logdet(theta.R)
  @inline function lG(p::Int64, particle::MVFloat64Particle{d},
    scratch::MVLGPScratch{d})
    mul!(scratch.t1, theta.C, particle.x)
    @inbounds scratch.t2 .= scratch.t1 .- ys[p]
    mul!(scratch.t1, invRover2, scratch.t2)
    return logncG - dot(scratch.t1,scratch.t2)
  end
  @inline function M!(newParticle::MVFloat64Particle{d}, rng::RNG, p::Int64,
    particle::MVFloat64Particle{d}, scratch::MVLGPScratch{d})
    if p == 1
      randn!(rng, scratch.t1)
      scratch.t2 .= sqrtv0 .* scratch.t1
      newParticle.x .= theta.x0 .+ scratch.t2
    else
      randn!(rng, scratch.t1)
      mul!(scratch.t2, cholQ, scratch.t1)
      mul!(scratch.t1, theta.A, particle.x)
      newParticle.x .= scratch.t1 .+ scratch.t2
    end
  end
  return SMCModel(M!, lG, length(ys), MVFloat64Particle{d}, MVLGPScratch{d})
end

function simulateMVLGModel(theta::MVLGTheta{d}, n::Int64) where d
  model = makeMVLGModel(theta, Vector{SVector{d, Float64}}(undef, 0))
  ys = Vector{SVector{d, Float64}}(undef, n)
  xParticle = MVFloat64Particle{d}()
  xScratch = MVLGPScratch{d}()
  cholR = cholesky(theta.R).L
  rng = getRNG()
  for p in 1:n
    model.M!(xParticle, rng, p, xParticle, xScratch)
    ys[p] = theta.C*(xParticle.x) + cholR * randn(rng,d)
  end
  return ys
end

function defaultMVLGModel(d::Int64, n::Int64)
  function toeplitz(d::Int64, a::Float64, C::Float64)
    M = Matrix{Float64}(undef, d, d)
    for i = 1:d
      for j = 1:d
        M[i,j] = C * a^abs(i-j)
      end
    end
    return SMatrix{d, d, Float64}(M)
  end

  tA = SMatrix{d, d, Float64}(0.9 * Matrix{Float64}(I, d, d))
  tC = toeplitz(d, 0.5, 1.2)
  tQ = toeplitz(d, 0.2, 0.6)
  tR = toeplitz(d, 0.3, 1.5)
  tx0 = SVector{d,Float64}(range(1, step=1, length=d))
  tv0 = SVector{d,Float64}(range(2, step=1, length=d))
  theta = MVLGTheta(tA, tQ, tC, tR, tx0, tv0)
  ys = simulateMVLGModel(theta, n)

  ko = kalmanMV(theta, ys)

  mvlgModel = makeMVLGModel(theta, ys)

  return mvlgModel, theta, ys, ko
end

include("mvlgKalman.jl")

end

ext: jl


text:
# plot probabilistic distribution as bar graph
# using cumulative distribution function

module BarProbDistCdf
    using Plots, Distributions
    pyplot()

    function main(is_test=false)
        norm_dist = Normal(209.7, 4.84) # mu, std_dev

        zs = Array(190:230)
        ys = [cdf(norm_dist, z+0.5) - cdf(norm_dist, z-0.5) for z in zs]

        bar(ys, xtick=zs, label="Prob Dist")

        if is_test == false
            save_path = joinpath(split(@__FILE__, "src")[1], "src/prob_stats/prob_model/bar_prob_dist_cdf/bar_prob_dist_cdf.png")
            savefig(save_path)
        end
    end
end

max_stars_repo_name: ShisatoYano/JuliaAutonomy

max_issues_repo_name: ShisatoYano/JuliaAutonomy

max_forks_repo_name: ShisatoYano/JuliaAutonomy


text:
@doc raw"""
	peak_factor_cl56(m::S, r_ps::T, fas::FourierParameters, sdof::Oscillator; nodes::Int=35) where {S<:Real,T<:Real}

Peak factor computed using the Cartwright and Longuet-Higgins (1956) formulation.

Evaluates the integral to obtain the peak factor ``\psi``:
```math
\psi = \sqrt{2} \int_0^\infty 1 - \left( 1 - \xi \exp\left( -z^2 \right)\right)^{n_e} dz
```
where ``n_e`` is the number of extrema, ``\xi`` is the ratio ``n_z/n_e`` with ``n_z`` being the number of zero crossings.

The integral is evaluated using Gauss-Legendre integration -- and is suitable for use within an automatic differentiation environment.

See also: [`peak_factor`](@ref), [`peak_factor_dk80`](@ref)
"""
function peak_factor_cl56(m::S, r_ps::T, fas::FourierParameters, sdof::Oscillator; nodes::Int=35) where {S<:Real,T<:Real}
	# get the numbers of zero crossing and extrema
	rvt = RandomVibrationParameters(:CL56)
	n_z, n_e = zeros_extrema_numbers(m, r_ps, fas, sdof, rvt)
	# get the ratio of zero crossings to extrema
	ξ = n_z / n_e

	# compute the Gauss Legendre nodes and weights
	xi, wi = gausslegendre(nodes)

	z_min = 0.0
	z_max = 8.0
	dfac = (z_max-z_min)/2
	pfac = (z_max+z_min)/2

	# scale the nodes to the appropriate range
	zi = @. dfac * xi + pfac

	# define the integrand
	integrand(z) = 1.0 - (1.0 - ξ*exp(-z^2))^n_e

	int_sum = dfac * dot( wi, integrand.(zi) )

	pf = sqrt(2.0) * int_sum
	return pf
end

@doc raw"""
	peak_factor_cl56(m::S, r_ps::T, Dex::U, m0::V, fas::FourierParameters, sdof::Oscillator; nodes::Int=35) where {S<:Real,T<:Real,U<:Real,V<:Real}

Peak factor computed using the Cartwright and Longuet-Higgins (1956) formulation, using pre-computed `Dex` and `m0` values.

Evaluates the integral to obtain the peak factor ``\psi``:
```math
\psi = \sqrt{2} \int_0^\infty 1 - \left( 1 - \xi \exp\left( -z^2 \right)\right)^{n_e} dz
```
where ``n_e`` is the number of extrema, ``\xi`` is the ratio ``n_z/n_e`` with ``n_z`` being the number of zero crossings.

The integral is evaluated using Gauss-Legendre integration -- and is suitable for use within an automatic differentiation environment.

See also: [`peak_factor`](@ref), [`peak_factor_dk80`](@ref)
"""
function peak_factor_cl56(m::S, r_ps::T, Dex::U, m0::V, fas::FourierParameters, sdof::Oscillator; nodes::Int=35) where {S<:Real,T<:Real,U<:Real,V<:Real}
	# get all necessary spectral moments
	mi = spectral_moments([2, 4], m, r_ps, fas, sdof)
	m2 = mi[1]
	m4 = mi[2]
	# get the peak factor
	n_z = Dex * sqrt( m2 / m0 ) / π
	n_e = Dex * sqrt( m4 / m2 ) / π
	# get the ratio of zero crossings to extrema
	ξ = n_z / n_e

	# compute the Gauss Legendre nodes and weights
	xi, wi = gausslegendre(nodes)

	z_min = 0.0
	z_max = 8.0
	dfac = (z_max-z_min)/2
	pfac = (z_max+z_min)/2

	# scale the nodes to the appropriate range
	zi = @. dfac * xi + pfac

	# define the integrand
	integrand(z) = 1.0 - (1.0 - ξ*exp(-z^2))^n_e

	int_sum = dfac * dot( wi, integrand.(zi) )

	pf = sqrt(2.0) * int_sum
	return pf
end

@doc raw"""
	peak_factor_cl56(n_z::T, n_e::T; nodes::Int=35) where T<:Real

Peak factor computed using the Cartwright and Longuet-Higgins (1956) formulation, using pre-computed `n_z` and `n_e` values.

Evaluates the integral to obtain the peak factor ``\psi``:
```math
\psi = \sqrt{2} \int_0^\infty 1 - \left( 1 - \xi \exp\left( -z^2 \right)\right)^{n_e} dz
```
where ``n_e`` is the number of extrema, ``\xi`` is the ratio ``n_z/n_e`` with ``n_z`` being the number of zero crossings.

The integral is evaluated using Gauss-Legendre integration -- and is suitable for use within an automatic differentiation environment.

See also: [`peak_factor`](@ref), [`peak_factor_dk80`](@ref)
"""
function peak_factor_cl56(n_z::T, n_e::T; nodes::Int=35) where T<:Real
	# get the ratio of zero crossings to extrema
	ξ = n_z / n_e

	# compute the Gauss Legendre nodes and weights
	xi, wi = gausslegendre(nodes)

	z_min = 0.0
	z_max = 8.0
	dfac = (z_max-z_min)/2
	pfac = (z_max+z_min)/2

	# scale the nodes to the appropriate range
	zi = @. dfac * xi + pfac

	# define the integrand
	integrand(z) = 1.0 - (1.0 - ξ*exp(-z^2))^n_e

	int_sum = dfac * dot( wi, integrand.(zi) )

	pf = sqrt(2.0) * int_sum
	return pf
end

@doc raw"""
	peak_factor_cl56_gk(m::S, r_ps::T, fas::FourierParameters, sdof::Oscillator) where {S<:Real,T<:Real}

Peak factor computed using the Cartwright and Longuet-Higgins (1956) formulation, using adaptive Gauss-Kronrod integration.

Evaluates the integral to obtain the peak factor ``\psi``:
```math
\psi = \sqrt{2} \int_0^\infty 1 - \left( 1 - \xi \exp\left( -z^2 \right)\right)^{n_e} dz
```
where ``n_e`` is the number of extrema, ``\xi`` is the ratio ``n_z/n_e`` with ``n_z`` being the number of zero crossings.

The integral is evaluated using Gauss-Kronrod integration via the QuadGK.jl package -- and is not suitable for use within an automatic differentiation environment.

See also: [`peak_factor`](@ref), [`peak_factor_dk80`](@ref)
"""
function peak_factor_cl56_gk(m::S, r_ps::T, fas::FourierParameters, sdof::Oscillator) where {S<:Real,T<:Real}
	# get the numbers of zero crossing and extrema
	rvt = RandomVibrationParameters(:CL56)
	n_z, n_e = zeros_extrema_numbers(m, r_ps, fas, sdof, rvt)
	# get the ratio of zero crossings to extrema
	ξ = n_z / n_e

	# define the integrand
	integrand(z) = 1.0 - (1.0 - ξ*exp(-z^2))^n_e

	return sqrt(2.0) * quadgk(integrand, 0.0, Inf)[1]
end

"""
	peak_factor_integrand_cl56(z, n_z, n_e)

Integrand of the Cartwright Longuet-Higgins (1956) peak factor formulation.

See also: [`peak_factor_cl56`](@ref)
"""
function peak_factor_integrand_cl56(z, n_z, n_e)
  ξ = n_z / n_e
  return 1.0 - (1.0 - ξ*exp(-z^2))^n_e
end

"""
	vanmarcke_cdf(x, n_z::T, δeff::T) where T<:Real

CDF of the Vanmarcke (1975) peak factor distribution -- used within the Der Kiureghian (1980) peak factor expression.
"""
function vanmarcke_cdf(x, n_z::T, δeff::T) where T<:Real
	if x < eps()
		return zero(T)
	else
		xsq = x^2
		eδe = exp( -sqrt(π/2) * δeff * x )
		Fx = ( 1.0 - exp(-xsq/2) ) * exp( -n_z * (1.0 - eδe)/(exp(xsq/2) - 1.0) )
		return Fx
	end
end

"""
	vanmarcke_ccdf(x, n_z::T, δeff::T) where T<:Real

CCDF of the Vanmarcke (1975) peak factor distribution -- used within the Der Kiureghian (1980) peak factor expression.
"""
function vanmarcke_ccdf(x, n_z::T, δeff::T) where T<:Real
	return 1.0 - vanmarcke_cdf(x, n_z, δeff)
end

@doc raw"""
	peak_factor_dk80(m::S, r_ps::T, fas::FourierParameters, sdof::Oscillator; nodes::Int=30) where {S<:Real,T<:Real}

Peak factor computed using the Der Kiureghian (1980)/Vanmarcke (1975) formulation.

Evaluates the integral to obtain the peak factor ``\psi``:
```math
\psi = \int_0^\infty 1 - F_Z(z)dz
```
where ``F_Z(z)`` is the CDF defined by:
```math
F_Z(z) = \left[ 1-\exp\left(-\frac{z^2}{2}\right) \right] \exp\left[ -n_z \frac{1 - \exp\left( -\sqrt{\frac{\pi}{2}}\delta_{eff} z \right)}{\exp\left(\frac{z^2}{2}\right) - 1} \right]
```

The effective bandwidth ``\delta_{eff}=\delta^{1.2}`` where the bandwidth is:
```math
\delta = \sqrt{ 1 - \frac{m_1^2}{m_0 m_2} }
```

The integral is evaluated using Gauss-Legendre integration -- and is suitable for use within an automatic differentiation environment.

See also: [`peak_factor`](@ref), [`peak_factor_cl56`](@ref)
"""
function peak_factor_dk80(m::S, r_ps::T, fas::FourierParameters, sdof::Oscillator; nodes::Int=30) where {S<:Real,T<:Real}
	# compute first three spectral moments
	mi = spectral_moments([0, 1, 2], m, r_ps, fas, sdof)
	m0 = mi[1]
	m1 = mi[2]
	m2 = mi[3]

	# bandwidth, and effective bandwidth
	δ = sqrt( 1.0 - (m1^2 / (m0*m2)) )
	δeff = δ^1.2

	# excitation duration
	Dex = boore_thompson_2014(m, r_ps, fas)
	# number of zero crossings
	n_z = Dex * sqrt( m2/m0 ) / π

	# compute the Gauss Legendre nodes and weights
	xi, wi = gausslegendre(nodes)

	z_min = 0.0
	z_max = 6.0
	dfac = (z_max-z_min)/2
	pfac = (z_max+z_min)/2

	# scale the nodes to the appropriate range
	zi = @. dfac * xi + pfac
	# evaluate integrand
	yy = vanmarcke_ccdf.(zi, n_z, δeff)

	return int_sum = dfac * dot( wi, yy )
end

@doc raw"""
	peak_factor_dk80(m::S, r_ps::T, Dex::U, m0::V, fas::FourierParameters, sdof::Oscillator; nodes::Int=30) where {S<:Real,T<:Real,U<:Real,V<:Real}

Peak factor computed using the Der Kiureghian (1980)/Vanmarcke (1975) formulation, using precomputed `Dex` and `m0`.

Evaluates the integral to obtain the peak factor ``\psi``:
```math
\psi = \int_0^\infty 1 - F_Z(z)dz
```
where ``F_Z(z)`` is the CDF defined by:
```math
F_Z(z) = \left[ 1-\exp\left(-\frac{z^2}{2}\right) \right] \exp\left[ -n_z \frac{1 - \exp\left( -\sqrt{\frac{\pi}{2}}\delta_{eff} z \right)}{\exp\left(\frac{z^2}{2}\right) - 1} \right]
```

The effective bandwidth ``\delta_{eff}=\delta^{1.2}`` where the bandwidth is:
```math
\delta = \sqrt{ 1 - \frac{m_1^2}{m_0 m_2} }
```

The integral is evaluated using Gauss-Legendre integration -- and is suitable for use within an automatic differentiation environment.

See also: [`peak_factor`](@ref), [`peak_factor_cl56`](@ref)
"""
function peak_factor_dk80(m::S, r_ps::T, Dex::U, m0::V, fas::FourierParameters, sdof::Oscillator; nodes::Int=30) where {S<:Real,T<:Real,U<:Real,V<:Real}
	# compute first three spectral moments
	mi = spectral_moments([1, 2], m, r_ps, fas, sdof)
	m1 = mi[1]
	m2 = mi[2]

	# bandwidth, and effective bandwidth
	δ = sqrt( 1.0 - (m1^2 / (m0*m2)) )
	δeff = δ^1.2

	# number of zero crossings
	n_z = Dex * sqrt( m2/m0 ) / π

	# compute the Gauss Legendre nodes and weights
	xi, wi = gausslegendre(nodes)

	z_min = 0.0
	z_max = 6.0
	dfac = (z_max-z_min)/2
	pfac = (z_max+z_min)/2

	# scale the nodes to the appropriate range
	zi = @. dfac * xi + pfac
	# evaluate integrand
	yy = vanmarcke_ccdf.(zi, n_z, δeff)

	return int_sum = dfac * dot( wi, yy )
end

@doc raw"""
	peak_factor_dk80_gk(m::S, r_ps::T, fas::FourierParameters, sdof::Oscillator) where {S<:Float64,T<:Real}

Peak factor computed using the Der Kiureghian (1980)/Vanmarcke (1975) formulation, using precomputed `Dex` and `m0`.

Evaluates the integral to obtain the peak factor ``\psi``:
```math
\psi = \int_0^\infty 1 - F_Z(z)dz
```
where ``F_Z(z)`` is the CDF defined by:
```math
F_Z(z) = \left[ 1-\exp\left(-\frac{z^2}{2}\right) \right] \exp\left[ -n_z \frac{1 - \exp\left( -\sqrt{\frac{\pi}{2}}\delta_{eff} z \right)}{\exp\left(\frac{z^2}{2}\right) - 1} \right]
```

The effective bandwidth ``\delta_{eff}=\delta^{1.2}`` where the bandwidth is:
```math
\delta = \sqrt{ 1 - \frac{m_1^2}{m_0 m_2} }
```

The integral is evaluated using adaptive Gauss-Kronrod integration from the QuadGK.jl package -- and is therefore not suitable for use within an automatic differentiation environment.

See also: [`peak_factor`](@ref), [`peak_factor_dk80`](@ref), [`peak_factor_cl56`](@ref)
"""
function peak_factor_dk80_gk(m::S, r_ps::T, fas::FourierParameters, sdof::Oscillator) where {S<:Float64,T<:Real}
	# compute first three spectral moments
	mi = spectral_moments([0, 1, 2], m, r_ps, fas, sdof)
	m0 = mi[1]
	m1 = mi[2]
	m2 = mi[3]

	# bandwidth, and effective bandwidth
	δ = sqrt( 1.0 - (m1^2 / (m0*m2)) )
	δeff = δ^1.2

	# excitation duration
	Dex = boore_thompson_2014(m, r_ps, fas)
	# number of zero crossings
	n_z = Dex * sqrt( m2/m0 ) / π

	integrand(x) = vanmarcke_ccdf(x, n_z, δeff)

	return quadgk(integrand, 0.0, Inf)[1]
end

@doc raw"""
	peak_factor(m::S, r_ps::T, fas::FourierParameters, sdof::Oscillator; pf_method::Symbol=:DK80) where {S<:Real,T<:Real}

Peak factor ``u_{max} / u_{rms}`` with a switch of `pf_method` to determine the approach adopted.
`pf_method` can currently be one of:
	- `:CL56` for Cartright Longuet-Higgins (1956)
	- `:DK80` for Der Kiureghian (1980), building on Vanmarcke (1975)

Defaults to `:DK80`.
"""
function peak_factor(m::S, r_ps::T, fas::FourierParameters, sdof::Oscillator, rvt::RandomVibrationParameters) where {S<:Real,T<:Real}
	if rvt.pf_method == :CL56
		return peak_factor_cl56(m, r_ps, fas, sdof)
	elseif rvt.pf_method == :DK80
		return peak_factor_dk80(m, r_ps, fas, sdof)
	else
		U = get_parametric_type(fas)
		return U(NaN)
	end
end

"""
	peak_factor(m::S, r_ps::T, Dex::U, m0::V, fas::FourierParameters, sdof::Oscillator, rvt::RandomVibrationParameters) where {S<:Real,T<:Real,U<:Real,V<:Real}

Peak factor u_max / u_rms with a switch of `pf_method` to determine the approach adopted.
`pf_method` can currently be one of:
	- `:CL56` for Cartright Longuet-Higgins (1956)
	- `:DK80` for Der Kiureghian (1980), building on Vanmarcke (1975)

Defaults to `:DK80`.
"""
function peak_factor(m::S, r_ps::T, Dex::U, m0::V, fas::FourierParameters, sdof::Oscillator, rvt::RandomVibrationParameters) where {S<:Real,T<:Real,U<:Real,V<:Real}
	if rvt.pf_method == :CL56
		return peak_factor_cl56(m, r_ps, Dex, m0, fas, sdof)
	elseif rvt.pf_method == :DK80
		return peak_factor_dk80(m, r_ps, Dex, m0, fas, sdof)
	else
		if S <: Dual
			return S(NaN)
		elseif V <: Dual
			return V(NaN)
		else
			return U(NaN)
		end
	end
end


text:
function create_agent(
    ::Val{:SAC};
    env,
    seed=37,
    lr_alpha=0.0001f0,
    alpha=0.2f0,
    γ=0.99f0,
    τ = 0.005f0,
    target_entropy=0.5, # length(action_space(env)) orig
    replay_size=100000, # 10000 orig
    start_steps = 10000,
    update_after = 1000,
    hidden_units_policy=100, # 30 orig
    hidden_units_value=100, # 30 orig
    update_freq=10, # 50 orig
    batch_size=128, # 32 orig
    action_interval=1,
    hidden_layers_policy=2,
    hidden_layers_value=2,
    action_smoothing=0f0,
    clampfun=clamp,
    actfun=relu,
    start_policy=:RandomAgent,
    kwargs...
)
    rng = StableRNG(seed)

    ns = length(state(env))
    na = length(action_space(env))

    init = glorot_uniform(rng)

    create_policy_net() = NeuralNetworkApproximator(
        model = GaussianNetwork(
            pre = Chain(
                Dense(ns, hidden_units_policy, actfun; init=init),
                [Dense(hidden_units_policy, hidden_units_policy, actfun; init=init) for i in 2:hidden_layers_policy]...,
            ),
            μ = Chain(Dense(hidden_units_policy, na; init=init)),
            logσ = Chain(
                Dense(hidden_units_policy, na; init=init),
                x -> clampfun.(x, -10f0, 3f0),
            ),
            # min_σ = 1f-10,
            # max_σ = 1f3,
            # Not setting them means -Inf32..Inf32
        ),
        optimizer = ADAM(0.003),
    )

    create_q_net() = NeuralNetworkApproximator(
        model = Chain(
            Dense(ns + na, hidden_units_value, actfun; init=init),
            [Dense(hidden_units_value, hidden_units_value, actfun; init=init) for i in 2:hidden_layers_value]...,
            Dense(hidden_units_value, 1; init=init),
        ),
        optimizer = ADAM(0.003),
    )

    policy = SACPolicy(
        policy = create_policy_net(),
        qnetwork1 = create_q_net(),
        qnetwork2 = create_q_net(),
        target_qnetwork1 = create_q_net(),
        target_qnetwork2 = create_q_net(),
        γ = Float32(γ),
        τ = Float32(τ),
        α = Float32(alpha),
        batch_size = batch_size,
        start_steps = start_steps,
        update_after = update_after,
        update_freq = update_freq,
        start_policy = create_agent(Val(start_policy); env, kwargs...),
        automatic_entropy_tuning = true,
        lr_alpha = Float32(lr_alpha),
        action_dims = target_entropy,
        rng = rng,
    )

    if action_smoothing > 0
        policy = RunningAvgPolicy(
            policy = policy,
            smoothing = action_smoothing,
            na = na,
        )
    elseif action_interval > 1
        policy = HoldActionPolicy(
            policy = policy,
            action_interval = action_interval,
        )
    end

    Agent(
        policy = policy,
        trajectory = CircularArraySARTTrajectory(
            capacity = replay_size,
            state = Vector{Float32} => (ns,),
            action = Vector{Float32} => (na,),
        ),
    )
end

max_stars_repo_name: albheim/ServiceMeshControl

max_issues_repo_name: albheim/ServiceMeshControl

max_forks_repo_name: albheim/ServiceMeshControl


text:
include("../src/Pipelines.jl")

using .Pipelines
using Test

### util
@test Pipelines.parse_default_element("x") == ("x", Any, nothing)
@test Pipelines.parse_default_element("x" => Int) == ("x", Int, nothing)
@test Pipelines.parse_default_element("x" => 5) == ("x", Any, 5)
@test Pipelines.parse_default_element("x" => 5 => Int) == ("x", Int, 5)
@test Pipelines.parse_default_element("x" => Int => 5) == ("x", Int, 5)
@test Pipelines.parse_default_element("x" => Int => DataType) == ("x", DataType, Int)
@test Pipelines.parse_default_element("x" => DataType => Int) == ("x", DataType, Int)
@test Pipelines.parse_default_element( :b => (5.0 => Int)) == ("b", Int, 5)

@test_throws ErrorException Pipelines.parse_default_element("x" => Int => "5")
@test_throws ErrorException Pipelines.parse_default_element("x" => "5" => Int)
@test_throws ErrorException Pipelines.parse_default_element(5)

v = ["A", "B" => Int, "C" => 9.0 => Float64]
@test Pipelines.parse_default(v) == (["A", "B", "C"], DataType[Any, Int64, Float64], Any[nothing, nothing, 9.0])

v = ["A", :B => Int, "C" => 9.0 => Float64]
@test Pipelines.parse_default(v) == (["A", "B", "C"], DataType[Any, Int64, Float64], Any[nothing, nothing, 9.0])

v = ["A", :B => Int => 5.0, "C" => 9.0 => Float64]
@test Pipelines.parse_default(v) == (["A", "B", "C"], DataType[Any, Int64, Float64], Any[nothing, 5, 9.0])

## keyword interpolation
allputs = Dict(
    "A" => 123,
    "B" => "<A>",
    "C" => "<B><A>"
)
@test Pipelines.keyword_interpolation(allputs) == Dict(
    "A" => 123,
    "B" => "123",
    "C" => "123123"
)

allputs = Dict(
    "A" => 123,
    "B" => "<C>",
    "C" => "<B><A>"
)
@test_throws ErrorException Pipelines.keyword_interpolation(allputs)

### cmd dependency

julia = CmdDependency(
    exec = Base.julia_cmd(),
    test_args = `--version`,
    validate_success = true,
    validate_stdout = x -> occursin(r"^julia version", x),
    validate_stderr = do_nothing,
    exit_when_fail = true
)

check_dependency(julia)

@test `$julia` == Base.julia_cmd()

### cmd program

p = CmdProgram(
    cmd_dependencies = [julia],
    id_file = "id_file",
    inputs = [
        "input",
        "input2" => Int,
        "optional_arg" => 5,
        "optional_arg2" => 0.5 => Number
    ],
    outputs = [
        "output" => "<input>.output"
    ],
    cmd = `echo input input2 optional_arg optional_arg2 output`
)

inputs = Dict(
    "input" => `in1`,
    "input2" => 2
)

outputs = Dict(
    "output" => "out"
)

run(p,
    inputs = inputs,
    outputs = outputs,
    skip_when_done = false,
    verbose = true,
    touch_run_id_file = false
)

run(p,
    inputs,
    outputs;
    skip_when_done = false,
    verbose = false,
    touch_run_id_file = false
)

p_nooutput = CmdProgram(
    cmd_dependencies = [julia],
    id_file = "id_file",
    inputs = ["input", "input2", "optional_arg", "optional_arg2"],
    cmd = `echo input input2`
)

run(p_nooutput,
    inputs;
    skip_when_done = false,
    verbose = false,
    touch_run_id_file = false
)

cmd, run_id_file = run(p,
    inputs = Dict(
        "input" => `in1`,
        "input2" => 5.0
    ),
    outputs = Dict(
        "output" => `out`
    ),
    dry_run=true
)
rm(run_id_file, force=true)

program_bowtie2 = CmdProgram(
	name = "Bowtie2 Mapping",
	id_file = ".bowtie2",

	inputs = ["FASTQ", "REF"],
	validate_inputs = inputs -> begin
		check_dependency_file(inputs["FASTQ"]) &&
		check_dependency_file(inputs["REF"])
	end,

	prerequisites = (inputs, outputs) -> begin
		mkpath(dirname(to_str(outputs["BAM"])))
	end,

	outputs = ["BAM"],
	infer_outputs = inputs -> begin
		Dict("BAM" => str(inputs["FASTQ"]) * ".bam")
	end,
	validate_outputs = outputs -> begin
		check_dependency_file(outputs["BAM"])
	end,

	cmd = pipeline(`bowtie2 -x REF -q FASTQ`, `samtools sort -O bam -o BAM`),

	wrap_up = (inputs, outputs) -> run(`samtools index $(outputs["BAM"])`)
)

### julia program
p = JuliaProgram(
	id_file = "id_file",
	inputs = [
		"a",
		"b" => Int
	],
	outputs = [
		"c" => "<a>.<b>"
	],
	main = (inputs, outputs) -> begin
		a = inputs["a"]
		b = inputs["b"]
		println("inputs are ", a, " and ", b)
		println("You can also use info in outputs: ", outputs["c"])
		println("The returned value will be assigned to a new outputs")

		return Dict{String,Any}("c" => b^2)
	end
)

inputs = Dict(
	"a" => `in1`,
	"b" => 2
)

outputs = Dict(
	"c" => "out"
)

success, outputs = run(p, inputs, outputs;
	touch_run_id_file = false
) # outputs will be refreshed

success, outputs = run(p, inputs;
	touch_run_id_file = false
) # outputs will be refreshed

### run program without inputs outputs
p = JuliaProgram(
	id_file = "id_file",
	inputs = [
		"a" => 10.6,
		"b" =>  5 => Int
	],
	outputs = "c" => "<a>.<b>",
	main = (inputs, outputs) -> begin
		return Dict{String,Any}("c" => inputs["b"]^2)
	end
)
success, outputs = run(p;
	touch_run_id_file = false
)
inputs, outputs = Pipelines.xxputs_completion_and_check(p, Dict{String, Any}(), Dict{String, Any}())

p = JuliaProgram(
	id_file = "id_file",
	inputs = [
		"a" => 10.6 => Float64,
		"b" =>  5 => Int
	],
	outputs = "c" => "<a>.<b>",
	main = (inputs, outputs) -> begin
		return Dict{String,Any}("c" => inputs["b"]^2)
	end
)
success, outputs = run(p;
	touch_run_id_file = false
)
success, outputs = run(p,
	inputs = Dict(
		"a" => 10.6,
		"b" =>  2.0
	),
	touch_run_id_file = false
)

success, outputs = run(p,
	inputs = :a => 8,
	touch_run_id_file = false
)

### testing dir, stdout/err/log

## julia program
p = JuliaProgram(
	id_file = "id_file",
	inputs = [
		:a => 10.6 => Float64,
		:b =>  5 => Int
	],
	outputs = "c" => "<a>.<b>",
	main = (inputs, outputs) -> begin
		println(stdout, "stdout> ", inputs["a"])
		println(stderr, "stderr> ", inputs["b"])
		@info outputs
		return Dict{String,Any}("c" => inputs["b"]^2)
	end
)

tmp = mktempdir()
cd(tmp)
working_dir = mktempdir()
run(p, touch_run_id_file=false, stdout="out.txt", stdlog="log.txt")

@test read("out.txt", String) == "stdout> 10.6\n"
@test length(read("log.txt", String)) > 600

run(p, "a" => 6.6, touch_run_id_file=false, stderr = "err.txt", dir=working_dir)

# redirect files at working dir
@test !isfile("err.txt")
@test isfile(joinpath(working_dir, "err.txt"))
@test length(read(joinpath(working_dir, "err.txt"), String)) > 600

## cmd program
p = CmdProgram(
	id_file = "id_file",
	inputs = [
		:a => 10.6 => Float64,
		:b =>  5 => Int
	],
	outputs = "c" => "<a>.<b>",
	cmd = `echo this is stdout a b` & pipeline(`julia -e '@info "this is stderr"'`)
)
out_io = open("out.txt", "w+")

run(p, touch_run_id_file=false, stdout=out_io, stderr="err.txt", stdlog="log.txt")

close(out_io)

@test read("out.txt", String) == "this is stdout 10.6 5\n"
@test read("err.txt", String) == "[ Info: this is stderr\n"
@test !occursin("[ Info: this is stderr", read("log.txt", String))

# clean up
cd(homedir())
rm(tmp, recursive=true)
rm(working_dir, recursive=true)


text:
# Date/DateTime Ranges

# Override default step; otherwise it would be Millisecond(1)
Base.colon{T<:DateTime}(start::T, stop::T) = StepRange(start, Day(1), stop)

# Given a start and end date, how many steps/periods are in between
guess(a::DateTime,b::DateTime,c) = ifloor(Int64,(int128(b) - int128(a))/toms(c))
guess(a::Date,b::Date,c) = int64(div(int64(b - a),days(c)))
function len(a,b,c)
    lo, hi, st = min(a,b), max(a,b), abs(c)
    i = guess(a,b,c)-1
    while lo+st*i <= hi
        i += 1
    end
    return i-1
end
Base.length{T<:TimeType}(r::StepRange{T}) = isempty(r) ? 0 : len(r.start,r.stop,r.step) + 1
# Period ranges hook into Int64 overflow detection
Base.length{P<:Period}(r::StepRange{P}) = length(StepRange(value(r.start),value(r.step),value(r.stop)))

# Used to calculate the last valid date in the range given the start, stop, and step
# last = stop - steprem(start,stop,step)
Base.steprem{T<:TimeType}(a::T,b::T,c) = b - (a + c*len(a,b,c))

import Base.in
function in{T<:TimeType}(x::T, r::StepRange{T})
    n = len(first(r),x,step(r)) + 1
    n >= 1 && n <= length(r) && r[n] == x
end

Base.start{T<:TimeType}(r::StepRange{T}) = 0
Base.next{T<:TimeType}(r::StepRange{T}, i) = (r.start+r.step*i,i+1)
Base.done{T<:TimeType,S<:Period}(r::StepRange{T,S}, i::Integer) = length(r) <= i


text:
@testset "1448.count-good-nodes-in-binary-tree.jl" begin
    @test good_nodes(TreeNode{Int}([3,1,4,3,nothing,1,5])) == 4
    @test good_nodes(TreeNode{Int}([3,3,nothing,4,2])) == 3
    @test good_nodes(TreeNode{Int}([1])) == 1
end


text:
# This file was generated by the Julia Swagger Code Generator
# Do not modify this file directly. Modify the swagger specification instead.

mutable struct PublicIPAddressPropertiesFormat <: SwaggerModel
    publicIPAllocationMethod::Any # spec type: Union{ Nothing, IPAllocationMethod } # spec name: publicIPAllocationMethod
    publicIPAddressVersion::Any # spec type: Union{ Nothing, IPVersion } # spec name: publicIPAddressVersion
    ipConfiguration::Any # spec type: Union{ Nothing, IPConfiguration2 } # spec name: ipConfiguration
    dnsSettings::Any # spec type: Union{ Nothing, PublicIPAddressDnsSettings } # spec name: dnsSettings
    ddosSettings::Any # spec type: Union{ Nothing, DdosSettings } # spec name: ddosSettings
    ipTags::Any # spec type: Union{ Nothing, Vector{IpTag} } # spec name: ipTags
    ipAddress::Any # spec type: Union{ Nothing, String } # spec name: ipAddress
    publicIPPrefix::Any # spec type: Union{ Nothing, SubResource } # spec name: publicIPPrefix
    idleTimeoutInMinutes::Any # spec type: Union{ Nothing, Int32 } # spec name: idleTimeoutInMinutes
    resourceGuid::Any # spec type: Union{ Nothing, String } # spec name: resourceGuid
    provisioningState::Any # spec type: Union{ Nothing, ProvisioningState } # spec name: provisioningState

    function PublicIPAddressPropertiesFormat(;publicIPAllocationMethod=nothing, publicIPAddressVersion=nothing, ipConfiguration=nothing, dnsSettings=nothing, ddosSettings=nothing, ipTags=nothing, ipAddress=nothing, publicIPPrefix=nothing, idleTimeoutInMinutes=nothing, resourceGuid=nothing, provisioningState=nothing)
        o = new()
        validate_property(PublicIPAddressPropertiesFormat, Symbol("publicIPAllocationMethod"), publicIPAllocationMethod)
        setfield!(o, Symbol("publicIPAllocationMethod"), publicIPAllocationMethod)
        validate_property(PublicIPAddressPropertiesFormat, Symbol("publicIPAddressVersion"), publicIPAddressVersion)
        setfield!(o, Symbol("publicIPAddressVersion"), publicIPAddressVersion)
        validate_property(PublicIPAddressPropertiesFormat, Symbol("ipConfiguration"), ipConfiguration)
        setfield!(o, Symbol("ipConfiguration"), ipConfiguration)
        validate_property(PublicIPAddressPropertiesFormat, Symbol("dnsSettings"), dnsSettings)
        setfield!(o, Symbol("dnsSettings"), dnsSettings)
        validate_property(PublicIPAddressPropertiesFormat, Symbol("ddosSettings"), ddosSettings)
        setfield!(o, Symbol("ddosSettings"), ddosSettings)
        validate_property(PublicIPAddressPropertiesFormat, Symbol("ipTags"), ipTags)
        setfield!(o, Symbol("ipTags"), ipTags)
        validate_property(PublicIPAddressPropertiesFormat, Symbol("ipAddress"), ipAddress)
        setfield!(o, Symbol("ipAddress"), ipAddress)
        validate_property(PublicIPAddressPropertiesFormat, Symbol("publicIPPrefix"), publicIPPrefix)
        setfield!(o, Symbol("publicIPPrefix"), publicIPPrefix)
        validate_property(PublicIPAddressPropertiesFormat, Symbol("idleTimeoutInMinutes"), idleTimeoutInMinutes)
        setfield!(o, Symbol("idleTimeoutInMinutes"), idleTimeoutInMinutes)
        validate_property(PublicIPAddressPropertiesFormat, Symbol("resourceGuid"), resourceGuid)
        setfield!(o, Symbol("resourceGuid"), resourceGuid)
        validate_property(PublicIPAddressPropertiesFormat, Symbol("provisioningState"), provisioningState)
        setfield!(o, Symbol("provisioningState"), provisioningState)
        o
    end
end # type PublicIPAddressPropertiesFormat

const _property_map_PublicIPAddressPropertiesFormat = Dict{Symbol,Symbol}(Symbol("publicIPAllocationMethod")=>Symbol("publicIPAllocationMethod"), Symbol("publicIPAddressVersion")=>Symbol("publicIPAddressVersion"), Symbol("ipConfiguration")=>Symbol("ipConfiguration"), Symbol("dnsSettings")=>Symbol("dnsSettings"), Symbol("ddosSettings")=>Symbol("ddosSettings"), Symbol("ipTags")=>Symbol("ipTags"), Symbol("ipAddress")=>Symbol("ipAddress"), Symbol("publicIPPrefix")=>Symbol("publicIPPrefix"), Symbol("idleTimeoutInMinutes")=>Symbol("idleTimeoutInMinutes"), Symbol("resourceGuid")=>Symbol("resourceGuid"), Symbol("provisioningState")=>Symbol("provisioningState"))
const _property_types_PublicIPAddressPropertiesFormat = Dict{Symbol,String}(Symbol("publicIPAllocationMethod")=>"IPAllocationMethod", Symbol("publicIPAddressVersion")=>"IPVersion", Symbol("ipConfiguration")=>"IPConfiguration2", Symbol("dnsSettings")=>"PublicIPAddressDnsSettings", Symbol("ddosSettings")=>"DdosSettings", Symbol("ipTags")=>"Vector{IpTag}", Symbol("ipAddress")=>"String", Symbol("publicIPPrefix")=>"SubResource", Symbol("idleTimeoutInMinutes")=>"Int32", Symbol("resourceGuid")=>"String", Symbol("provisioningState")=>"ProvisioningState")
Base.propertynames(::Type{ PublicIPAddressPropertiesFormat }) = collect(keys(_property_map_PublicIPAddressPropertiesFormat))
Swagger.property_type(::Type{ PublicIPAddressPropertiesFormat }, name::Symbol) = Union{Nothing,eval(Base.Meta.parse(_property_types_PublicIPAddressPropertiesFormat[name]))}
Swagger.field_name(::Type{ PublicIPAddressPropertiesFormat }, property_name::Symbol) =  _property_map_PublicIPAddressPropertiesFormat[property_name]

function check_required(o::PublicIPAddressPropertiesFormat)
    true
end

function validate_property(::Type{ PublicIPAddressPropertiesFormat }, name::Symbol, val)
end


text:
using LatentDiffEq
using OrdinaryDiffEq
using BSON:@save
using Parameters: @with_kw
using Random
using Statistics
using Distributions
using ModelingToolkit
using Flux
using Luxor
using Images

@with_kw mutable struct Args_gen
      ## Latent Differential Equations
      # diffeq = Pendulum()

      tspan = (0.0f0, 4.95f0)         # time span
      dt = 0.05                       # timestep for ode solve
      u₀_range = (0, π/6)             # initial value range
      p₀_range = (1.0, 2.0)           # parameter value range
      n_traj = 450                    # Number of trajectories
      seed = 1                        # random seed

      ## High dimensional data arguments
      high_dim_args = (19, 1.75, 3.5)    # for the the simple pendulum
                                         # (pendulumlength, radius, rodthickness)
end

function generate_dataset(; diffeq = Pendulum(), kws...)
      args = Args_gen(; kws...)
      @unpack_Args_gen args
      Random.seed!(seed)

      ## Problem definition
      prob = remake(diffeq.prob, tspan = tspan)

      ## Ensemble functions definition
      prob_func(prob,i,repeat) = remake(prob, u0 = u0s[i], p = ps[i])

      # Sample initial condition and parameters from a uniform distribution
      ps = [rand_uniform(p₀_range, length(prob.p)) for i in 1:n_traj]
      # u0s = [rand_uniform(u₀_range, length(prob.u0)) for i in 1:n_traj]
      u0s = [vcat(rand_uniform_u0(u₀_range, length(prob.u0)), 0) for i in 1:n_traj]

      # Build and solve EnsembleProblem data
      ensemble_prob = EnsembleProblem(prob, prob_func = prob_func)
      sols = solve(ensemble_prob, diffeq.solver, saveat = args.dt, trajectories = n_traj)

      # Store the trajectories variables
      latent_data = [dropdims(Array(sol), dims = 2) for sol in sols]

      # Create animations with Luxor
      high_dim_data = [create_high_dim_data(sol, high_dim_args) for sol in sols]

      return latent_data, u0s, ps, high_dim_data
end

## util functions
rand_uniform(range::Tuple, size) = rand(Uniform(range...),(size,1))
rand_uniform(range::Array, size) = [rand(Uniform(r[1], r[2])) for r in eachrow(range)]
rand_uniform_u0(range::Tuple, size) = rand(Uniform(range...),(Int(size/2),1))

## Luxor util functions
# convert a timeseries to two trajectories
function maketrajectories(tseries, pendulumlength)
      innertrajectory = Point[]
      @inbounds for i in 1:length(tseries)
            angle1 = π/2 + tseries[i][1]
            pos1 = Point(pendulumlength * cos(angle1), pendulumlength * sin(angle1))
            push!(innertrajectory, pos1)
      end
      return innertrajectory
end

function drawrod(startpos, endpos, linewidth)
      rodlength = distance(startpos, endpos)
      setline(linewidth)
      line(startpos, endpos, :stroke)

      p = (startpos + endpos) / 2
      θ = atan(p[2] - startpos[2], p[1] - startpos[1])
      sethue("black")
      fontsize(8)
      # text("julia", p, valign=:middle, halign=:center, angle = θ)
      Luxor.text("|", p, valign=:middle, halign=:center, angle = θ)
end

function frame(pos, radius, rodthickness)
      background("black")
      sethue("white")
      offset = Point(0,-8.5)
      pos += offset
      sethue("white")
      circle(pos, radius, :fill)
      circle(offset, radius, :fill)
      drawrod(offset, pos, rodthickness)
      sethue("black")
      circle(offset, radius/2, :fill)
end

function create_frames(trajectories, radius, rodthickness, w=28, h=28)
      frames = Matrix{Float32}[]
      buffer = zeros(UInt32, w, h)
      for pos in trajectories
          a = @imagematrix! buffer frame(pos, radius, rodthickness) w h
          push!(frames, Float32.(Gray.(a)))
      end
      frames
end

function create_high_dim_data(sol, high_dim_args)
      pendulumlength, radius, rodthickness = high_dim_args
      trajectories = maketrajectories(sol, pendulumlength)
      frames = create_frames(trajectories, radius, rodthickness)
end

# latent_data, u0s, ps, high_dim_data = generate_dataset()

# data = (latent_data, u0s, ps, high_dim_data)
# root_dir = @__DIR__
# mkpath("$root_dir/data")
# @save "$root_dir/data/data.bson" data


text:
# Whitening

"""
    cov_whitening(C)

Derive the whitening transform coefficient matrix `W` given the covariance matrix `C`. Here, `C` can be either a square matrix, or an instance of `Cholesky`.

Internally, this function solves the whitening transform using Cholesky factorization. The rationale is as follows: let ``\\mathbf{C} = \\mathbf{U}^T \\mathbf{U}`` and ``\\mathbf{W} = \\mathbf{U}^{-1}``, then ``\\mathbf{W}^T \\mathbf{C} \\mathbf{W} = \\mathbf{I}``.

**Note:** The return matrix `W` is an upper triangular matrix.
"""
function cov_whitening(C::Cholesky{T}) where {T<:Real}
    cf = C.UL
    Matrix{T}(inv(istriu(cf) ? cf : cf'))
end

"""
    cov_whitening!(C)

In-place version of `cov_whitening(C)`, in which the input matrix `C` will be overwritten during computation. This can be more efficient when `C` is no longer used.
"""
cov_whitening!(C::AbstractMatrix{<:Real}) = cov_whitening(cholesky!(Hermitian(C, :U)))
cov_whitening(C::AbstractMatrix{<:Real}) = cov_whitening!(copy(C))

"""
    cov_whitening!(C, regcoef)

In-place version of `cov_whitening(C, regcoef)`, in which the input matrix `C` will be overwritten during computation. This can be more efficient when `C` is no longer used.
"""
cov_whitening!(C::AbstractMatrix{<:Real}, regcoef::Real) = cov_whitening!(regularize_symmat!(C, regcoef))

"""
    cov_whitening(C, regcoef)

Derive a whitening transform based on a regularized covariance, as `C + (eigmax(C) * regcoef) * eye(d)`.
"""
cov_whitening(C::AbstractMatrix{<:Real}, regcoef::Real) = cov_whitening!(copy(C), regcoef)

## Whitening type

"""
A whitening transform representation.
"""
struct Whitening{T<:Real} <: AbstractDataTransform
    mean::AbstractVector{T}
    W::AbstractMatrix{T}

    function Whitening{T}(mean::AbstractVector{T}, W::AbstractMatrix{T}) where {T<:Real}
        d, d2 = size(W)
        d == d2 || error("W must be a square matrix.")
        isempty(mean) || length(mean) == d ||
        throw(DimensionMismatch("Sizes of mean and W are inconsistent."))
        return new(mean, W)
    end
end
Whitening(mean::AbstractVector{T}, W::AbstractMatrix{T}) where {T<:Real} = Whitening{T}(mean, W)

"""
    length(f)

Get the dimension of the  whitening transform `f`.
"""
length(f::Whitening) = size(f.W, 1)

"""
    size(f)

Dimensions of the coefficient matrix of the whitening transform `f`.
"""
size(f::Whitening) = size(f.W)

"""
    mean(f)

Get the mean vector of the whitening transformation `f`.

**Note:** if mean is empty, this function returns a zero vector of `length(f)`.
"""
mean(f::Whitening) = fullmean(length(f), f.mean)

"""
    transform(f, x)

Apply the whitening transform `f` to a vector or a matrix `x` with samples in columns, as ``\\mathbf{W}^T (\\mathbf{x} - \\boldsymbol{\\mu})``.
"""
function transform(f::Whitening, x::AbstractVecOrMat{<:Real})
    s = size(x)
    Z, dims = if length(s) == 1
        length(f.mean) == s[1] || throw(DimensionMismatch("Inconsistent dimensions."))
        x - f.mean, 2
    else
        dims = (s[1] == length(f.mean)) + 1
        length(f.mean) == s[3-dims] || throw(DimensionMismatch("Inconsistent dimensions."))
        x .- (dims == 2 ? f.mean : transpose(f.mean)), dims
    end
    if dims == 2
        transpose(f.W) * Z
    else
        Z * f.W
    end
end

"""
    fit(Whitening, X::AbstractMatrix{T}; kwargs...)

Estimate a whitening transform from the data given in `X`.

This function returns an instance of [`Whitening`](@ref)

**Keyword Arguments:**
- `regcoef`: The regularization coefficient. The covariance will be regularized as follows when `regcoef` is positive `C + (eigmax(C) * regcoef) * eye(d)`. Default values is `zero(T)`.

- `dims`: if `1` the transformation calculated from the row samples. fit standardization parameters in column-wise fashion;
  if `2` the transformation calculated from the column samples. The default is `nothing`, which is equivalent to `dims=2` with a deprecation warning.

- `mean`: The mean vector, which can be either of:
    - `0`: the input data has already been centralized
    - `nothing`: this function will compute the mean (**default**)
    - a pre-computed mean vector

**Note:** This function internally relies on [`cov_whitening`](@ref) to derive the transformation `W`.
"""
function fit(::Type{Whitening}, X::AbstractMatrix{T};
             dims::Union{Integer,Nothing}=nothing,
             mean=nothing, regcoef::Real=zero(T)) where {T<:Real}
    if dims === nothing
        Base.depwarn("fit(Whitening, x) is deprecated: use fit(Whitening, x, dims=2) instead", :fit)
        dims = 2
    end
    if dims == 1
        n = size(X,1)
        n >= 2 || error("X must contain at least two rows.")
    elseif dims == 2
        n = size(X, 2)
        n >= 2 || error("X must contain at least two columns.")
    else
        throw(DomainError(dims, "fit only accept dims to be 1 or 2."))
    end
    mv = preprocess_mean(X, mean; dims=dims)
    Z = centralize((dims==1 ? transpose(X) : X), mv)
    C = rmul!(Z * transpose(Z), one(T) / (n - 1))
    return Whitening(mv, cov_whitening!(C, regcoef))
end

# invsqrtm

function _invsqrtm!(C::AbstractMatrix{<:Real})
    n = size(C, 1)
    size(C, 2) == n || error("C must be a square matrix.")
    E = eigen!(Symmetric(C))
    U = E.vectors
    evs = E.values
    for i = 1:n
        @inbounds evs[i] = 1.0 / sqrt(sqrt(evs[i]))
    end
    rmul!(U, Diagonal(evs))
    return U * transpose(U)
end

"""
    invsqrtm(C)

Compute `inv(sqrtm(C))` through symmetric eigenvalue decomposition.
"""
invsqrtm(C::AbstractMatrix{<:Real}) = _invsqrtm!(copy(C))